Crazy Eddie's GUI System  0.8.4
CEGUI::TabControl Class Reference

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

+ Inheritance diagram for CEGUI::TabControl:
+ Collaboration diagram for CEGUI::TabControl:

List of all members.

Public Types

enum  TabPanePosition { Top, Bottom }

Public Member Functions

size_t getTabCount (void) const
 Return number of tabs.
TabPanePosition getTabPanePosition (void) const
 Return the positioning of the tab pane.
void setTabPanePosition (TabPanePosition pos)
 Change the positioning of the tab button pane.
void setSelectedTab (const String &name)
 Set the selected tab by the name of the root window within it. Also ensures that the tab is made visible (tab pane is scrolled if required).

Exceptions:
InvalidRequestExceptionthrown if there's no tab named name.

void setSelectedTab (uint ID)
 Set the selected tab by the ID of the root window within it. Also ensures that the tab is made visible (tab pane is scrolled if required).

Exceptions:
InvalidRequestExceptionthrown if index is out of range.

void setSelectedTabAtIndex (size_t index)
 Set the selected tab by the index position in the tab control. Also ensures that the tab is made visible (tab pane is scrolled if required).

Exceptions:
InvalidRequestExceptionthrown if index is out of range.

void makeTabVisible (const String &name)
 Ensure that the tab by the name of the root window within it is visible.

Exceptions:
InvalidRequestExceptionthrown if there's no tab named name.

void makeTabVisible (uint ID)
 Ensure that the tab by the ID of the root window within it is visible.

Exceptions:
InvalidRequestExceptionthrown if index is out of range.

void makeTabVisibleAtIndex (size_t index)
 Ensure that the tab by the index position in the tab control is visible.

Exceptions:
InvalidRequestExceptionthrown if index is out of range.

WindowgetTabContentsAtIndex (size_t index) const
 Return the Window which is the first child of the tab at index position index.
WindowgetTabContents (const String &name) const
 Return the Window which is the tab content with the given name.
WindowgetTabContents (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.
size_t getSelectedTabIndex () const
 Return the index of the currently selected tab.
const UDimgetTabHeight (void) const
 Return the height of the tabs.
const UDimgetTabTextPadding (void) const
 Return the amount of padding to add either side of the text in the tab.
virtual void initialiseComponents (void)
 Initialise the Window based object ready for use.
void setTabHeight (const UDim &height)
 Set the height of the tabs.
void setTabTextPadding (const UDim &padding)
 Set the 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 WidgetTypeName
 Window factory name.
static const String EventSelectionChanged
static const String ContentPaneName
 Widget name for the tab content pane component.
static const String TabButtonName
 Widget name for the tab button components.
static const String TabButtonPaneName
 Widget name for the tab button pane component.
static const String ButtonScrollLeft
 Widget name for the scroll tabs to right pane component.
static const String ButtonScrollRight
 Widget name for the scroll tabs to left pane component.

Protected Types

typedef std::vector< TabButton
*CEGUI_VECTOR_ALLOC(TabButton *) 
TabButtonVector )

Protected Member Functions

virtual void drawSelf (const RenderingContext &)
 Perform the actual rendering for this Window.
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.
TabButtongetButtonForTabContents (Window *wnd) const
 Return the TabButton associated with this Window.

Exceptions:
InvalidRequestExceptionthrown 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 void makeTabVisible_impl (Window *wnd)
 Internal implementation of make tab visible.
WindowgetTabButtonPane () const
 Return a pointer to the tab button pane (Window)for this TabControl.
WindowgetTabPane () const
 Return a pointer to the content component widget for this TabControl.
void performChildWindowLayout (bool nonclient_sized_hint=false, bool client_sized_hint=false)
 Layout child window content.
int writeChildWindowsXML (XMLSerializer &xml_stream) const
virtual bool validateWindowRenderer (const WindowRenderer *renderer) const
 Function used in checking if a WindowRenderer is valid for this window.
TabButtoncreateTabButton (const String &name) const
 create and return a pointer to a TabButton widget for use as a clickable tab header
void removeTab_impl (Window *window)
 Implementation function to do main work of removing a tab.
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.
void calculateTabButtonSizePosition (size_t index)
 create and return a pointer to a TabButton widget for use as a clickable tab header
void addTabControlProperties (void)
void addChild_impl (Element *element)
void removeChild_impl (Element *element)
virtual NamedElementgetChildByNamePath_impl (const String &name_path) const
bool handleContentWindowTextChanged (const EventArgs &args)
bool handleTabButtonClicked (const EventArgs &args)
bool handleScrollPane (const EventArgs &e)
bool handleDraggedPane (const EventArgs &e)
bool handleWheeledPane (const EventArgs &e)

Protected Attributes

UDim d_tabHeight
 The height of the tabs in pixels.
UDim d_tabPadding
 The padding of the tabs relative to parent.
TabButtonVector d_tabButtonVector
 Sorting for tabs.
float d_firstTabOffset
 The offset in pixels of the first tab.
TabPanePosition d_tabPanePos
 The position of the tab pane.
float d_btGrabPos
std::map< Window
*, Event::ScopedConnection
d_eventConnections
 Container used to track event subscriptions to added tab windows.

Detailed Description

Base class for standard Tab Control widget.


Member Function Documentation

void CEGUI::TabControl::addChild_impl ( Element element) [protected, virtual]

Add given element to child list at an appropriate position.

Reimplemented from CEGUI::Window.

Add a new tab to the tab control.

