diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/popup.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget2.h | 16 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 6 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index cd50bfe1b..9763541a5 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -68,7 +68,7 @@ Popup::Popup(const std::string &name, if (mSkin) { setPadding(mSkin->getPadding()); - // init Widget2 fields + setPalette(mSkin->getOption("palette")); } } else diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 9911d48f6..dd0f0f6fe 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -34,6 +34,7 @@ class Widget2 Widget2(const Widget2 *const widget) : mPalette(widget ? widget->mPalette : 1) { + checkPalette(); } virtual ~Widget2() @@ -61,7 +62,20 @@ class Widget2 mPalette = widget ? widget->mPalette : 1; } - private: + void setPalette(int palette) + { + mPalette = palette; + checkPalette(); + setWidget2(this); + } + + void checkPalette() + { + if (mPalette < 1 || mPalette > THEME_PALETTES) + mPalette = 1; + } + + protected: int mPalette; }; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index fa673e420..ae47cb001 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -98,6 +98,7 @@ Window::Window(const std::string &caption, const bool modal, if (skin == "") skin = "window.xml"; + int childPalette = 1; // Loads the skin if (Theme::instance()) { @@ -122,6 +123,8 @@ Window::Window(const std::string &caption, const bool modal, { mCaptionAlign = gcn::Graphics::LEFT; } + setPalette(getOption("palette")); + childPalette = getOption("childPalette"); } } @@ -140,6 +143,9 @@ Window::Window(const std::string &caption, const bool modal, addWidgetListener(this); mForegroundColor = getThemeColor(Theme::WINDOW); + logger->log("window palettes: %d, %d", mPalette, childPalette); + if (childPalette != mPalette) + setPalette(childPalette); } Window::~Window() |