From b20931ca66c1c760bfe21a5a6c070c54ae3eb2a0 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 23 Aug 2009 12:13:25 -0600 Subject: Fix some layout issues with TabbedAreas --- src/gui/widgets/tabbedarea.cpp | 14 +++++++++++--- src/gui/widgets/tabbedarea.h | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 13bb884b..dd2e62dd 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -28,6 +28,8 @@ TabbedArea::TabbedArea() : gcn::TabbedArea() { mWidgetContainer->setOpaque(false); addWidgetListener(this); + + widgetResized(NULL); } int TabbedArea::getNumberOfTabs() const @@ -161,14 +163,20 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab) if (newTab) newTab->setCurrent(); + + widgetResized(NULL); } void TabbedArea::widgetResized(const gcn::Event &event) { - int width = getWidth() - 2 * getFrameSize(); - int height = getHeight() - 2 * getFrameSize() - mTabContainer->getHeight(); + int width = getWidth() - 2 * getFrameSize() + - 2 * mWidgetContainer->getFrameSize(); + int height = getHeight() - 2 * getFrameSize() - mWidgetContainer->getY() + - 2 * mWidgetContainer->getFrameSize(); mWidgetContainer->setSize(width, height); + gcn::Widget *w = getCurrentWidget(); if (w) - w->setSize(width, height); + w->setSize(width, + height); } diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index a64d855f..7944b5d5 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -101,8 +101,7 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener int getContainerHeight() const { return mWidgetContainer->getHeight(); } - void setSelectedTab(unsigned int index) - { gcn::TabbedArea::setSelectedTab(index); } + using gcn::TabbedArea::setSelectedTab; void setSelectedTab(gcn::Tab *tab); -- cgit v1.2.3-70-g09d2