TGUI  v0.6.10
Public Types | Public Member Functions | List of all members
tgui::Tab Class Reference
Inheritance diagram for tgui::Tab:
tgui::Widget tgui::Transformable tgui::CallbackManager

Public Types

- Public Types inherited from tgui::Widget

Public Member Functions

 Tab ()
 Default constructor. More...
 
 Tab (const Tab &copy)
 Copy constructor. More...
 
virtual ~Tab ()
 Destructor. More...
 
Taboperator= (const Tab &right)
 Overload of assignment operator. More...
 
bool load (const std::string &configFileFilename, const std::string &sectionName="Tab")
 Loads the widget. More...
 
const std::string & getLoadedConfigFile () const
 Returns the filename of the config file that was used to load the widget. More...
 
virtual void setSize (float width, float height)
 This function currently does nothing. More...
 
virtual sf::Vector2f getSize () const
 Returns the size of the tabs. More...
 
unsigned int add (const sf::String &name, bool select=true)
 Adds a new tab. More...
 
void select (const sf::String &name)
 Selects the tab with a given name. More...
 
void select (unsigned int index)
 Selects the tab with a given index. More...
 
void deselect ()
 Deselects the selected tab. More...
 
void remove (const sf::String &name)
 Removes a tab with a given name. More...
 
void remove (unsigned int index)
 Removes a tab with a given index. More...
 
void removeAll ()
 Removes all tabs. More...
 
sf::String getSelected () const
 Get the name of the currently selected tab. More...
 
int getSelectedIndex () const
 Get the index of the currently selected tab. More...
 
void setTextFont (const sf::Font &font)
 Changes the font of the tabs. More...
 
const sf::Font * getTextFont () const
 Returns the font of the tabs. More...
 
void setTextColor (const sf::Color &color)
 Set the text color that will be used inside the tabs. More...
 
const sf::Color & getTextColor () const
 Get the text color that is currently being used inside the tabs. More...
 
void setSelectedTextColor (const sf::Color &color)
 Set the text color that will be used for the selected tab. More...
 
const sf::Color & getSelectedTextColor () const
 Get the text color that is currently being used for the selected tab. More...
 
void setTextSize (unsigned int size)
 Changes the character size of the text. More...
 
unsigned int getTextSize () const
 Returns the character size of the text. More...
 
void setTabHeight (unsigned int height)
 Changes the height of the tabs. More...
 
unsigned int getTabHeight () const
 Returns the height of the tabs. More...
 
void setMaximumTabWidth (unsigned int maximumWidth)
 Changes the maximum tab width of the tabs. More...
 
unsigned int getMaximumTabWidth () const
 Returns the maximum tab width of the tabs. More...
 
void setDistanceToSide (unsigned int distanceToSide)
 Changes the distance between the text and the side of the tab. More...
 
unsigned int getDistanceToSide () const
 Returns the distance between the text and the side of the tab. More...
 
virtual void setTransparency (unsigned char transparency)
 Changes the transparency of the widget. More...
 
- Public Member Functions inherited from tgui::Widget
 Widget ()
 Default constructor. More...
 
 Widget (const Widget &copy)
 Copy constructor. More...
 
virtual ~Widget ()
 Destructor. More...
 
Widgetoperator= (const Widget &right)
 Overload of assignment operator. More...
 
virtual sf::Vector2f getAbsolutePosition () const
 Get the absolute position of the widget on the screen. More...
 
virtual void show ()
 Shows the widget. More...
 
virtual void hide ()
 Hides the widget. More...
 
bool isVisible () const
 Returns true when the widget is visible. More...
 
virtual void enable ()
 Enables the widget. More...
 
virtual void disable ()
 Disables the widget. More...
 
bool isEnabled () const
 Returns true when the widget is enabled. More...
 
bool isDisabled () const
 Returns true when the widget is disabled. More...
 
bool isLoaded () const
 Returns true when the widget is loaded successfully. More...
 
virtual void focus ()
 Focus the widget. More...
 
virtual void unfocus ()
 Unfocus the widget. More...
 
bool isFocused () const
 Returns true when the widget is focused and false otherwise. More...
 
