summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-10 17:57:44 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-10 17:57:44 +0300
commiteaf9448af11e82a567a82aafba95f65e984d9942 (patch)
tree8e0d38ab1059024f8f31c4415514a2a70cbd7458 /src/gui
parent717bd9c929c96d4746685b9d4bdf29fa71d937b1 (diff)
downloadmanaverse-eaf9448af11e82a567a82aafba95f65e984d9942.tar.gz
manaverse-eaf9448af11e82a567a82aafba95f65e984d9942.tar.bz2
manaverse-eaf9448af11e82a567a82aafba95f65e984d9942.tar.xz
manaverse-eaf9448af11e82a567a82aafba95f65e984d9942.zip
Improve setup window resize speed.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/setupwindow.cpp14
-rw-r--r--src/gui/windows/setupwindow.h1
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;