From c632452430cb3f886da38fa315cb27a3a3a10d2c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 19 Oct 2012 20:29:23 +0300 Subject: Allow get colors from Widget2. --- src/gui/widgets/widget2.h | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/widget2.h') 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 -- cgit v1.2.3-70-g09d2