summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-01-31 02:21:58 +0300
committerAndrei Karas <akaras@inbox.ru>2013-01-31 02:21:58 +0300
commit86c823db97e968a98502ecc5757cd1f37acb57b0 (patch)
tree5463084e41a54560998bc88c344efdd28044b8df
parentc293b93a9383e61988f2a4a3c59e4aac798f2325 (diff)
downloadplus-86c823db97e968a98502ecc5757cd1f37acb57b0.tar.gz
plus-86c823db97e968a98502ecc5757cd1f37acb57b0.tar.bz2
plus-86c823db97e968a98502ecc5757cd1f37acb57b0.tar.xz
plus-86c823db97e968a98502ecc5757cd1f37acb57b0.zip
Allow resize setup window buttons and tabs panel.
-rw-r--r--src/gui/setup.cpp20
-rw-r--r--src/gui/setup.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 777bdc752..659571d67 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -83,6 +83,7 @@ Setup::Setup():
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);
add(btn);
@@ -139,6 +140,7 @@ Setup::Setup():
Setup::~Setup()
{
delete_all(mTabs);
+ mButtons.clear();
}
void Setup::action(const gcn::ActionEvent &event)
@@ -213,4 +215,22 @@ void Setup::setVisible(bool visible)
Window::setVisible(visible);
}
+void Setup::widgetResized(const gcn::Event &event)
+{
+ Window::widgetResized(event);
+
+ const gcn::Rectangle area = getChildrenArea();
+ int x = area.width;
+ const int height = area.height;
+ const int width = area.width;
+ const int buttonPadding = getOption("buttonPadding", 5);
+ mPanel->setDimension(gcn::Rectangle(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);
+ }
+}
+
Setup *setupWindow;
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 69ab79970..860bd5a33 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -78,9 +78,12 @@ class Setup final : public Window, public gcn::ActionListener
void setVisible(bool visible) override;
+ void widgetResized(const gcn::Event &event) override;
+
private:
std::list<SetupTab*> mTabs;
std::list<Window*> mWindowsToReset;
+ std::vector<Button*> mButtons;
Button *mResetWindows;
TabbedArea *mPanel;
};