summaryrefslogtreecommitdiff
path: root/src/gui/widgets/window.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-08-28 15:18:58 +0300
committerAndrei Karas <akaras@inbox.ru>2013-08-29 00:18:56 +0300
commitafbf2f713dd918bd0ff050d71afbf05bc581ab6e (patch)
tree6a06804aa813ed184b1293ab458929d372285385 /src/gui/widgets/window.cpp
parent482cbfc4e1299434a6f632fe7f4b4e3704e65e87 (diff)
downloadplus-afbf2f713dd918bd0ff050d71afbf05bc581ab6e.tar.gz
plus-afbf2f713dd918bd0ff050d71afbf05bc581ab6e.tar.bz2
plus-afbf2f713dd918bd0ff050d71afbf05bc581ab6e.tar.xz
plus-afbf2f713dd918bd0ff050d71afbf05bc581ab6e.zip
fix some missing checks.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r--src/gui/widgets/window.cpp71
1 files changed, 47 insertions, 24 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 38fd315fb..fccf8bbcd 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -458,8 +458,17 @@ void Window::setResizable(const bool r)
if (r)
{
mGrip = Theme::getImageFromThemeXml("resize.xml", "");
- mGripRect.x = mDimension.width - mGrip->getWidth() - mGripPadding;
- mGripRect.y = mDimension.height - mGrip->getHeight() - mGripPadding;
+ if (mGrip)
+ {
+ mGripRect.x = mDimension.width - mGrip->getWidth() - mGripPadding;
+ mGripRect.y = mDimension.height - mGrip->getHeight()
+ - mGripPadding;
+ }
+ else
+ {
+ mGripRect.x = 0;
+ mGripRect.y = 0;
+ }
}
else
{
@@ -483,35 +492,49 @@ void Window::widgetResized(const gcn::Event &event A_UNUSED)
int h = area.height;
mLayout->reflow(w, h);
}
- const bool showClose = mCloseButton && mSkin->getCloseImage(false);
- const int closePadding = getOption("closePadding");
- if (showClose)
- {
- const Image *const button = mSkin->getCloseImage(false);
- const int buttonWidth = button->getWidth();
- mCloseRect.x = mDimension.width - buttonWidth - closePadding;
- mCloseRect.y = closePadding;
- mCloseRect.width = buttonWidth;
- mCloseRect.height = button->getHeight();
- }
- if (mStickyButton)
+ if (mSkin)
{
- const Image *const button = mSkin->getStickyImage(mSticky);
- if (button)
+ const bool showClose = mCloseButton && mSkin->getCloseImage(false);
+ const int closePadding = getOption("closePadding");
+ if (showClose)
{
+ const Image *const button = mSkin->getCloseImage(false);
const int buttonWidth = button->getWidth();
- int x = mDimension.width - buttonWidth
- - getOption("stickySpacing") - closePadding;
+ mCloseRect.x = mDimension.width - buttonWidth - closePadding;
+ mCloseRect.y = closePadding;
+ mCloseRect.width = buttonWidth;
+ mCloseRect.height = button->getHeight();
+ }
+ if (mStickyButton)
+ {
+ const Image *const button = mSkin->getStickyImage(mSticky);
+ if (button)
+ {
+ const int buttonWidth = button->getWidth();
+ int x = mDimension.width - buttonWidth
+ - getOption("stickySpacing") - closePadding;
- if (showClose)
- x -= mSkin->getCloseImage(false)->getWidth();
+ if (showClose)
+ x -= mSkin->getCloseImage(false)->getWidth();
- mStickyRect.x = x;
- mStickyRect.y = getOption("stickyPadding");
- mStickyRect.width = buttonWidth;
- mStickyRect.height = button->getHeight();
+ mStickyRect.x = x;
+ mStickyRect.y = getOption("stickyPadding");
+ mStickyRect.width = buttonWidth;
+ mStickyRect.height = button->getHeight();
+ }
}
}
+ else
+ {
+ mCloseRect.x = 0;
+ mCloseRect.y = 0;
+ mCloseRect.width = 0;
+ mCloseRect.height = 0;
+ mStickyRect.x = 0;
+ mStickyRect.y = 0;
+ mStickyRect.width = 0;
+ mStickyRect.height = 0;
+ }
mRedraw = true;
}