diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-10 17:54:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-10 17:54:00 +0300 |
commit | 717bd9c929c96d4746685b9d4bdf29fa71d937b1 (patch) | |
tree | 8591b08fa47d83b0c218642e01a6274181b73e97 | |
parent | ad46c2e661ec79ff01de0f80955a8446b8c883c7 (diff) | |
download | manaplus-717bd9c929c96d4746685b9d4bdf29fa71d937b1.tar.gz manaplus-717bd9c929c96d4746685b9d4bdf29fa71d937b1.tar.bz2 manaplus-717bd9c929c96d4746685b9d4bdf29fa71d937b1.tar.xz manaplus-717bd9c929c96d4746685b9d4bdf29fa71d937b1.zip |
Improve window resize speed.
-rw-r--r-- | src/gui/widgets/window.cpp | 15 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 3 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index c438b5475..cd526db98 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -138,6 +138,9 @@ Window::Window(const std::string &caption, mGripPadding(2), mResizeHandles(-1), mOldResizeHandles(-1), + mClosePadding(0), + mStickySpacing(0), + mStickyPadding(0), mCaptionFont(getFont()), mModal(modal), mShowTitle(true), @@ -196,6 +199,9 @@ Window::Window(const std::string &caption, setPalette(getOption("palette")); childPalette = getOption("childPalette"); mShowTitle = getOptionBool("showTitle", true); + mClosePadding = getOption("closePadding"); + mStickySpacing = getOption("stickySpacing"); + mStickyPadding = getOption("stickyPadding"); } } @@ -570,13 +576,12 @@ void Window::widgetResized(const Event &event A_UNUSED) { const bool showClose = mCloseWindowButton && 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.x = mDimension.width - buttonWidth - mClosePadding; + mCloseRect.y = mClosePadding; mCloseRect.width = buttonWidth; mCloseRect.height = button->getHeight(); } @@ -587,13 +592,13 @@ void Window::widgetResized(const Event &event A_UNUSED) { const int buttonWidth = button->getWidth(); int x = mDimension.width - buttonWidth - - getOption("stickySpacing") - closePadding; + - mStickySpacing - mClosePadding; if (showClose) x -= mSkin->getCloseImage(false)->getWidth(); mStickyRect.x = x; - mStickyRect.y = getOption("stickyPadding"); + mStickyRect.y = mStickyPadding; mStickyRect.width = buttonWidth; mStickyRect.height = button->getHeight(); } diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 2b2bdb261..386b7e16b 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -692,6 +692,9 @@ class Window notfinal : public BasicContainer2, int mGripPadding; int mResizeHandles; int mOldResizeHandles; + int mClosePadding; + int mStickySpacing; + int mStickyPadding; Font *mCaptionFont; Modal mModal; /**< Window is modal */ bool mShowTitle; /**< Window has a title bar */ |