summaryrefslogtreecommitdiff
path: root/src/gui/widgets/window.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-10 23:09:21 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-10 23:59:22 +0300
commitee39f800bd1809b25cc7c05238e2fa7abccd8ab3 (patch)
treefce3f585f15a2f6f332130d92d8078b2d0ad0475 /src/gui/widgets/window.cpp
parentdba5ec4c1f249599a5f718fe4e532c66e917ffa9 (diff)
downloadmv-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.tar.gz
mv-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.tar.bz2
mv-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.tar.xz
mv-ee39f800bd1809b25cc7c05238e2fa7abccd8ab3.zip
Allow load for each window own xml theme file.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r--src/gui/widgets/window.cpp26
1 files changed, 19 insertions, 7 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)