PixelLightAPI  .
Public Member Functions | Public Attributes | Protected Member Functions
PLGui::TabBar Class Reference

Tab bar widget. More...

#include <TabBar.h>

Inheritance diagram for PLGui::TabBar:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLGUI_API TabBar (Widget *pParent=nullptr)
 Constructor.
virtual PLGUI_API ~TabBar ()
 Destructor.
PLGUI_API ESide GetSide () const
 Get side the tabbar is positioned on.
PLGUI_API void SetSide (ESide nSide)
 Set side the tabbar is positioned on.
PLGUI_API PLCore::uint32 GetOptions () const
 Get TabBar options.
PLGUI_API void SetOptions (PLCore::uint32 nOptions)
 Set TabBar options.
PLGUI_API PLCore::uint32 GetTabWidth () const
 Get tab width.
PLGUI_API void SetTabWidth (PLCore::uint32 nWidth)
 Set tab width.
PLGUI_API PLCore::uint32 GetTabHeight () const
 Get tab height.
PLGUI_API void SetTabHeight (PLCore::uint32 nHeight)
 Set tab height.
PLGUI_API void CreateTab ()
 Create a new tab.
PLGUI_API void CloseTab (TabBarEntry *pTab)
 Close tab.
PLGUI_API void CloseTab (PLCore::uint32 nTab)
 Close tab.
PLGUI_API const
PLCore::Container< TabBarEntry * > & 
GetTabs () const
 Get list of tabs.
PLGUI_API TabBarEntryAddTab (const PLCore::String &sText)
 Add tab.
PLGUI_API TabBarEntryAddTab (const PLCore::String &sText, const Image &cIcon)
 Add tab.
PLGUI_API bool RemoveTab (TabBarEntry *pTab)
 Remove tab.
PLGUI_API bool RemoveTab (PLCore::uint32 nTab)
 Remove tab.
PLGUI_API int GetSelection () const
 Get currently selected tab.
PLGUI_API void SetSelection (int nTab)
 Set currently selected tab.
PLGUI_API int GetScrollingPos () const
 Get scrolling position.
PLGUI_API void SetScrollingPos (int nTab)
 Set scrolling position.
PLGUI_API int GetMouseSelection () const
 Get tab that is currently selected by the mouse.

Public Attributes

PLCore::Event< TabBarEntry * > EventAddTab
PLCore::Event< TabBarEntry * > EventRemoveTab
PLCore::Event< TabBarEntry * > EventCloseTab
PLCore::Event< int > EventSelectTab
PLCore::Event EventCreateTab
ESide m_nSide
PLCore::uint32 m_nOptions
PLCore::uint32 m_nTabWidth
PLCore::uint32 m_nTabHeight
PLCore::List< TabBarEntry * > m_lstTabs
int m_nSelection
int m_nMouseSelection
int m_nScrollingPos
TabBarButtonm_pButtonCreate
TabBarButtonm_pButtonNext
TabBarButtonm_pButtonPrev

Protected Member Functions

PLGUI_API void RedrawTab (int nTab)
 Redraw tab.
PLGUI_API void SetMouseSelection (int nTab)
 Set tab that is currently selected by the mouse.
virtual PLGUI_API PLMath::Vector2i OnPreferredSize (const PLMath::Vector2i &vRefSize) const
 Called when the widget is to calculate it's preferred size.
virtual PLGUI_API void OnAdjustContent ()
 Called when the widget content has to be adjusted.
virtual PLGUI_API void OnAddTab (TabBarEntry *pTab)
 Called when a new tab is added.
virtual PLGUI_API void OnRemoveTab (TabBarEntry *pTab)
 Called when a tab is removed.
virtual PLGUI_API void OnCloseTab (TabBarEntry *pTab)
 Called when a tab shall be closed.
virtual PLGUI_API void OnSelectTab (int nTab)
 Called when the current selection has been changed.
virtual PLGUI_API void OnCreateTab ()
 Called when a new tab shall be created.

Detailed Description

Tab bar widget.


Constructor & Destructor Documentation

PLGUI_API PLGui::TabBar::TabBar ( Widget pParent = nullptr)

Constructor.

Parameters:
[in]pParentPointer to parent widget
virtual PLGUI_API PLGui::TabBar::~TabBar ( ) [virtual]

Destructor.


Member Function Documentation

PLGUI_API ESide PLGui::TabBar::GetSide ( ) const

Get side the tabbar is positioned on.

Returns:
Side
PLGUI_API void PLGui::TabBar::SetSide ( ESide  nSide)

Set side the tabbar is positioned on.

Parameters:
[in]nSideSide
PLGUI_API PLCore::uint32 PLGui::TabBar::GetOptions ( ) const

Get TabBar options.

Returns:
TabBar options (combination of ETabBarOption values)
PLGUI_API void PLGui::TabBar::SetOptions ( PLCore::uint32  nOptions)

Set TabBar options.

Parameters:
[in]nOptionsTabBar options
PLGUI_API PLCore::uint32 PLGui::TabBar::GetTabWidth ( ) const

Get tab width.

Returns:
Tab width
Remarks:
see SetTabWidth()
PLGUI_API void PLGui::TabBar::SetTabWidth ( PLCore::uint32  nWidth)

Set tab width.

Parameters:
[in]nWidthTab width
Note:
  • If side is SideTop or SideBottom and StaticTabSize is *not* set, tabs have a floating size. In that case, the width set by nWidth is the maximum size that a tab can have.
  • If side is SideLeft or SideRight, or StaticTabSize is set, tabs have a static size. In that case, every tab will get exactly the width set by nWidth.