The new tab will be added with the same text as the window passed in.
Parameters:
wndThe Window which will be placed in the content area of this new tab.
void CEGUI::TabControl::calculateTabButtonSizePosition ( size_t  index) [protected]

create and return a pointer to a TabButton widget for use as a clickable tab header

Parameters:
nameButton name
Returns:
Pointer to a TabButton to be used for changing tabs.

Calculate the correct position and size of a tab button, based on the index it is due to be placed at.

Parameters:
indexThe index of the tab button
TabButton* CEGUI::TabControl::createTabButton ( const String name) const [protected]

create and return a pointer to a TabButton widget for use as a clickable tab header

Parameters:
nameButton name
Returns:
Pointer to a TabButton to be used for changing tabs.
virtual void CEGUI::TabControl::drawSelf ( const RenderingContext ) [inline, protected, virtual]

Perform the actual rendering for this Window.

Parameters:
zfloat value specifying the base Z co-ordinate that should be used when rendering
Returns:
Nothing

Reimplemented from CEGUI::Window.

virtual NamedElement* CEGUI::TabControl::getChildByNamePath_impl ( const String name_path) const [protected, virtual]

Retrieves a child at name_path or 0 if none such exists.

Reimplemented from CEGUI::NamedElement.

Return the index of the currently selected tab.

Returns:
index of the currently selected tab.

Return a pointer to the tab button pane (Window)for this TabControl.

Returns:
Pointer to a Window object.
Exceptions:
UnknownObjectExceptionThrown if the component does not exist.

Return the Window which is the tab content with the given name.

Parameters:
nameName of the Window which was attached as a tab content.
Returns:
Pointer to the named Window in the tab control.
Exceptions:
InvalidRequestExceptionthrown if content is not found.

Return the Window which is the tab content with the given ID.

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

Return the Window which is the first child of the tab at index position index.

Parameters:
indexZero based index of the item to be returned.
Returns:
Pointer to the Window at index position index in the tab control.
Exceptions:
InvalidRequestExceptionthrown if index is out of range.
size_t CEGUI::TabControl::getTabCount ( void  ) const

Return number of tabs.

Returns:
the number of tabs currently present.
Window* CEGUI::TabControl::getTabPane ( ) const [protected]

Return a pointer to the content component widget for this TabControl.

Returns:
Pointer to a Window object.
Exceptions:
UnknownObjectExceptionThrown if the component does not exist.
TabPanePosition CEGUI::TabControl::getTabPanePosition ( void  ) const [inline]

Return the positioning of the tab pane.

Returns:
The positioning of the tab window within the tab control.
virtual void CEGUI::TabControl::initialiseComponents ( 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.

Return whether the tab contents window is currently selected.

Parameters:
wndThe tab contents window to query.
Returns:
true if the tab is currently selected, false otherwise.
Exceptions:
InvalidRequestExceptionthrown if wnd is not a valid tab contents window.
virtual void CEGUI::TabControl::makeTabVisible_impl ( Window wnd) [protected, virtual]

Internal implementation of make tab visible.

Parameters:
wndPointer to a Window which is the root of the tab content to make visible
virtual void CEGUI::TabControl::onFontChanged ( WindowEventArgs e) [protected, virtual]

Handler called when the window's font is changed.

Parameters:
eWindowEventArgs 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 ( bool  nonclient_sized_hint = false,
bool  client_sized_hint = false 
) [protected, virtual]

Layout child window content.

Laying out of child content includes:

  • ensuring content specified in any assigned WidgetLook has its area rectangles sychronised.
  • assigned WindowRenderer given the opportunity to update child content areas as needed.
  • All content is then potentially updated via the onParentSized notification as required by changes in non-client and client area rectangles.

The system may call this at various times (like when a window is resized for example), and it may be invoked directly where required.

Parameters:
nonclient_sized_hintHint that the non-client area rectangle has changed size.
client_sized_hintHint that the client area rectangle has changed size.
Note:
The hint parameters are essentially a way to force onParentSized notifications for a given type (client / nonclient) of child window. Setting a hint to false does not mean a notification will not happen, instead it means that the function is to do its best to determine whether a given notification is required to be sent.

Reimplemented from CEGUI::Window.

void CEGUI::TabControl::removeChild_impl ( Element element) [protected, virtual]

Remove given element from child list.

Reimplemented from CEGUI::Window.

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

Remove the named tab from the tab control.

The tab content will be destroyed.
void CEGUI::TabControl::removeTab ( uint  ID)

Remove the tab with the given ID from the tab control.

The tab content will be destroyed.
virtual void CEGUI::TabControl::selectTab_impl ( Window wnd) [protected, virtual]

Internal implementation of select tab.

Parameters:
wndPointer to a Window which is the root of the tab content to select
void CEGUI::TabControl::setTabPanePosition ( TabPanePosition  pos)

Change the positioning of the tab button pane.

Parameters:
posThe new positioning of the tab pane
virtual bool CEGUI::TabControl::validateWindowRenderer ( const WindowRenderer renderer) const [protected, virtual]

Function used in checking if a WindowRenderer is valid for this window.

Parameters:
rendererWindow renderer that will be checked (it can be null!)
Returns:
Returns true if the given WindowRenderer class name is valid for this window. False if not.

Reimplemented from CEGUI::Window.


Member Data Documentation

float CEGUI::TabControl::d_btGrabPos [protected]

The position on the button tab where user grabbed

Event fired when a different tab is selected. Handlers are passed a const WindowEventArgs reference with WindowEventArgs::window set to the TabControl that has a newly selected tab.

 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends