From 86c823db97e968a98502ecc5757cd1f37acb57b0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 31 Jan 2013 02:21:58 +0300 Subject: Allow resize setup window buttons and tabs panel. --- src/gui/setup.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gui/setup.cpp') 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::iterator, it, mButtons) + { + Button *const btn = *it; + x -= btn->getWidth() + buttonPadding; + btn->setPosition(x, height - btn->getHeight() - buttonPadding); + } +} + Setup *setupWindow; -- cgit v1.2.3-60-g2f50