diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-10 23:09:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-10 23:59:22 +0300 |
commit | ee39f800bd1809b25cc7c05238e2fa7abccd8ab3 (patch) | |
tree | fce3f585f15a2f6f332130d92d8078b2d0ad0475 /src/gui/widgets | |
parent | dba5ec4c1f249599a5f718fe4e532c66e917ffa9 (diff) | |
download | manaverse-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.tar.gz manaverse-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.tar.bz2 manaverse-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.tar.xz manaverse-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.zip |
Allow load for each window own xml theme file.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/window.cpp | 26 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 2 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 05509ab39..1ffbac31e 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -47,7 +47,7 @@ int Window::instances = 0; int Window::mouseResize = 0; Window::Window(const std::string &caption, bool modal, Window *parent, - const std::string &skin): + std::string skin): gcn::Window(caption), mGrip(0), mParent(parent), @@ -79,8 +79,18 @@ Window::Window(const std::string &caption, bool modal, Window *parent, setPadding(3); setTitleBarHeight(20); + if (skin == "") + skin = "window.xml"; + // Loads the skin - mSkin = Theme::instance()->load(skin); + if (Theme::instance()) + { + mSkin = Theme::instance()->load(skin); + } + else + { + mSkin = 0; + } // Add this window to the window container windowContainer->add(this); @@ -113,8 +123,6 @@ Window::~Window() mWidgets.clear(); -// need mWidgets.clean ? - removeWidgetListener(this); delete mVertexes; mVertexes = 0; @@ -122,7 +130,11 @@ Window::~Window() instances--; if (mSkin) - mSkin->instances--; + { + if (Theme::instance()) + Theme::instance()->unload(mSkin); + mSkin = 0; + } } void Window::setWindowContainer(WindowContainer *wc) @@ -443,7 +455,7 @@ void Window::mousePressed(gcn::MouseEvent &event) const int y = event.getY(); // Handle close button - if (mCloseButton) + if (mCloseButton && mSkin) { Image *img = mSkin->getCloseImage(); if (img) @@ -464,7 +476,7 @@ void Window::mousePressed(gcn::MouseEvent &event) } // Handle sticky button - if (mStickyButton) + if (mStickyButton && mSkin) { Image *button = mSkin->getStickyImage(mSticky); if (button) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index b9f65dceb..510a68323 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -65,7 +65,7 @@ class Window : public gcn::Window, gcn::WidgetListener * @param skin The location where the window's skin XML can be found. */ Window(const std::string &caption = "Window", bool modal = false, - Window *parent = NULL, const std::string &skin = "window.xml"); + Window *parent = NULL, std::string skin = ""); /** * Destructor. Deletes all the added widgets. |