diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-31 18:46:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-31 18:46:22 +0300 |
commit | 34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354 (patch) | |
tree | d8219b2bb206f5d97f4f76599577fdb15d4ac2cc /src/gui/widgets | |
parent | 6683d42b636619e02e2bcf98923a2fdbf44bd95b (diff) | |
download | manaverse-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.tar.gz manaverse-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.tar.bz2 manaverse-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.tar.xz manaverse-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.zip |
Convert ThemeColorId enum into strong typed enum.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/widget2.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 9fad6a882..5955397fc 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -21,7 +21,7 @@ #ifndef GUI_WIDGETS_WIDGET2_H #define GUI_WIDGETS_WIDGET2_H -#include "enums/gui/themecolorid.h" +#include "gui/themecolorsidoperators.h" #include "gui/theme.h" @@ -34,11 +34,11 @@ class Widget2 notfinal { } - inline const Color &getThemeColor(const int type, + inline const Color &getThemeColor(const ThemeColorIdT type, const int alpha = 255) const A_WARN_UNUSED { - return theme->getColor(mPaletteOffset + type, alpha); + return theme->getColor(type + mPaletteOffset, alpha); } inline const Color &getThemeCharColor(const signed char c, @@ -47,9 +47,9 @@ class Widget2 notfinal { if (!theme) return Palette::BLACK; - const int colorId = theme->getIdByChar(c, valid); + const ThemeColorIdT colorId = theme->getIdByChar(c, valid); if (valid) - return theme->getColor(mPaletteOffset + colorId, 255); + return theme->getColor(colorId + mPaletteOffset, 255); else return Palette::BLACK; } @@ -61,15 +61,17 @@ class Widget2 notfinal void setPalette(int palette) { - mPaletteOffset = palette * ThemeColorId::THEME_COLORS_END; + mPaletteOffset = palette * static_cast<int>( + ThemeColorId::THEME_COLORS_END); checkPalette(); setWidget2(this); } void checkPalette() { - if (mPaletteOffset < 0 || mPaletteOffset - >= THEME_PALETTES * ThemeColorId::THEME_COLORS_END) + if (mPaletteOffset < 0 || + mPaletteOffset >= THEME_PALETTES * static_cast<int>( + ThemeColorId::THEME_COLORS_END)) { mPaletteOffset = 0; } |