diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-10 17:57:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-10 17:57:44 +0300 |
commit | eaf9448af11e82a567a82aafba95f65e984d9942 (patch) | |
tree | 8e0d38ab1059024f8f31c4415514a2a70cbd7458 | |
parent | 717bd9c929c96d4746685b9d4bdf29fa71d937b1 (diff) | |
download | manaplus-eaf9448af11e82a567a82aafba95f65e984d9942.tar.gz manaplus-eaf9448af11e82a567a82aafba95f65e984d9942.tar.bz2 manaplus-eaf9448af11e82a567a82aafba95f65e984d9942.tar.xz manaplus-eaf9448af11e82a567a82aafba95f65e984d9942.zip |
Improve setup window resize speed.
-rw-r--r-- | src/gui/windows/setupwindow.cpp | 14 | ||||
-rw-r--r-- | src/gui/windows/setupwindow.h | 1 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp index 95b4c50cd..be76b478f 100644 --- a/src/gui/windows/setupwindow.cpp +++ b/src/gui/windows/setupwindow.cpp @@ -68,7 +68,8 @@ SetupWindow::SetupWindow() : mQuickTab(nullptr), mResetWindows(nullptr), mPanel(new TabbedArea(this)), - mVersion(new Label(this, FULL_VERSION)) + mVersion(new Label(this, FULL_VERSION)), + mButtonPadding(5) { mPanel->postInit(); setCloseButton(true); @@ -101,13 +102,13 @@ void SetupWindow::postInit() nullptr }; int x = width; - const int buttonPadding = getOption("buttonPadding", 5); + mButtonPadding = getOption("buttonPadding", 5); for (const char ** curBtn = buttonNames; *curBtn; ++ curBtn) { Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); mButtons.push_back(btn); - x -= btn->getWidth() + buttonPadding; - btn->setPosition(x, height - btn->getHeight() - buttonPadding); + x -= btn->getWidth() + mButtonPadding; + btn->setPosition(x, height - btn->getHeight() - mButtonPadding); add(btn); // Store this button, as it needs to be enabled/disabled @@ -303,13 +304,12 @@ void SetupWindow::widgetResized(const Event &event) int x = area.width; const int height = area.height; const int width = area.width; - const int buttonPadding = getOption("buttonPadding", 5); mPanel->setDimension(Rect(5, 5, width - 10, height - 40)); FOR_EACH (std::vector<Button*>::iterator, it, mButtons) { Button *const btn = *it; - x -= btn->getWidth() + buttonPadding; - btn->setPosition(x, height - btn->getHeight() - buttonPadding); + x -= btn->getWidth() + mButtonPadding; + btn->setPosition(x, height - btn->getHeight() - mButtonPadding); } if (mResetWindows) { diff --git a/src/gui/windows/setupwindow.h b/src/gui/windows/setupwindow.h index adf0cca43..a21341cec 100644 --- a/src/gui/windows/setupwindow.h +++ b/src/gui/windows/setupwindow.h @@ -88,6 +88,7 @@ class SetupWindow final : public Window, Button *mResetWindows; TabbedArea *mPanel; Label *mVersion; + int mButtonPadding; }; extern SetupWindow* setupWindow; |