Mana
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TabbedArea Class Referencefinal

A tabbed area, the same as the guichan tabbed area in 0.8, but extended. More...

#include <tabbedarea.h>

Inheritance diagram for TabbedArea:

Public Member Functions

 TabbedArea ()
 
void draw (gcn::Graphics *graphics) override
 Draw the tabbed area.
 
int getNumberOfTabs () const
 Return how many tabs have been created.
 
TabgetTab (const std::string &name) const
 Return tab with specified name as caption.
 
gcn::Widget * getWidget (const std::string &name) const
 Returns the widget with the tab that has specified caption.
 
gcn::Widget * getCurrentWidget ()
 Returns the widget for the current tab.
 
void addTab (gcn::Tab *tab, gcn::Widget *widget) override
 Add a tab.
 
void addTab (const std::string &caption, gcn::Widget *widget) override
 Add a tab.
 
void removeTab (gcn::Tab *tab) override
 Override the remove tab function as it's broken in guichan 0.8.
 
void logic () override
 Override the logic function since it's broken in guichan 0.8.
 
int getContainerHeight () const
 
void setSelectedTab (unsigned int index) override
 
void setSelectedTab (gcn::Tab *tab) override
 
void widgetResized (const gcn::Event &event) override
 
void adjustTabPositions ()
 
void action (const gcn::ActionEvent &actionEvent) override
 
void mousePressed (gcn::MouseEvent &mouseEvent) override
 

Private Member Functions

void updateArrowEnableState ()
 Check whether the arrow should be clickable.
 
void updateTabsWidth ()
 Update the overall width of all tab.
 
void updateVisibleTabsWidth ()
 Update the overall width of visible tab.
 

Private Attributes

std::unique_ptr< ButtonmArrowButton [2]
 The tab arrows.
 
int mTabsWidth = 0
 The overall width of all tab.
 
int mVisibleTabsWidth = 0
 The overall width of visible tab.
 
unsigned mTabScrollIndex = 0
 The tab scroll index.
 

Detailed Description

A tabbed area, the same as the guichan tabbed area in 0.8, but extended.

Definition at line 39 of file tabbedarea.h.

Constructor & Destructor Documentation

◆ TabbedArea()

TabbedArea::TabbedArea ( )

Definition at line 30 of file tabbedarea.cpp.

Member Function Documentation

◆ action()

void TabbedArea::action ( const gcn::ActionEvent &  actionEvent)
override

Definition at line 260 of file tabbedarea.cpp.

◆ addTab() [1/2]

void TabbedArea::addTab ( const std::string &  caption,
gcn::Widget *  widget 
)
override

Add a tab.

Overridden since it needs to create an instance of Tab instead of gcn::Tab.

Parameters
captionThe Caption to display
widgetThe widget to show when tab is selected

Definition at line 106 of file tabbedarea.cpp.

◆ addTab() [2/2]

void TabbedArea::addTab ( gcn::Tab *  tab,
gcn::Widget *  widget 
)
override

Add a tab.

Overridden since it needs to size the widget.

Parameters
tabThe tab widget for the tab.
widgetThe widget to view when the tab is selected.

Definition at line 93 of file tabbedarea.cpp.

◆ adjustTabPositions()

void TabbedArea::adjustTabPositions ( )

Definition at line 228 of file tabbedarea.cpp.

◆ draw()

void TabbedArea::draw ( gcn::Graphics *  graphics)
override

Draw the tabbed area.

Definition at line 61 of file tabbedarea.cpp.

◆ getContainerHeight()

int TabbedArea::getContainerHeight ( ) const
inline

Definition at line 98 of file tabbedarea.h.

◆ getCurrentWidget()

gcn::Widget * TabbedArea::getCurrentWidget ( )

Returns the widget for the current tab.

Definition at line 85 of file tabbedarea.cpp.

◆ getNumberOfTabs()

int TabbedArea::getNumberOfTabs ( ) const

Return how many tabs have been created.

Todo:
Remove this method when upgrading to Guichan 0.9.0

Definition at line 46 of file tabbedarea.cpp.

◆ getTab()

Tab * TabbedArea::getTab ( const std::string &  name) const

Return tab with specified name as caption.

Definition at line 51 of file tabbedarea.cpp.

◆ getWidget()

gcn::Widget * TabbedArea::getWidget ( const std::string &  name) const

Returns the widget with the tab that has specified caption.

Definition at line 74 of file tabbedarea.cpp.

◆ logic()

void TabbedArea::logic ( )
override

Override the logic function since it's broken in guichan 0.8.

Definition at line 150 of file tabbedarea.cpp.

◆ mousePressed()

void TabbedArea::mousePressed ( gcn::MouseEvent &  mouseEvent)
override

Definition at line 155 of file tabbedarea.cpp.

◆ removeTab()

void TabbedArea::removeTab ( gcn::Tab *  tab)
override

Override the remove tab function as it's broken in guichan 0.8.

Definition at line 115 of file tabbedarea.cpp.

◆ setSelectedTab() [1/2]

void TabbedArea::setSelectedTab ( gcn::Tab *  tab)
override

Definition at line 173 of file tabbedarea.cpp.

◆ setSelectedTab() [2/2]

void TabbedArea::setSelectedTab ( unsigned int  index)
inlineoverride

Definition at line 101 of file tabbedarea.h.

◆ updateArrowEnableState()

void TabbedArea::updateArrowEnableState ( )
private

Check whether the arrow should be clickable.

Definition at line 286 of file tabbedarea.cpp.

◆ updateTabsWidth()

void TabbedArea::updateTabsWidth ( )
private

Update the overall width of all tab.

Used to know whether the arrows have to be drawn or not.

Definition at line 212 of file tabbedarea.cpp.

◆ updateVisibleTabsWidth()

void TabbedArea::updateVisibleTabsWidth ( )
private

Update the overall width of visible tab.

Used to know whether the arrows have to be enable or not.

Definition at line 221 of file tabbedarea.cpp.

◆ widgetResized()

void TabbedArea::widgetResized ( const gcn::Event &  event)
override

Definition at line 183 of file tabbedarea.cpp.

Member Data Documentation

◆ mArrowButton

std::unique_ptr<Button> TabbedArea::mArrowButton[2]
private

The tab arrows.

Definition at line 118 of file tabbedarea.h.

◆ mTabScrollIndex

unsigned TabbedArea::mTabScrollIndex = 0
private

The tab scroll index.

When scrolling with the arrows, the tabs must be displayed according to the current index. So the first tab displayed may not be the first in the list.

Note
the index must start at 0.

Definition at line 152 of file tabbedarea.h.

◆ mTabsWidth

int TabbedArea::mTabsWidth = 0
private

The overall width of all tab.

Definition at line 132 of file tabbedarea.h.

◆ mVisibleTabsWidth

int TabbedArea::mVisibleTabsWidth = 0
private

The overall width of visible tab.

Definition at line 143 of file tabbedarea.h.


The documentation for this class was generated from the following files: