Crazy Eddies GUI System: CEGUI::TabControl Class Reference

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Class List
- Alphabetical List
- Class Hierarchy
- Class Members

# CEGUI::TabControl Class Reference

Base class for standard Tab Control widget. More...

Inheritance diagram for CEGUI::TabControl:

[legend]
Collaboration diagram for CEGUI::TabControl:

[legend]
List of all members.

## Public Member Functions
uint | getTabCount (void) const
| Return number of tabs.
void | setSelectedTab (const String &name)
  | Set the selected tab by the name of the root window within it. Exceptions:
  | InvalidRequestException | thrown if index is out of range.
void | setSelectedTab (uint ID)
  | Set the selected tab by the ID of the root window within it. Exceptions:
  | InvalidRequestException | thrown if index is out of range.
void | setSelectedTabAtIndex (uint index)
  | Set the selected tab by the index position in the tab control. Exceptions:
  | InvalidRequestException | thrown if index is out of range.
Window * | getTabContentsAtIndex (uint index) const
| Return the Window which is the first child of the tab at index position index.
Window * | getTabContents (const String &name) const
| Return the Window which is the tab content with the given name.
Window * | getTabContents (uint ID) const
| Return the Window which is the tab content with the given ID.
bool | isTabContentsSelected (Window *wnd) const
| Return whether the tab contents window is currently selected.
uint | getSelectedTabIndex () const
| Return the index of the currently selected tab.
float | getRelativeTabHeight (void) const
| Return the relative height of the tabs.
float | getAbsoluteTabHeight (void) const
| Return the absolute height of the tabs.
float | getTabHeight (void) const
| Return the height of the tabs in the current metrics mode.
float | getTabTextPadding (void) const
| Return the amount of padding to add either side of the text in the tab, according to the current metrics mode.
float | getRelativeTabTextPadding (void) const
| Return the relative amount of padding to add either side of the text in the tab.
float | getAbsoluteTabTextPadding (void) const
| Return the absolute amount of padding to add either side of the text in the tab.
virtual void | initialise (void)
| Initialise the Window based object ready for use.
void | setRelativeTabHeight (float height)
| Set the relative height of the tabs.
void | setAbsoluteTabHeight (float height)
| Set the absolute height of the tabs.
void | setTabHeight (float height)
| Set the height of the tabs in the current metrics mode.
void | setTabTextPadding (float)
| Set the amount of padding to add either side of the text in the tab, according to the current metrics mode.
void | setRelativeTabTextPadding (float)
| Set the relative amount of padding to add either side of the text in the tab.
void | setAbsoluteTabTextPadding (float)
| Set the absolute amount of padding to add either side of the text in the tab.
void | addTab (Window *wnd)
| Add a new tab to the tab control.
void | removeTab (const String &name)
| Remove the named tab from the tab control.
void | removeTab (uint ID)
| Remove the tab with the given ID from the tab control.
| TabControl (const String &type, const String &name)
| Constructor for TabControl base class.
virtual | ~TabControl (void)
| Destructor for Listbox base class.
## Static Public Attributes
static const String | EventNamespace
| Namespace for global events.
static const String | EventSelectionChanged
| Event triggered when there is a change to the currently selected tab.
## Protected Types
typedef std::map< uint, TabButton * > | TabButtonIndexMap
## Protected Member Functions
virtual void | drawSelf (float z)
| Perform the actual rendering for this Window.
void | addTabControlEvents (void)
| Add tab control specific events.
virtual void | addButtonForTabContent (Window *wnd)
| Add a TabButton for the specified child Window.
virtual void | removeButtonForTabContent (Window *wnd)
| Remove the TabButton for the specified child Window.
TabButton * | getButtonForTabContents (Window *wnd) const
  | Return the TabButton associated with this Window. Exceptions:
  | InvalidRequestException | thrown if content is not found.
String | makeButtonName (Window *wnd)
| Construct a button name to handle a window.
virtual void | selectTab_impl (Window *wnd)
| Internal implementation of select tab.
virtual bool | testClassName_impl (const String &class_name) const
| Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
void | performChildWindowLayout ()
| method called to perform extended laying out of attached child windows.
int | writeChildWindowsXML (OutStream &out_stream) const
virtual void | onSelectionChanged (WindowEventArgs &e)
| Handler called internally when the currently selected item or items changes.
virtual void | onFontChanged (WindowEventArgs &e)
| Handler called when the window's font is changed.
virtual TabPane * | createTabContentPane (const String &name) const =0
| create and return a pointer to a TabPane widget for use as content area
virtual Window * | createTabButtonPane (const String &name) const
| create and return a pointer to a widget for use as tab button area
virtual TabButton * | createTabButton (const String &name) const =0
| create and return a pointer to a TabButton widget for use as a clickable tab header
void | calculateTabButtonSizePosition (TabButton *btn, uint targetIndex)
| Calculate the correct position and size of a tab button, based on the index it is due to be placed at.
void | addTabControlProperties (void)
void | addChild_impl (Window *wnd)
| Add given window to child list at an appropriate position.
void | removeChild_impl (Window *wnd)
| Remove given window from child list.
bool | handleContentWindowTextChanged (const EventArgs &args)
bool | handleTabButtonClicked (const EventArgs &args)
## Protected Attributes
Window * | d_tabButtonPane
| The area containing the tab buttons.
TabPane * | d_tabContentPane
| The content area window.
float | d_abs_tabHeight
| The height of the tabs in pixels.
float | d_rel_tabHeight
| The height of the tabs relative to parent.
float | d_abs_tabPadding
| The padding of the tabs in pixels.
float | d_rel_tabPadding
| The padding of the tabs relative to parent.
uint | d_nextTabIndex
| The index to give the next tab.
TabButtonIndexMap | d_tabButtonIndexMap
| Sorting for tabs.
## Static Protected Attributes
static TabControlProperties::TabHeight | d_tabHeightProperty
static TabControlProperties::AbsoluteTabHeight | d_absoluteTabHeightProperty
static TabControlProperties::RelativeTabHeight | d_relativeTabHeightProperty
static TabControlProperties::TabTextPadding | d_tabTextPaddingProperty
static TabControlProperties::AbsoluteTabTextPadding | d_absoluteTabTextPaddingProperty
static TabControlProperties::RelativeTabTextPadding | d_relativeTabTextPaddingProperty

## Detailed Description

Base class for standard Tab Control widget.

## Member Function Documentation

void CEGUI::TabControl::addTab | ( | Window * | wnd | ) |

  | Add a new tab to the tab control. The new tab will be added with the same text as the window passed in. Parameters:
  | wnd | The Window which will be placed in the content area of this new tab.

void CEGUI::TabControl::calculateTabButtonSizePosition | ( | TabButton * | btn,
|  | uint | targetIndex
| ) | `[protected]`

  | Calculate the correct position and size of a tab button, based on the index it is due to be placed at. Parameters:
  | btn | Pointer to a button to calculate the size and position for. This button will be updated in place with these metrics.
  | targetIndex | The index at which the tab is/will be placed. Tabs must exist for all the indexes before this.

virtual TabButton* CEGUI::TabControl::createTabButton | ( | const String & | name | ) | const`[protected, pure virtual]`

  | create and return a pointer to a TabButton widget for use as a clickable tab header Parameters:
  | name | Button name
Returns: Pointer to a TabButton to be used for changing tabs.

Window * CEGUI::TabControl::createTabButtonPane | ( | const String & | name | ) | const`[protected, virtual]`

  | create and return a pointer to a widget for use as tab button area Parameters:
  | name | String holding the name to be given to the new component.
Returns: Pointer to a Static to be used for holding the tab buttons.

