diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-16 22:32:39 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-04-16 22:53:10 +0200 |
commit | 18cba14c0f80f6ae7db883ce4d6abbf24728f07d (patch) | |
tree | fe67a7d059647d23d7285f90fb5b8aca076311de /src/gui/widgets/tabbedarea.cpp | |
parent | 255c491375005abb1d2de22fa5aa1a821ac3a4f6 (diff) | |
download | mana-18cba14c0f80f6ae7db883ce4d6abbf24728f07d.tar.gz mana-18cba14c0f80f6ae7db883ce4d6abbf24728f07d.tar.bz2 mana-18cba14c0f80f6ae7db883ce4d6abbf24728f07d.tar.xz mana-18cba14c0f80f6ae7db883ce4d6abbf24728f07d.zip |
Some more cleanups
Nothing in particular worth mentioning.
Diffstat (limited to 'src/gui/widgets/tabbedarea.cpp')
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 86730c51..07f46a94 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -29,14 +29,14 @@ TabbedArea::TabbedArea() : gcn::TabbedArea() mWidgetContainer->setOpaque(false); } -int TabbedArea::getNumberOfTabs() +int TabbedArea::getNumberOfTabs() const { return mTabs.size(); } -Tab* TabbedArea::getTab(const std::string &name) +Tab *TabbedArea::getTab(const std::string &name) const { - TabContainer::iterator itr = mTabs.begin(), itr_end = mTabs.end(); + TabContainer::const_iterator itr = mTabs.begin(), itr_end = mTabs.end(); while (itr != itr_end) { if ((*itr).first->getCaption() == name) @@ -55,9 +55,9 @@ void TabbedArea::draw(gcn::Graphics *graphics) drawChildren(graphics); } -gcn::Widget* TabbedArea::getWidget(const std::string &name) +gcn::Widget *TabbedArea::getWidget(const std::string &name) const { - TabContainer::iterator itr = mTabs.begin(), itr_end = mTabs.end(); + TabContainer::const_iterator itr = mTabs.begin(), itr_end = mTabs.end(); while (itr != itr_end) { if ((*itr).first->getCaption() == name) @@ -71,28 +71,13 @@ gcn::Widget* TabbedArea::getWidget(const std::string &name) void TabbedArea::addTab(const std::string &caption, gcn::Widget *widget) { - Tab* tab = new Tab; + Tab *tab = new Tab; tab->setCaption(caption); mTabsToDelete.push_back(tab); addTab(tab, widget); } -void TabbedArea::addTab(Tab *tab, gcn::Widget *widget) -{ - tab->setTabbedArea(this); - tab->addActionListener(this); - - mTabContainer->add(tab); - mTabs.push_back(std::pair<Tab*, gcn::Widget*>(tab, widget)); - - if (!mSelectedTab) - setSelectedTab(tab); - - adjustTabPositions(); - adjustSize(); -} - void TabbedArea::removeTab(Tab *tab) { int tabIndexToBeSelected = -1; @@ -146,8 +131,8 @@ void TabbedArea::removeTab(Tab *tab) void TabbedArea::logic() { logicChildren(); - } + void TabbedArea::setSelectedTab(gcn::Tab *tab) { gcn::TabbedArea::setSelectedTab(tab); |