diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/emotewindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/emotewindow.h | 2 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 5 |
6 files changed, 29 insertions, 5 deletions
diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp index fc76f474b..14652a635 100644 --- a/src/gui/emotewindow.cpp +++ b/src/gui/emotewindow.cpp @@ -48,6 +48,7 @@ EmoteWindow::EmoteWindow() : mScrollColorPage(new ScrollArea(mColorPage, false, "emotepage.xml")) { setShowTitle(false); + setResizable(true); addMouseListener(this); const int pad2 = mPadding * 2; @@ -62,6 +63,7 @@ EmoteWindow::EmoteWindow() : setTitleBarHeight(getPadding() + getTitlePadding()); mScrollColorPage->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); + mScrollColorPage->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); // TRANSLATORS: emotes tab name mTabs->addTab(_("Emotes"), mEmotePage); // TRANSLATORS: emotes tab name @@ -138,3 +140,17 @@ void EmoteWindow::addListeners(gcn::ActionListener *const listener) mEmotePage->addActionListener(listener); mColorPage->addActionListener(listener); } + +void EmoteWindow::widgetResized(const gcn::Event &event) +{ + Window::widgetResized(event); + const int pad2 = mPadding * 2; + const int width = mDimension.width; + const int height = mDimension.height; + + mTabs->setSize(width - pad2, height - pad2); + mTabs->adjustWidget(mEmotePage); + mTabs->adjustWidget(mScrollColorPage); + mColorPage->setSize(mScrollColorPage->getWidth(), + mScrollColorPage->getHeight()); +} diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h index 140ed4c36..fd9969630 100644 --- a/src/gui/emotewindow.h +++ b/src/gui/emotewindow.h @@ -54,6 +54,8 @@ class EmoteWindow final : public Window void addListeners(gcn::ActionListener *const listener); + void widgetResized(const gcn::Event &event) override; + private: TabbedArea *mTabs; EmotePage *mEmotePage; diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 0653a5e0d..c30717f7b 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -620,7 +620,7 @@ void SkillDialog::widgetResized(const gcn::Event &event) Window::widgetResized(event); if (mTabs) - mTabs->fixSize(); + mTabs->adjustSize(); } void SkillDialog::useItem(const int itemId) const diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index b4398b29e..edbd5a0d3 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1706,7 +1706,7 @@ void SocialWindow::widgetResized(const gcn::Event &event) { Window::widgetResized(event); if (mTabs) - mTabs->fixSize(); + mTabs->adjustSize(); } #ifdef USE_PROFILER diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 25fc3b8f2..88d12764a 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -196,6 +196,13 @@ void TabbedArea::addTab(Tab *const tab, gcn::Widget *const widget) updateArrowEnableState(); } +void TabbedArea::adjustWidget(gcn::Widget *const widget) const +{ + const int frameSize = 2 * mFrameSize; + widget->setSize(getWidth() - frameSize, + getHeight() - frameSize - mTabContainer->getHeight()); +} + void TabbedArea::addTab(const std::string &caption, gcn::Widget *const widget) { Tab *const tab = new Tab(this); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 7be1391a5..ca2857709 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -164,9 +164,6 @@ class TabbedArea final : public Widget2, bool getFollowDownScroll() const A_WARN_UNUSED { return mFollowDownScroll; } - void fixSize() - { adjustSize(); } - void keyPressed(gcn::KeyEvent& keyEvent) override; void setBlockSwitching(const bool b) @@ -185,6 +182,8 @@ class TabbedArea final : public Widget2, void setResizeHeight(bool b) { mResizeHeight = b; } + void adjustWidget(gcn::Widget *const widget) const; + private: typedef std::vector <std::pair<Tab*, gcn::Widget*> > TabContainer; |