diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/progressbar.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 71 |
2 files changed, 52 insertions, 26 deletions
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 33e27a0d9..dc1e02ac5 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -71,8 +71,11 @@ ProgressBar::ProgressBar(const Widget2 *const widget, float progress, if (theme) { mSkin = theme->load("progressbar.xml", ""); - setPadding(mSkin->getPadding()); - mFillPadding = mSkin->getOption("fillPadding"); + if (mSkin) + { + setPadding(mSkin->getPadding()); + mFillPadding = mSkin->getOption("fillPadding"); + } setHeight(2 * mPadding + getFont()->getHeight() + 2); } 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; } |