PLGUI_API PLCore::uint32 PLGui::TabBar::GetTabHeight ( ) const

Get tab height.

Returns:
Tab height
PLGUI_API void PLGui::TabBar::SetTabHeight ( PLCore::uint32  nHeight)

Set tab height.

Parameters:
[in]nHeightTab height
PLGUI_API void PLGui::TabBar::CreateTab ( )

Create a new tab.

Remarks:
CreateTab creates an event saying that a new tab shall be created. This does not do anything automatically, so you have to catch the event and call AddTab() to actually create a new tab.
PLGUI_API void PLGui::TabBar::CloseTab ( TabBarEntry pTab)

Close tab.

Parameters:
[in]pTabTab
Remarks:
See CloseTab(PLCore::uint32 nTab)
PLGUI_API void PLGui::TabBar::CloseTab ( PLCore::uint32  nTab)

Close tab.

Parameters:
[in]nTabTab index
Remarks:
CloseTab creates an event saying that the given tab shall be closed (the same as when the used has actually clicked on the tab's 'x'-button). This does not automatically remove the tab but only generate the event. Do actually remove a tab, use RemoveTab().

Get list of tabs.

Returns:
List of tabs
PLGUI_API TabBarEntry* PLGui::TabBar::AddTab ( const PLCore::String sText)

Add tab.

Parameters:
[in]sTextTab text
Returns:
New tab entry
PLGUI_API TabBarEntry* PLGui::TabBar::AddTab ( const PLCore::String sText,
const Image cIcon 
)

Add tab.

Parameters:
[in]sTextTab text
[in]cIconImage
Returns:
New tab entry
PLGUI_API bool PLGui::TabBar::RemoveTab ( TabBarEntry pTab)

Remove tab.

Parameters:
[in]pTabTab
Returns:
'true' if all went fine, else 'false'
PLGUI_API bool PLGui::TabBar::RemoveTab ( PLCore::uint32  nTab)

Remove tab.

Parameters:
[in]nTabTab index
Returns:
'true' if all went fine, else 'false'
PLGUI_API int PLGui::TabBar::GetSelection ( ) const

Get currently selected tab.

Returns:
Index of currently selected tab
PLGUI_API void PLGui::TabBar::SetSelection ( int  nTab)

Set currently selected tab.

Parameters:
[in]nTabIndex of currently selected tab
PLGUI_API int PLGui::TabBar::GetScrollingPos ( ) const

Get scrolling position.

Returns:
Index of first visible tab
PLGUI_API void PLGui::TabBar::SetScrollingPos ( int  nTab)

Set scrolling position.

Parameters:
[in]nTabIndex of first visible tab
PLGUI_API int PLGui::TabBar::GetMouseSelection ( ) const

Get tab that is currently selected by the mouse.

Returns:
Index of currently selected tab
PLGUI_API void PLGui::TabBar::RedrawTab ( int  nTab) [protected]

Redraw tab.

Parameters:
[in]nTabIndex of tab
PLGUI_API void PLGui::TabBar::SetMouseSelection ( int  nTab) [protected]

Set tab that is currently selected by the mouse.

Parameters:
[in]nTabIndex of currently selected tab
virtual PLGUI_API PLMath::Vector2i PLGui::TabBar::OnPreferredSize ( const PLMath::Vector2i vRefSize) const [protected, virtual]

Called when the widget is to calculate it's preferred size.

Parameters:
[in]vRefSizePrecalculated reference size, can be (-1, -1) if no reference size is available
Returns:
Preferred size
Remarks:
If the widget returns -1 in a component (X/Y), it means that there is no preferred size in that direction. A layout will in that case use 'as much space as possible', while the FitSize() functions will use the current size.

Reimplemented from PLGui::Widget.

virtual PLGUI_API void PLGui::TabBar::OnAdjustContent ( ) [protected, virtual]

Called when the widget content has to be adjusted.

Reimplemented from PLGui::Widget.

virtual PLGUI_API void PLGui::TabBar::OnAddTab ( TabBarEntry pTab) [protected, virtual]

Called when a new tab is added.

Parameters:
[in]pTabTab
virtual PLGUI_API void PLGui::TabBar::OnRemoveTab ( TabBarEntry pTab) [protected, virtual]

Called when a tab is removed.

Parameters:
[in]pTabTab
virtual PLGUI_API void PLGui::TabBar::OnCloseTab ( TabBarEntry pTab) [protected, virtual]

Called when a tab shall be closed.

Parameters:
[in]pTabTab
virtual PLGUI_API void PLGui::TabBar::OnSelectTab ( int  nTab) [protected, virtual]

Called when the current selection has been changed.

Parameters:
[in]nTabIndex of currently selected tab
virtual PLGUI_API void PLGui::TabBar::OnCreateTab ( ) [protected, virtual]

Called when a new tab shall be created.


Member Data Documentation

New tab is added

Tab is removed

Tab is to be closed

Current selection has been changed

New tab shall be created

Side the tabbar is positioned on

PLCore::uint32 PLGui::TabBar::m_nOptions

TabBar options (ETabBarOption)

Tab width

Tab height

List of tabs

Index of currently selected tab

Index of tab currently selected by the mouse

First displayed tab (scrolling)

Button to create a new tab

Button to scroll (next)

Button to scroll (previous)


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:32
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported