From 51126f28cb4b258ba9711fa294652ed87f2451b8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Feb 2013 01:04:24 +0300 Subject: Fix some resize issues in setup window. --- src/gui/setup.cpp | 25 +++++++++++++++++-------- src/gui/setup.h | 2 ++ src/gui/widgets/setuptab.cpp | 3 +++ src/gui/widgets/setuptab.h | 5 ++++- src/gui/widgets/setuptabscroll.cpp | 6 ++++++ src/gui/widgets/setuptabscroll.h | 2 ++ 6 files changed, 34 insertions(+), 9 deletions(-) (limited to 'src/gui') diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 659571d67..8961c2d56 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -55,7 +55,8 @@ Setup::Setup(): Window(_("Setup"), false, nullptr, "setup.xml"), gcn::ActionListener(), mResetWindows(nullptr), - mPanel(new TabbedArea(this)) + mPanel(new TabbedArea(this)), + mVersion(new Label(this, FULL_VERSION)) { setCloseButton(true); setResizable(true); @@ -68,7 +69,8 @@ Setup::Setup(): width += 100; setContentSize(width, height); - //setMaxHeight(height); + setMinWidth(310); + setMinHeight(210); static const char *buttonNames[] = { @@ -118,18 +120,16 @@ Setup::Setup(): add(mPanel); - Label *const version = new Label(this, FULL_VERSION); -// version->setPosition(9, height - version->getHeight() - 9); if (mResetWindows) { - version->setPosition(9, - height - version->getHeight() - mResetWindows->getHeight() - 9); + mVersion->setPosition(9, + height - mVersion->getHeight() - mResetWindows->getHeight() - 9); } else { - version->setPosition(9, height - version->getHeight() - 30); + mVersion->setPosition(9, height - mVersion->getHeight() - 30); } - add(version); + add(mVersion); center(); @@ -231,6 +231,15 @@ void Setup::widgetResized(const gcn::Event &event) x -= btn->getWidth() + buttonPadding; btn->setPosition(x, height - btn->getHeight() - buttonPadding); } + if (mResetWindows) + { + mVersion->setPosition(9, + height - mVersion->getHeight() - mResetWindows->getHeight() - 9); + } + else + { + mVersion->setPosition(9, height - mVersion->getHeight() - 30); + } } Setup *setupWindow; diff --git a/src/gui/setup.h b/src/gui/setup.h index 860bd5a33..81d3ff256 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -31,6 +31,7 @@ #include +class Label; class SetupTab; /** @@ -86,6 +87,7 @@ class Setup final : public Window, public gcn::ActionListener std::vector mButtons; Button *mResetWindows; TabbedArea *mPanel; + Label *mVersion; }; extern Setup* setupWindow; diff --git a/src/gui/widgets/setuptab.cpp b/src/gui/widgets/setuptab.cpp index 690b09f49..227b74d98 100644 --- a/src/gui/widgets/setuptab.cpp +++ b/src/gui/widgets/setuptab.cpp @@ -22,6 +22,8 @@ #include "gui/widgets/setuptab.h" +#include "logger.h" + #include "debug.h" SetupTab::SetupTab(const Widget2 *const widget) : @@ -29,6 +31,7 @@ SetupTab::SetupTab(const Widget2 *const widget) : gcn::ActionListener() { setOpaque(false); + addWidgetListener(this); } void SetupTab::externalUpdated() diff --git a/src/gui/widgets/setuptab.h b/src/gui/widgets/setuptab.h index 8ffab10d1..7d0c45d17 100644 --- a/src/gui/widgets/setuptab.h +++ b/src/gui/widgets/setuptab.h @@ -26,6 +26,7 @@ #include "gui/widgets/container.h" #include +#include #include @@ -34,7 +35,9 @@ /** * A container for the contents of a tab in the setup window. */ -class SetupTab : public Container, public gcn::ActionListener +class SetupTab : public Container, + public gcn::ActionListener, + public gcn::WidgetListener { public: SetupTab(const Widget2 *const widget); diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp index aac5cf0e8..64060aaad 100644 --- a/src/gui/widgets/setuptabscroll.cpp +++ b/src/gui/widgets/setuptabscroll.cpp @@ -118,3 +118,9 @@ void SetupTabScroll::externalUpdated() widget->externalUpdated((*iter).first); } } + +void SetupTabScroll::widgetResized(const gcn::Event &event) +{ + mScroll->setWidth(getWidth() - 12); + mScroll->setHeight(getHeight() - 12 - 12); +} diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h index 70ac756cb..e90ce28c2 100644 --- a/src/gui/widgets/setuptabscroll.h +++ b/src/gui/widgets/setuptabscroll.h @@ -60,6 +60,8 @@ class SetupTabScroll : public SetupTab int getPreferredFirstItemSize() A_WARN_UNUSED { return mPreferredFirstItemSize; } + void widgetResized(const gcn::Event &event) override; + protected: VertContainer *mContainer; ScrollArea *mScroll; -- cgit v1.2.3-70-g09d2