summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabbedarea.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-08 04:44:27 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-08 04:44:27 +0300
commita54c5dfccb56dc8996f5c7b2a2299a2cb2257f08 (patch)
treed37693f68ca33da31d01bdf84f75d686acd99a64 /src/gui/widgets/tabbedarea.cpp
parentbe881476350ab5f4202e687ad4161099870fe5a4 (diff)
downloadmanaplus-a54c5dfccb56dc8996f5c7b2a2299a2cb2257f08.tar.gz
manaplus-a54c5dfccb56dc8996f5c7b2a2299a2cb2257f08.tar.bz2
manaplus-a54c5dfccb56dc8996f5c7b2a2299a2cb2257f08.tar.xz
manaplus-a54c5dfccb56dc8996f5c7b2a2299a2cb2257f08.zip
Add ability to tabbedarea follow vertical scrroll bar position with max value.
Diffstat (limited to 'src/gui/widgets/tabbedarea.cpp')
-rw-r--r--src/gui/widgets/tabbedarea.cpp35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 6b90cb381..bd43e4dc7 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -22,18 +22,21 @@
#include "gui/widgets/tabbedarea.h"
+#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tab.h"
#include "log.h"
#include <guichan/widgets/container.hpp>
-TabbedArea::TabbedArea() : gcn::TabbedArea(),
- mTabsWidth(0),
- mVisibleTabsWidth(0),
- mTabScrollIndex(0),
- mEnableScrollButtons(false),
- mRightMargin(0)
+TabbedArea::TabbedArea()
+ : gcn::TabbedArea(),
+ mTabsWidth(0),
+ mVisibleTabsWidth(0),
+ mTabScrollIndex(0),
+ mEnableScrollButtons(false),
+ mRightMargin(0),
+ mFollowDownScroll(false)
{
mWidgetContainer->setOpaque(false);
addWidgetListener(this);
@@ -246,7 +249,27 @@ void TabbedArea::widgetResized(const gcn::Event &event _UNUSED_)
gcn::Widget *w = getCurrentWidget();
if (w)
+ {
+ int newScroll = 0;
+ ScrollArea* scr = 0;
+ if (mFollowDownScroll && height != 0)
+ {
+ gcn::Rectangle rect = w->getDimension();
+ if (rect.height != 0 && rect.height > height)
+ {
+ scr = dynamic_cast<ScrollArea*>(w);
+ if (scr && scr->getVerticalScrollAmount()
+ == scr->getVerticalMaxScroll())
+ {
+ newScroll = scr->getVerticalScrollAmount()
+ + rect.height - height;
+ }
+ }
+ }
w->setSize(width, height);
+ if (scr && newScroll)
+ scr->setVerticalScrollAmount(newScroll);
+ }
if (mArrowButton[1])
{