summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-19 14:59:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-19 14:59:36 +0300
commit876e370925a021bb6731703c3db2db2945f62f85 (patch)
tree25d68c18477669c28ad8927dbb232319f6ec8af0 /src
parent90fa5cb5c60fe06cad9f9c0410ef718d42acb6fc (diff)
downloadplus-876e370925a021bb6731703c3db2db2945f62f85.tar.gz
plus-876e370925a021bb6731703c3db2db2945f62f85.tar.bz2
plus-876e370925a021bb6731703c3db2db2945f62f85.tar.xz
plus-876e370925a021bb6731703c3db2db2945f62f85.zip
Fix tabbed area containers size.
Diffstat (limited to 'src')
-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()