WidgetTypes getWidgetType () const
 Returns the type of the widget. More...
 
ContainergetParent () const
 Returns a pointer to the parent widget. More...
 
unsigned char getTransparency () const
 Returns the transparency of the widget. More...
 
virtual void moveToFront ()
 Places the widget before all other widgets. More...
 
virtual void moveToBack ()
 Places the widget behind all other widgets. More...
 
void setCallbackId (unsigned int callbackId)
 Changes the callback id of the widget. More...
 
unsigned int getCallbackId ()
 Returns the callback id of the widget. More...
 
- Public Member Functions inherited from tgui::Transformable
 Transformable ()
 Default constructor. More...
 
virtual ~Transformable ()
 Destructor. More...
 
virtual void setPosition (float x, float y)
 Set the position of the widget. More...
 
void setPosition (const sf::Vector2f &position)
 set the position of the widget More...
 
const sf::Vector2f & getPosition () const
 get the position of the widget More...
 
void move (float offsetX, float offsetY)
 Move the widget by a given offset. More...
 
void move (const sf::Vector2f &offset)
 Move the widget by a given offset. More...
 
virtual sf::Vector2f getFullSize () const
 Returns the entire size that the widget is using. More...
 
void scale (float factorX, float factorY)
 Scale the widget. More...
 
void scale (const sf::Vector2f &factors)
 Scale the widget. More...
 
