From 0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 14 Oct 2012 17:22:07 +0300 Subject: Dont use guichan tab and tabbedarea anymore. It have some methods and widget connections what cant be changed by overloading. --- src/gui/widgets/tabbedarea.h | 75 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 15 deletions(-) (limited to 'src/gui/widgets/tabbedarea.h') diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 9edf46748..b7e5f8154 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -23,10 +23,10 @@ #ifndef TABBEDAREA_H #define TABBEDAREA_H +#include #include #include #include -#include #include "gui/widgets/button.h" @@ -37,7 +37,11 @@ class Tab; /** * A tabbed area, the same as the guichan tabbed area in 0.8, but extended */ -class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener +class TabbedArea final : public gcn::ActionListener, + public gcn::BasicContainer, + public gcn::KeyListener, + public gcn::MouseListener, + public gcn::WidgetListener { public: /** @@ -86,21 +90,18 @@ class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener * @param tab The tab widget for the tab. * @param widget The widget to view when the tab is selected. */ - void addTab(gcn::Tab* tab, gcn::Widget* widget) override; + void addTab(Tab *tab, gcn::Widget *widget); - /** - * Add a tab. Overridden since it needs to create an instance of Tab - * instead of gcn::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 *const widget); + bool isTabSelected(unsigned int index) const; + + bool isTabSelected(Tab* tab); + /** * Overload the remove tab function as it's broken in guichan 0.8. */ - void removeTab(gcn::Tab *tab) override; + void removeTab(Tab *tab); void removeAll(); @@ -112,7 +113,22 @@ class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener int getContainerHeight() const { return mWidgetContainer->getHeight(); } - void setSelectedTab(gcn::Tab *tab) override; + void setSelectedTab(Tab *tab); + + void setSelectedTab(unsigned int index); + + int getSelectedTabIndex() const; + + Tab* getSelectedTab() + { return mSelectedTab; } + + void setOpaque(bool opaque) + { mOpaque = opaque; } + + bool isOpaque() const + { return mOpaque; } + + void adjustSize(); void setSelectedTabByPos(int tab); @@ -121,9 +137,9 @@ class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener void widgetResized(const gcn::Event &event) override; /* - void moveLeft(gcn::Tab *tab); + void moveLeft(Tab *tab); - void moveRight(gcn::Tab *tab); + void moveRight(Tab *tab); */ void adjustTabPositions(); @@ -155,8 +171,18 @@ class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener void setBlockSwitching(bool b) { mBlockSwitching = b; } + void setWidth(int width); + + void setHeight(int height); + + void setSize(int width, int height); + + void setDimension(const gcn::Rectangle &dimension); + + void death(const gcn::Event &event); + private: - typedef std::vector< std::pair > TabContainer; + typedef std::vector > TabContainer; /** The tab arrows */ gcn::Button *mArrowButton[2]; @@ -170,6 +196,24 @@ class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener */ void updateTabsWidth(); + + + Tab* mSelectedTab; + + gcn::Container* mTabContainer; + + gcn::Container* mWidgetContainer; + + std::vector mTabsToDelete; + + std::vector > mTabs; + + bool mOpaque; + + + + + /** * The overall width of all tab. */ @@ -187,6 +231,7 @@ class TabbedArea final : public gcn::TabbedArea, public gcn::WidgetListener int mVisibleTabsWidth; + /** * The tab scroll index. When scrolling with the arrows, the tabs * must be displayed according to the current index. -- cgit v1.2.3-70-g09d2