summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/tabbedarea.cpp41
1 files changed, 23 insertions, 18 deletions
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 31bab2599..b1d0ca35e 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -62,8 +62,6 @@ TabbedArea::TabbedArea() :
add(mTabContainer);
add(mWidgetContainer);
-
-
mWidgetContainer->setOpaque(false);
addWidgetListener(this);
@@ -170,7 +168,6 @@ void TabbedArea::addTab(Tab* tab, gcn::Widget* widget)
if (!tab || !widget)
return;
-
tab->setTabbedArea(this);
tab->addActionListener(this);
@@ -183,8 +180,6 @@ void TabbedArea::addTab(Tab* tab, gcn::Widget* widget)
adjustTabPositions();
adjustSize();
-
-
const int frameSize = 2 * getFrameSize();
widget->setSize(getWidth() - frameSize,
getHeight() - frameSize - mTabContainer->getHeight());
@@ -374,25 +369,25 @@ void TabbedArea::widgetResized(const gcn::Event &event A_UNUSED)
if (w)
{
int newScroll = 0;
- ScrollArea* scr = nullptr;
- if (mFollowDownScroll && height != 0)
+ ScrollArea* scr = dynamic_cast<ScrollArea*>(w);
+ if (scr)
{
- const gcn::Rectangle rect = w->getDimension();
- if (rect.height != 0 && rect.height > height + 2)
+ if (mFollowDownScroll && height != 0)
{
- scr = dynamic_cast<ScrollArea*>(w);
- if (scr && scr->getVerticalScrollAmount()
- >= scr->getVerticalMaxScroll() - 2
- && scr->getVerticalScrollAmount()
- <= scr->getVerticalMaxScroll() + 2)
+ const gcn::Rectangle rect = w->getDimension();
+ if (rect.height != 0 && rect.height > height + 2)
{
- newScroll = scr->getVerticalScrollAmount()
- + rect.height - height;
+ if (scr && scr->getVerticalScrollAmount()
+ >= scr->getVerticalMaxScroll() - 2
+ && scr->getVerticalScrollAmount()
+ <= scr->getVerticalMaxScroll() + 2)
+ {
+ newScroll = scr->getVerticalScrollAmount()
+ + rect.height - height;
+ }
}
}
}
- w->setSize(mWidgetContainer->getWidth(),
- mWidgetContainer->getHeight());
if (scr && newScroll)
scr->setVerticalScrollAmount(newScroll);
}
@@ -463,6 +458,16 @@ void TabbedArea::adjustSize()
mWidgetContainer->setPosition(0, maxTabHeight);
mWidgetContainer->setSize(getWidth(), getHeight() - maxTabHeight);
+ gcn::Widget *const w = getCurrentWidget();
+ if (w)
+ {
+ const int wFrameSize = w->getFrameSize();
+ const int frame2 = 2 * wFrameSize;
+
+ w->setPosition(wFrameSize, wFrameSize);
+ w->setSize(mWidgetContainer->getWidth() - frame2,
+ mWidgetContainer->getHeight() - frame2);
+ }
}
void TabbedArea::adjustTabPositions()