diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-19 20:29:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:42 +0300 |
commit | c632452430cb3f886da38fa315cb27a3a3a10d2c (patch) | |
tree | bdaeac586877e77046ef38dd4ad7a97a6b4e7af0 /src/gui/widgets/widget2.h | |
parent | dbba47eabe087d503426b5c5862aaa9263861ea5 (diff) | |
download | manaplus-c632452430cb3f886da38fa315cb27a3a3a10d2c.tar.gz manaplus-c632452430cb3f886da38fa315cb27a3a3a10d2c.tar.bz2 manaplus-c632452430cb3f886da38fa315cb27a3a3a10d2c.tar.xz manaplus-c632452430cb3f886da38fa315cb27a3a3a10d2c.zip |
Allow get colors from Widget2.
Diffstat (limited to 'src/gui/widgets/widget2.h')
-rw-r--r-- | src/gui/widgets/widget2.h | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 68a45ae30..0bf7ae87a 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -21,12 +21,43 @@ #ifndef GUI_WIDGET2_H #define GUI_WIDGET2_H +#include "gui/theme.h" + class Widget2 { public: - Widget2(); + Widget2() + { + } + + ~Widget2() + { + } + + inline const gcn::Color &getThemeColor(const int type, + const int alpha = 255) + { + return Theme::getThemeColor(type * mPalette, alpha); + } + + inline const gcn::Color &getThemeCharColor(const signed char c, + bool &valid) + { + const int colorId = Theme::getIdByChar(c, valid); + if (valid) + return Theme::getThemeColor(colorId * mPalette); + else + return Palette::BLACK; + } + + void setPalette(int p) + { + if (p >= 1 && p <= THEME_PALETTES) + mPalette = p; + } - ~Widget2(); + private: + int mPalette; }; #endif |