diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-13 22:07:29 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-15 15:06:47 -0700 |
commit | 731dcee8bec7e32d576b0e6a9d98b9a21050362e (patch) | |
tree | b2e289fbe90553f44d289565d46065fa5c41d6f0 /src/gui | |
parent | 10a9dbacd9334caede10f1b21d42cdf7e1efcd03 (diff) | |
download | mana-731dcee8bec7e32d576b0e6a9d98b9a21050362e.tar.gz mana-731dcee8bec7e32d576b0e6a9d98b9a21050362e.tar.bz2 mana-731dcee8bec7e32d576b0e6a9d98b9a21050362e.tar.xz mana-731dcee8bec7e32d576b0e6a9d98b9a21050362e.zip |
Merged Tab and TabbedArea from mainline
Changes mostly done by David Athay.
Currently these widgets are only used in the setup window, where they
replace the previously used TabbedContainer.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/setup.cpp | 22 | ||||
-rw-r--r-- | src/gui/setup.h | 2 | ||||
-rw-r--r-- | src/gui/setup_audio.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_colours.cpp | 3 | ||||
-rw-r--r-- | src/gui/setup_joystick.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_keyboard.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_players.cpp | 1 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 1 | ||||
-rw-r--r-- | src/gui/tabbedcontainer.cpp | 127 | ||||
-rw-r--r-- | src/gui/tabbedcontainer.h | 74 | ||||
-rw-r--r-- | src/gui/widgets/tab.cpp | 130 | ||||
-rw-r--r-- | src/gui/widgets/tab.h | 60 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 160 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 92 |
14 files changed, 463 insertions, 213 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 551fe5bb..bd5a25f9 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -30,7 +30,8 @@ #include "setup_keyboard.h" #include "setup_players.h" #include "setup_video.h" -#include "tabbedcontainer.h" + +#include "widgets/tabbedarea.h" #include "../utils/dtor.h" #include "../utils/gettext.h" @@ -48,7 +49,7 @@ extern Window *emoteWindow; extern Window *tradeWindow; Setup::Setup(): - Window("Setup") + Window(_("Setup")) { setCloseButton(true); int width = 310; @@ -71,34 +72,33 @@ Setup::Setup(): btn->setEnabled(statusWindow != NULL); } - TabbedContainer *panel = new TabbedContainer(width, 5, 20, 45, 5, 3); - panel->setDimension(gcn::Rectangle(5, 5, width, height - 40)); - panel->setOpaque(false); + TabbedArea *panel = new TabbedArea(); + panel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); SetupTab *tab; tab = new Setup_Video(); - panel->addTab(tab, _("Video")); + panel->addTab(_("Video"), tab); mTabs.push_back(tab); tab = new Setup_Audio(); - panel->addTab(tab, _("Audio")); + panel->addTab(_("Audio"), tab); mTabs.push_back(tab); tab = new Setup_Joystick(); - panel->addTab(tab, _("Joystick")); + panel->addTab(_("Joystick"), tab); mTabs.push_back(tab); tab = new Setup_Keyboard(); - panel->addTab(tab, _("Keyboard")); + panel->addTab(_("Keyboard"), tab); mTabs.push_back(tab); tab = new Setup_Colours(); - panel->addTab(tab, _("Colors")); + panel->addTab(_("Colors"), tab); mTabs.push_back(tab); tab = new Setup_Players(); - panel->addTab(tab, _("Players")); + panel->addTab(_("Players"), tab); mTabs.push_back(tab); add(panel); diff --git a/src/gui/setup.h b/src/gui/setup.h index 1ad93cac..8a775093 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -48,7 +48,7 @@ class Setup : public Window, public gcn::ActionListener /** * Destructor. */ - virtual ~Setup(); + ~Setup(); /** * Event handling method. diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index bb824f33..eaa3ddba 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -41,6 +41,7 @@ Setup_Audio::Setup_Audio(): mMusicSlider(new Slider(0, 128)) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 290, 255)); gcn::Label *sfxLabel = new gcn::Label(_("Sfx volume")); gcn::Label *musicLabel = new gcn::Label(_("Music volume")); diff --git a/src/gui/setup_colours.cpp b/src/gui/setup_colours.cpp index b542839a..33c7d86b 100644 --- a/src/gui/setup_colours.cpp +++ b/src/gui/setup_colours.cpp @@ -38,6 +38,9 @@ Setup_Colours::Setup_Colours() : mColourLabel(_("Color:")), mSelected(-1) { + setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 290, 255)); + mColourBox = new gcn::ListBox(textColour); mScroll = new ScrollArea(mColourBox); diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index b55ccb7e..1457bc2f 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -38,6 +38,8 @@ Setup_Joystick::Setup_Joystick(): mJoystickEnabled(new CheckBox(_("Enable joystick"))) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 290, 255)); + mJoystickEnabled->setPosition(10, 10); mCalibrateLabel->setPosition(10, 25); mCalibrateButton->setPosition(10, 30 + mCalibrateLabel->getHeight()); diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index 75fa542f..24d12049 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -73,6 +73,7 @@ Setup_Keyboard::Setup_Keyboard(): { keyboard.setSetupKeyboard(this); setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 290, 255)); refreshKeys(); diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 0e960b84..e7770959 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -220,6 +220,7 @@ Setup_Players::Setup_Players(): mIgnoreActionChoicesBox(new gcn::DropDown(new IgnoreChoicesListModel())) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 290, 255)); int table_width = NAME_COLUMN_WIDTH + RELATION_CHOICE_COLUMN_WIDTH; mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index e424c43f..78e26e5e 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -136,6 +136,7 @@ Setup_Video::Setup_Video(): mParticleDetailField(new gcn::Label("")) { setOpaque(false); + setDimension(gcn::Rectangle(0, 0, 290, 255)); ScrollArea *scrollArea = new ScrollArea(mModeList); gcn::Label *alphaLabel = new gcn::Label(_("Gui opacity")); diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp deleted file mode 100644 index f8bc451d..00000000 --- a/src/gui/tabbedcontainer.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "button.h" -#include "tabbedcontainer.h" - -#include "../utils/dtor.h" -#include "../utils/tostring.h" - -TabbedContainer::TabbedContainer(int width, int padX, int buttonHeight, - int height, int padY, int buttonsPerRow): - mActiveContent(0), - mWidth(width), - mPadX(padX), - mButtonHeight(buttonHeight), - mHeight(height), - mPadY(padY), - mButtonsPerRow(buttonsPerRow), - - mButtonWidth((width - (buttonsPerRow - 1) * padX) / buttonsPerRow - padX) -{ -} - -TabbedContainer::~TabbedContainer() -{ - delete_all(mTabs); - mTabs.clear(); - mContents.clear(); -} - -void TabbedContainer::addTab(gcn::Widget *widget, const std::string &caption) -{ - int tabNumber = mTabs.size(); - - Button *tab = new Button(caption, toString(tabNumber), this); - - tab->setSize(mButtonWidth, mButtonHeight); - add(tab, (mButtonWidth + mPadX) * (tabNumber % mButtonsPerRow), - (mButtonHeight + mPadY) * (tabNumber / mButtonsPerRow)); - - mTabs[caption] = tab; - - mContents.push_back(widget); - widget->setPosition(0, mHeight); - - // If this is the first tab in this container, make it visible - if (!mActiveContent) { - mActiveContent = widget; - add(mActiveContent); - tab->setLogged(true); - } - - mWidgets[widget] = caption; -} - -void TabbedContainer::removeTab(const std::string &caption) -{ - gcn::ActionEvent actionEvent(this, "0"); - action(actionEvent); - remove(mTabs[caption]); - mTabs.erase(caption); -} - -void TabbedContainer::logic() -{ - if (mActiveContent) { - mActiveContent->setSize( - getWidth() - 2 * mActiveContent->getFrameSize(), - getHeight() - mHeight - 2 * mActiveContent->getFrameSize()); - } - - Container::logic(); -} - -void TabbedContainer::action(const gcn::ActionEvent &event) -{ - int tabNo; - std::stringstream ss(event.getId()); - ss >> tabNo; - - gcn::Widget *newContent = mContents[tabNo]; - - if (newContent) { - if (mActiveContent) { - // Unhighlight old tab - ((Button*)mTabs[mWidgets[mActiveContent]])->setLogged(false); - remove(mActiveContent); - } - mActiveContent = newContent; - // Highlight new tab - ((Button*)mTabs[mWidgets[mActiveContent]])->setLogged(true); - add(newContent); - } -} - -void TabbedContainer::setOpaque(bool opaque) -{ - Container::setOpaque(opaque); -} - -short TabbedContainer::getNumberOfTabs() -{ - return mTabs.size(); -} - -std::string TabbedContainer::getActiveWidget() -{ - return mWidgets[mActiveContent]; -} diff --git a/src/gui/tabbedcontainer.h b/src/gui/tabbedcontainer.h deleted file mode 100644 index 2fc41247..00000000 --- a/src/gui/tabbedcontainer.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _TMW_TABPANE_H -#define _TMW_TABPANE_H - -#include <iosfwd> -#include <map> -#include <vector> - -#include <guichan/actionlistener.hpp> - -#include <guichan/widgets/container.hpp> - -#include "../guichanfwd.h" - -class TabbedContainer : public gcn::Container, public gcn::ActionListener -{ - public: - TabbedContainer(int width, int padX, int buttonHeight, - int height, int padY, int buttonsPerRow); - ~TabbedContainer(); - - void addTab(gcn::Widget *widget, const std::string &caption); - - void removeTab(const std::string &caption); - - void logic(); - - void action(const gcn::ActionEvent &event); - - void setOpaque(bool opaque); - - short getNumberOfTabs(); - - std::string getActiveWidget(); - - private: - typedef std::vector<gcn::Widget*> Widgets; - typedef Widgets::iterator WidgetIterator; - std::map<std::string, gcn::Widget*> mTabs; // tabs mapped to their channel name - Widgets mContents; // The contents of the tabs - - std::map<gcn::Widget*, std::string> mWidgets; - gcn::Widget *mActiveContent; - - int mWidth; /**< The total width of all buttons */ - int mPadX; /**< The horizontal gap between buttons */ - int mButtonHeight; /**< The height of each button */ - int mHeight; /**< Height of the panel */ - int mPadY; /**< The vertical gap between buttons */ - int mButtonsPerRow; /**< The number of buttons on each row */ - int mButtonWidth; /**< The width of each button */ -}; - -#endif diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp new file mode 100644 index 00000000..c53ac85c --- /dev/null +++ b/src/gui/widgets/tab.cpp @@ -0,0 +1,130 @@ +/* + * The Mana World + * Copyright 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <algorithm> + +#include "tab.h" + +#include "tabbedarea.h" + +#include "../../graphics.h" + +#include "../../resources/image.h" +#include "../../resources/resourcemanager.h" + +#include "../../utils/dtor.h" + +int Tab::mInstances = 0; + +enum{ + TAB_STANDARD, // 0 + TAB_HIGHLIGHTED, // 1 + TAB_SELECTED, // 2 + TAB_UNUSED, // 3 + TAB_COUNT // 4 - Must be last. +}; + +struct TabData +{ + char const *file; + int gridX; + int gridY; +}; + +static TabData const data[TAB_COUNT] = { + {"graphics/gui/tab.png", 0, 0}, + {"graphics/gui/tab.png", 9, 4}, + {"graphics/gui/tabselected.png", 16, 19}, + {"graphics/gui/tab.png", 25, 23} +}; + +ImageRect Tab::tabImg[TAB_COUNT]; + +Tab::Tab() : gcn::Tab() +{ + init(); +} + +Tab::~Tab() +{ + mInstances--; + + if (mInstances == 0) + { + for (int mode = 0; mode < TAB_COUNT; mode++) + { + for_each(tabImg[mode].grid, tabImg[mode].grid + 9, dtor<Image*>()); + } + } +} + +void Tab::init() +{ + setFrameSize(0); + + if (mInstances == 0) + { + // Load the skin + ResourceManager *resman = ResourceManager::getInstance(); + Image *tab[TAB_COUNT]; + + int a, x, y, mode; + + for (mode = 0; mode < TAB_COUNT; mode++) + { + tab[mode] = resman->getImage(data[mode].file); + a = 0; + for (y = 0; y < 3; y++) { + for (x = 0; x < 3; x++) { + tabImg[mode].grid[a] = tab[mode]->getSubImage( + data[x].gridX, data[y].gridY, + data[x + 1].gridX - data[x].gridX + 1, + data[y + 1].gridY - data[y].gridY + 1); + a++; + } + } + tab[mode]->decRef(); + } + } + mInstances++; +} + +void Tab::draw(gcn::Graphics *graphics) +{ + int mode; + + // check which type of tab to draw + if (mTabbedArea && mTabbedArea->isTabSelected(this)) + { + mode = TAB_SELECTED; + } + else + { + mode = TAB_STANDARD; + } + + // draw tab + static_cast<Graphics*>(graphics)-> + drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]); + + // draw label + drawChildren(graphics); +} diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h new file mode 100644 index 00000000..42964b0f --- /dev/null +++ b/src/gui/widgets/tab.h @@ -0,0 +1,60 @@ +/* + * The Mana World + * Copyright 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _TMW_TAB_H +#define _TMW_TAB_H + +#include <guichan/widgets/tab.hpp> + +class ImageRect; + +/** + * A tab, the same as the guichan tab in 0.8, but extended to allow transparancy + */ +class Tab : public gcn::Tab +{ + public: + /** + * Constructor. + */ + Tab(); + + /** + * Destructor. + */ + ~Tab(); + + /** + * Draw the tabbed area. + */ + void draw(gcn::Graphics *graphics); + + private: + /** Load images if no other instances exist yet */ + void init(); + + static ImageRect tabImg[4]; /**< Tab state graphics */ + static int mInstances; /**< Number of tab instances */ +}; + +#endif + + diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp new file mode 100644 index 00000000..205fdc99 --- /dev/null +++ b/src/gui/widgets/tabbedarea.cpp @@ -0,0 +1,160 @@ +/* + * The Mana World + * Copyright 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "tabbedarea.h" +#include "tab.h" + +#include <guichan/widgets/container.hpp> + +TabbedArea::TabbedArea() : gcn::TabbedArea() +{ + mWidgetContainer->setOpaque(false); +} + +int TabbedArea::getNumberOfTabs() +{ + return mTabs.size(); +} + +Tab* TabbedArea::getTab(const std::string &name) +{ + TabContainer::iterator itr = mTabs.begin(), itr_end = mTabs.end(); + while (itr != itr_end) + { + if ((*itr).first->getCaption() == name) + { + return static_cast<Tab*>((*itr).first); + } + ++itr; + } + return NULL; +} + +void TabbedArea::draw(gcn::Graphics *graphics) +{ + if (mTabs.empty()) + { + return; + } + + drawChildren(graphics); +} + +gcn::Widget* TabbedArea::getWidget(const std::string &name) +{ + TabContainer::iterator itr = mTabs.begin(), itr_end = mTabs.end(); + while (itr != itr_end) + { + if ((*itr).first->getCaption() == name) + { + return (*itr).second; + } + ++itr; + } + + return NULL; +} + +void TabbedArea::addTab(const std::string &caption, gcn::Widget *widget) +{ + 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 == NULL) + { + setSelectedTab(tab); + } + + adjustTabPositions(); + adjustSize(); +} + +void TabbedArea::removeTab(Tab *tab) +{ + int tabIndexToBeSelected = 0; + + if (tab == mSelectedTab) + { + int index = getSelectedTabIndex(); + + if (index == (int)mTabs.size() - 1 + && mTabs.size() == 1) + { + tabIndexToBeSelected = -1; + } + else + { + tabIndexToBeSelected = index - 1; + } + } + + TabContainer::iterator iter; + for (iter = mTabs.begin(); iter != mTabs.end(); iter++) + { + if (iter->first == tab) + { + mTabContainer->remove(tab); + mTabs.erase(iter); + break; + } + } + + std::vector<gcn::Tab*>::iterator iter2; + for (iter2 = mTabsToDelete.begin(); iter2 != mTabsToDelete.end(); iter2++) + { + if (*iter2 == tab) + { + mTabsToDelete.erase(iter2); + delete tab; + break; + } + } + + if (tabIndexToBeSelected == -1) + { + mSelectedTab = NULL; + mWidgetContainer->clear(); + } + else + { + setSelectedTab(tabIndexToBeSelected); + } + + adjustSize(); + adjustTabPositions(); +} + +void TabbedArea::logic() +{ + logicChildren(); +} diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h new file mode 100644 index 00000000..2199264b --- /dev/null +++ b/src/gui/widgets/tabbedarea.h @@ -0,0 +1,92 @@ +/* + * The Mana World + * Copyright 2008 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _TMW_TABBEDAREA_H +#define _TMW_TABBEDAREA_H + +#include <guichan/widget.hpp> +#include <guichan/widgets/tabbedarea.hpp> + +#include <string> + +class Tab; + +/** + * A tabbed area, the same as the guichan tabbed area in 0.8, but extended + */ +class TabbedArea : public gcn::TabbedArea +{ + public: + /** + * Constructor. + */ + TabbedArea(); + + /** + * Draw the tabbed area. + */ + void draw(gcn::Graphics *graphics); + + /** + * Return how many tabs have been created + */ + int getNumberOfTabs(); + + /** + * Return tab with specified name as caption + */ + Tab* getTab(const std::string &name); + + /** + * Returns the widget with the tab that has specified caption + */ + gcn::Widget* getWidget(const std::string &name); + + /** + * Add a tab + * @param caption The Caption to display + * @param widget The widget to show when tab is selected + */ + void addTab(const std::string &caption, gcn::Widget *widget); + + /** + * Add a tab + * @param tab The tab + * @param widget The widget to display + */ + void addTab(Tab *tab, gcn::Widget *widget); + + /** + * Overload the remove tab function as its broken in guichan 0.8 + */ + void removeTab(Tab *tab); + + /** + * Overload the logic function since it's broken in guichan 0.8 + */ + void logic(); + + private: + typedef std::vector< std::pair<gcn::Tab*, gcn::Widget*> > TabContainer; +}; + +#endif + |