From 34cb5e4b16c1b1f5d3263dd01848b24ab0b9b354 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 May 2015 18:46:22 +0300 Subject: Convert ThemeColorId enum into strong typed enum. --- src/gui/theme.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/gui/theme.h') 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(mColors.size()) || type < 0) + if (static_cast(type) >= mColors.size()) { logger->log("incorrect color request type: %d from %u", - type, static_cast(mColors.size())); - type = 0; + static_cast(type), + static_cast(mColors.size())); + type = ThemeColorIdT::BROWSERBOX; } - Color* col = &mColors[type].color; + Color* col = &mColors[static_cast(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. -- cgit v1.2.3-60-g2f50