diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-03-04 22:41:19 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-03-12 14:49:27 -0700 |
commit | 781b3c9f17708cc5fe08eb3c9ee38d596364d97c (patch) | |
tree | 833797c9b9168ab58864ffe4cf8ed028060e44a2 /src/gui/theme.h | |
parent | 96b64757954f07d196599b3c1131a6603982c930 (diff) | |
download | mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.tar.gz mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.tar.bz2 mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.tar.xz mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.zip |
Split Palette into Theme and UserPalette
Themes can now control the colors they use. Colors in the Viewport (being
names, particles, etc) can still be changed by the user. Also make
ProgressBars more easily colored. DyePalette was made more flexible in the
process.
Also fixes comparing strings of different lengths insensitively.
Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src/gui/theme.h')
-rw-r--r-- | src/gui/theme.h | 89 |
1 files changed, 83 insertions, 6 deletions
diff --git a/src/gui/theme.h b/src/gui/theme.h index abc2612f..4dd63660 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -27,11 +27,15 @@ #include "configlistener.h" #include "graphics.h" +#include "gui/palette.h" + #include <map> #include <string> +class DyePalette; class Image; class ImageSet; +class ProgressBar; class Skin { @@ -96,7 +100,7 @@ class Skin Image *mStickyImageDown; /**< Sticky Button Image */ }; -class Theme : public ConfigListener +class Theme : public Palette, public ConfigListener { public: static Theme *instance(); @@ -115,6 +119,79 @@ class Theme : public ConfigListener static ImageSet *getImageSetFromTheme(const std::string &path, int w, int h); + enum ThemePalette { + TEXT, + SHADOW, + OUTLINE, + PROGRESS_BAR, + BUTTON, + BUTTON_DISABLED, + TAB, + BACKGROUND, + HIGHLIGHT, + TAB_FLASH, + SHOP_WARNING, + ITEM_EQUIPPED, + CHAT, + GM, + PLAYER, + WHISPER, + IS, + PARTY, + GUILD, + SERVER, + LOGGER, + HYPERLINK, + UNKNOWN_ITEM, + GENERIC, + HEAD, + USABLE, + TORSO, + ONEHAND, + LEGS, + FEET, + TWOHAND, + SHIELD, + RING, + NECKLACE, + ARMS, + AMMO, + THEME_COLORS_END + }; + + enum ProgressPalette { + PROG_DEFAULT, + PROG_HP, + PROG_MP, + PROG_NO_MP, + PROG_EXP, + PROG_INVY_SLOTS, + PROG_WEIGHT, + PROG_JOB, + THEME_PROG_END + }; + + /** + * Gets the color associated with the type. Sets the alpha channel + * before returning. + * + * @param type the color type requested + * @param alpha alpha channel to use + * + * @return the requested color + */ + inline static const gcn::Color &getThemeColor(int type, int alpha = 255) + { + return mInstance->getColor(type, alpha); + } + + const static gcn::Color &getThemeColor(char c, bool &valid) + { + return mInstance->getColor(c, valid); + } + + static gcn::Color getProgressColor(int type, float progress); + /** * Loads a skin. */ @@ -152,21 +229,21 @@ class Theme : public ConfigListener Skins mSkins; - /** - * The config listener that listens to changes relevant to all skins. - */ - ConfigListener *mSkinConfigListener; - static std::string mThemePath; static Theme *mInstance; static bool tryThemePath(std::string themePath); + void loadColors(std::string file = ""); + /** * Tells if the current skins opacity * should not get less than the given value */ float mMinimumOpacity; + + typedef std::vector<DyePalette*> ProgressColors; + ProgressColors mProgressColors; }; #endif |