diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-14 17:22:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-14 17:22:07 +0300 |
commit | 0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b (patch) | |
tree | 5489a0ab504f34e7dcc7c273f274b52c76269206 /src/gui/widgets/tabbedarea.h | |
parent | c23959e3c40e97f9c1aeb9eabc52131b6fa68f2a (diff) | |
download | mv-0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b.tar.gz mv-0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b.tar.bz2 mv-0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b.tar.xz mv-0b3aafe2859d9ea1c4009eed8a87f69c41cbc14b.zip |
Dont use guichan tab and tabbedarea anymore.
It have some methods and widget connections what cant be
changed by overloading.
Diffstat (limited to 'src/gui/widgets/tabbedarea.h')
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 75 |
1 files changed, 60 insertions, 15 deletions
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 <guichan/actionlistener.hpp> #include <guichan/widget.hpp> #include <guichan/widgetlistener.hpp> #include <guichan/widgets/container.hpp> -#include <guichan/widgets/tabbedarea.hpp> #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<gcn::Tab*, gcn::Widget*> > TabContainer; + typedef std::vector <std::pair<Tab*, gcn::Widget*> > 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<Tab*> mTabsToDelete; + + std::vector<std::pair<Tab*, gcn::Widget*> > 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. |