virtual TabPane* CEGUI::TabControl::createTabContentPane | ( | const String & | name | ) | const`[protected, pure virtual]`

  | create and return a pointer to a TabPane widget for use as content area Parameters:
  | name | String holding the name to be given to the new component.
Returns: Pointer to a TabPane to be used for holding the main content.

virtual void CEGUI::TabControl::drawSelf | ( | float | z | ) | `[inline, protected, virtual]`

  | Perform the actual rendering for this Window. Parameters:
  | z | float value specifying the base Z co-ordinate that should be used when rendering
Returns: Nothing Reimplemented from CEGUI::Window.

uint CEGUI::TabControl::getSelectedTabIndex | ( |  | ) | const

| Return the index of the currently selected tab. Returns: index of the currently selected tab.

Window * CEGUI::TabControl::getTabContents | ( | uint | ID | ) | const

  | Return the Window which is the tab content with the given ID. Parameters:
  | ID | ID of the Window which was attached as a tab content.
  Returns: Pointer to the Window with the given ID in the tab control. Exceptions:
  | InvalidRequestException | thrown if content is not found.

Window * CEGUI::TabControl::getTabContents | ( | const String & | name | ) | const

  | Return the Window which is the tab content with the given name. Parameters:
  | name | Name of the Window which was attached as a tab content.
  Returns: Pointer to the named Window in the tab control. Exceptions:
  | InvalidRequestException | thrown if content is not found.

Window * CEGUI::TabControl::getTabContentsAtIndex | ( | uint | index | ) | const

  | Return the Window which is the first child of the tab at index position index. Parameters:
  | index | Zero based index of the item to be returned.
  Returns: Pointer to the Window at index position index in the tab control. Exceptions:
  | InvalidRequestException | thrown if index is out of range.

uint CEGUI::TabControl::getTabCount | ( | void |  | ) | const

| Return number of tabs. Returns: the number of tabs currently present.

void CEGUI::TabControl::initialise | ( | void |  | ) | `[virtual]`

| Initialise the Window based object ready for use. Note: This must be called for every window created. Normally this is handled automatically by the WindowFactory for each Window type. Returns: Nothing Reimplemented from CEGUI::Window.

bool CEGUI::TabControl::isTabContentsSelected | ( | Window * | wnd | ) | const

  | Return whether the tab contents window is currently selected. Parameters:
  | wnd | The tab contents window to query.
  Returns: true if the tab is currently selected, false otherwise. Exceptions:
  | InvalidRequestException | thrown if wnd is not a valid tab contents window.

void CEGUI::TabControl::onFontChanged | ( | WindowEventArgs & | e | ) | `[protected, virtual]`

  | Handler called when the window's font is changed. Parameters:
  | e | WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event. For this event the trigger window is always 'this'.
Reimplemented from CEGUI::Window.

void CEGUI::TabControl::performChildWindowLayout | ( |  | ) | `[protected, virtual]`

| method called to perform extended laying out of attached child windows. The system may call this at various times (like when it is resized for example), and it may be invoked directly where required. Returns: Nothing. Reimplemented from CEGUI::Window.

void CEGUI::TabControl::removeTab | ( | uint | ID | ) |

| Remove the tab with the given ID from the tab control. The tab content will be destroyed.

void CEGUI::TabControl::removeTab | ( | const String & | name | ) |

| Remove the named tab from the tab control. The tab content will be destroyed.

void CEGUI::TabControl::selectTab_impl | ( | Window * | wnd | ) | `[protected, virtual]`

  | Internal implementation of select tab. Parameters:
  | wnd | Pointer to a Window which is the root of the tab content to select

virtual bool CEGUI::TabControl::testClassName_impl | ( | const String & | class_name | ) | const`[inline, protected, virtual]`

  | Return whether this window was inherited from the given class name at some point in the inheritance heirarchy. Parameters:
  | class_name | The class name that is to be checked.
Returns: true if this window was inherited from class_name. false if not. Reimplemented from CEGUI::Window.