summaryrefslogtreecommitdiff
path: root/src/gui/theme.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-31 18:46:22 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-31 18:46:22 +0300
commit34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354 (patch)
treed8219b2bb206f5d97f4f76599577fdb15d4ac2cc /src/gui/theme.h
parent6683d42b636619e02e2bcf98923a2fdbf44bd95b (diff)
downloadmanaplus-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.tar.gz
manaplus-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.tar.bz2
manaplus-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.tar.xz
manaplus-34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354.zip
Convert ThemeColorId enum into strong typed enum.
Diffstat (limited to 'src/gui/theme.h')
-rw-r--r--src/gui/theme.h15
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.