- Public Member Functions inherited from tgui::CallbackManager
void bindCallback (std::function< void()> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallback (void(T::*func)(), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallbackEx (std::function< void(const Callback &)> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallbackEx (void(T::*func)(const Callback &), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallback (unsigned int trigger)
 Bind one or more specific callback trigger(s) to the parent widget. More...
 
void unbindCallback (unsigned int trigger)
 Unbind all callback function bound to the given trigger. More...
 
void unbindAllCallback ()
 Unbind all callback functions bound to any callback. More...
 

Member Enumeration Documentation

Defines specific triggers to Tab.

Enumerator
TabChanged 

Current Tab changed.

AllTabCallbacks 

All triggers defined in Tab and its base classes.

Constructor & Destructor Documentation

tgui::Tab::Tab ( )

Default constructor.

tgui::Tab::Tab ( const Tab copy)

Copy constructor.

Parameters
copyInstance to copy
virtual tgui::Tab::~Tab ( )
virtual

Destructor.

Member Function Documentation

unsigned int tgui::Tab::add ( const sf::String &  name,
bool  select = true 
)

Adds a new tab.

Parameters
nameThe name of the tab (this is the text that will be drawn on top of the tab).
selectDo you want the new tab to be selected immediately?
Returns
The index of the tab in the list.
Warning
The index returned by this function may no longer be correct when a tab is removed.
void tgui::Tab::deselect ( )

Deselects the selected tab.

unsigned int tgui::Tab::getDistanceToSide ( ) const

Returns the distance between the text and the side of the tab.

Returns
distance between the text and the side of the tab
const std::string& tgui::Tab::getLoadedConfigFile ( ) const

Returns the filename of the config file that was used to load the widget.

Returns
Filename of loaded config file. Empty string when no config file was loaded yet.
unsigned int tgui::Tab::getMaximumTabWidth ( ) const

Returns the maximum tab width of the tabs.

Returns
Maximum tab width

If the text on the tab is longer than this width then it will be cropped to fit inside the tab. By default, the maximum width is 0 which means that there is no limitation.

sf::String tgui::Tab::getSelected ( ) const

Get the name of the currently selected tab.

Returns
The name of the tab. When no tab is selected then this function returns an empty string.
int tgui::Tab::getSelectedIndex ( ) const

Get the index of the currently selected tab.

Returns
The index of the tab. When no tab is selected then this function returns -1.
Warning
The index returned by this function may no longer be correct when a tab is removed.
const sf::Color& tgui::Tab::getSelectedTextColor ( ) const

Get the text color that is currently being used for the selected tab.

Returns
The text color that is currently being used.
virtual sf::Vector2f tgui::Tab::getSize ( ) const
virtual

Returns the size of the tabs.

Returns
Size of the tabs

Implements tgui::Transformable.

unsigned int tgui::Tab::getTabHeight ( ) const

Returns the height of the tabs.

Returns
Tab height
const sf::Color& tgui::Tab::getTextColor ( ) const

Get the text color that is currently being used inside the tabs.

Returns
The text color that is currently being used.
const sf::Font* tgui::Tab::getTextFont ( ) const

Returns the font of the tabs.

Returns
Pointer to the font that is currently being used.
unsigned int tgui::Tab::getTextSize ( ) const

Returns the character size of the text.

Returns
The text size.
bool tgui::Tab::load ( const std::string &  configFileFilename,
const std::string &  sectionName = "Tab" 
)

Loads the widget.

Parameters
configFileFilenameFilename of the config file.
sectionNameName of the section in the file to load

The config file must contain a Tab section with the needed information.

Tab& tgui::Tab::operator= ( const Tab right)

Overload of assignment operator.

Parameters
rightInstance to assign
Returns
Reference to itself
void tgui::Tab::remove ( const sf::String &  name)

Removes a tab with a given name.

Parameters
nameThe name of the tab to remove.

When multiple tabs have the same name, only the first will be removed.

See also
remove(unsigned int)
void tgui::Tab::remove ( unsigned int  index)

Removes a tab with a given index.

Parameters
indexThe index of the tab to remove.

When the index is too high then nothing will happen.

See also
remove(sf::String)
void tgui::Tab::removeAll ( )

Removes all tabs.

void tgui::Tab::select ( const sf::String &  name)

Selects the tab with a given name.

Parameters
nameThe name of the tab to select.

When the name doen't match any tab then nothing will be changed. If there are multiple tabs with the same name then the first one will be selected.

See also
select(int)
void tgui::Tab::select ( unsigned int  index)

Selects the tab with a given index.

Parameters
indexThe index of the tab to select.

When the index is too high then nothing will happen.

See also
select(sf::String)
void tgui::Tab::setDistanceToSide ( unsigned int  distanceToSide)

Changes the distance between the text and the side of the tab.

Parameters
distanceToSidedistance between the text and the side of the tab
void tgui::Tab::setMaximumTabWidth ( unsigned int  maximumWidth)

Changes the maximum tab width of the tabs.

Parameters
maximumWidthMaximum width of a single tab

If the text on the tab is longer than this width then it will be cropped to fit inside the tab. By default, the maximum width is 0 which means that there is no limitation.

void tgui::Tab::setSelectedTextColor ( const sf::Color &  color)

Set the text color that will be used for the selected tab.

Parameters
colorThe new text color.
virtual void tgui::Tab::setSize ( float  width,
float  height 
)
virtual

This function currently does nothing.

Parameters
widthCurrently ignored
heightCurrently ignored

It is not yet possible to change the size directly.

See also
setTabHeight
setDistanceToSide
setMaximumTabWidth

Implements tgui::Transformable.

void tgui::Tab::setTabHeight ( unsigned int  height)

Changes the height of the tabs.

Parameters
heightHeight of the tabs

By default, it is the height of the tab image that is loaded with the load function.

void tgui::Tab::setTextColor ( const sf::Color &  color)

Set the text color that will be used inside the tabs.

Parameters
colorThe new text color.
void tgui::Tab::setTextFont ( const sf::Font &  font)

Changes the font of the tabs.

When you don't call this function then the global font will be use. This global font can be changed with the setGlobalFont function from the parent.

Parameters
fontThe new font.
void tgui::Tab::setTextSize ( unsigned int  size)

Changes the character size of the text.

Parameters
sizeThe new size of the text. If the size is 0 (default) then the text will be scaled to fit in the tab.
virtual void tgui::Tab::setTransparency ( unsigned char  transparency)
virtual

Changes the transparency of the widget.

Parameters
transparencyThe transparency of the widget. 0 is completely transparent, while 255 (default) means fully opaque.

Note that this will only change the transparency of the images. The parts of the widgets that use a color will not be changed. You must change them yourself by setting the alpha channel of the color.

Reimplemented from tgui::Widget.


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