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/theme.h | |
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/theme.h')
-rw-r--r-- | src/gui/theme.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/gui/theme.h b/src/gui/theme.h index 5a9a75bb0..2b6e45812 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -26,6 +26,7 @@ #define GUI_THEME_H #include "enums/gui/progresscolorid.h" +#include "enums/gui/themecolorid.h" #include "listeners/configlistener.h" @@ -133,21 +134,23 @@ class Theme final : public Palette, * * @return the requested color */ - inline const Color &getColor(int type, + inline const Color &getColor(ThemeColorIdT type, const int alpha = 255) A_WARN_UNUSED { - if (type >= static_cast<signed>(mColors.size()) || type < 0) + if (static_cast<size_t>(type) >= mColors.size()) { logger->log("incorrect color request type: %d from %u", - type, static_cast<unsigned int>(mColors.size())); - type = 0; + static_cast<int>(type), + static_cast<unsigned int>(mColors.size())); + type = ThemeColorIdT::BROWSERBOX; } - Color* col = &mColors[type].color; + Color* col = &mColors[static_cast<size_t>(type)].color; col->a = alpha; return *col; } - int getIdByChar(const signed char c, bool &valid) const A_WARN_UNUSED; + ThemeColorIdT getIdByChar(const signed char c, + bool &valid) const A_WARN_UNUSED; /** * Set the minimum opacity allowed to skins. |