TGUI  v0.5.2
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Public Attributes | List of all members
tgui::Tab Struct Reference
Inheritance diagram for tgui::Tab:
tgui::OBJECT

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...
 
virtual bool load (const std::string &pathname)
 Creates the Tab object. More...
 
virtual void setSize (float width, float height)
 Changes the size of a tab. More...
 
virtual Vector2u getSize () const
 Returns the size of the tabs, unaffected by scaling. More...
 
virtual Vector2f getScaledSize () const
 Returns the size of the tabs, after the scaling transformation. More...
 
virtual std::string getLoadedPathname () const
 Returns the pathname that was used to load the tab. More...
 
virtual unsigned int add (const sf::String &name, bool select=true)
 Adds a new tab. More...
 
virtual void select (const sf::String &name)
 Selects the tab with a given name. More...
 
virtual void select (unsigned int index)
 Selects the tab with a given index. More...
 
virtual void deselect ()
 Deselects the selected tab. More...
 
virtual void remove (const sf::String &name)
 Removes a tab with a given name. More...
 
virtual void remove (unsigned int index)
 Removes a tab with a given index. More...
 
virtual void removeAll ()
 Removes all tabs. More...
 
virtual sf::String getSelected () const
 Get the name of the currently selected tab. More...
 
virtual int getSelectedIndex () const
 Get the index of the currently selected tab. More...
 
virtual void setTextFont (const sf::Font &font)
 Changes the font of the tabs. More...
 
virtual const sf::Font * getTextFont () const
 Returns the font of the tabs. More...
 
virtual void setTextColor (const sf::Color &color)
 Set the text color that will be used inside the tabs. More...
 
virtual const sf::Color & getTextColor () const
 Get the text color that is currently being used inside the tabs. More...
 
virtual void setTextSize (unsigned int size)
 Changes the character size of the text. More...
 
virtual unsigned int getTextSize () const
 Returns the character size of the text. More...
 
virtual void setTabHeight (unsigned int height)
 Changes the height of the tabs. More...
 
virtual unsigned int getTabHeight () const
 Returns the height of the tabs. More...
 
- Public Member Functions inherited from tgui::OBJECT
 OBJECT ()
 Default constructor. More...
 
 OBJECT (const OBJECT &copy)
 Copy constructor. More...
 
virtual ~OBJECT ()
 Destructor. More...
 
OBJECToperator= (const OBJECT &right)
 Overload of assignment operator. More...
 
virtual void show ()
 Shows the object. More...
 
virtual void hide ()
 Hides the object. More...
 
virtual bool isVisible () const
 Returns true when the object is visible. More...
 
virtual void enable ()
 Enables the object. More...
 
virtual void disable ()
 Disables the object. More...
 
virtual bool isEnabled () const
 Returns true when the object is enabled. More...
 
virtual bool isDisabled () const
 Returns true when the object is disabled. More...
 
virtual bool isLoaded () const
 Returns true when the object is loaded successfully. More...
 
void focus ()
 Focus the object. More...
 
void unfocus ()
 Unfocus the object. More...
 
void focusNextObject ()
 Focuses the next object. More...
 
virtual bool isFocused () const
 Returns true when the object is focused and false otherwise. More...
 
virtual ObjectTypes getObjectType () const
 Returns the type of the object. More...
 
virtual void moveToFront ()
 Places the object before all other objects. More...
 
virtual void moveToBack ()
 Places the object behind all other objects. More...
 

Public Attributes

unsigned int distanceToSide
 The distance between the side of the tab and the text that is drawn on top of the tab. More...
 
unsigned int maximumTabWidth
 

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

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

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.
virtual void tgui::Tab::deselect ( )
virtual

Deselects the selected tab.

virtual std::string tgui::Tab::getLoadedPathname ( ) const
virtual

Returns the pathname that was used to load the tab.

Returns
Pathname used to load the tab. When the tab has not been loaded yet then this function will return an empty string.
virtual Vector2f tgui::Tab::getScaledSize ( ) const
virtual

Returns the size of the tabs, after the scaling transformation.

Returns
Size of the tabs

Implements tgui::OBJECT.

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

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.
virtual int tgui::Tab::getSelectedIndex ( ) const
virtual

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.
virtual Vector2u tgui::Tab::getSize ( ) const
virtual

Returns the size of the tabs, unaffected by scaling.

Returns
Size of the tabs

Implements tgui::OBJECT.

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

Returns the height of the tabs.

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

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

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

Returns the font of the tabs.

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

Returns the character size of the text.

Returns
The text size.
virtual bool tgui::Tab::load ( const std::string &  pathname)
virtual

Creates the Tab object.

Parameters
pathnameThe path to the folder that contains the images for the tabs. The folder must also contain an info.txt file, which will give more information about the tab.
Returns
  • true on success
  • false when the pathname was empty
  • false when the info.txt file was not found
  • false when the images couldn't be loaded
Tab& tgui::Tab::operator= ( const Tab right)

Overload of assignment operator.

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

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)
virtual void tgui::Tab::remove ( unsigned int  index)
virtual

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)
virtual void tgui::Tab::removeAll ( )
virtual

Removes all tabs.

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

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)
virtual void tgui::Tab::select ( unsigned int  index)
virtual

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)
virtual void tgui::Tab::setSize ( float  width,
float  height 
)
virtual

Changes the size of a tab.

Parameters
widthThe maximum width for a single tab.
heightThe height of all the tabs.

The width parameter will just change maximumTabWidth. The height parameter will just change the tab height with setTabHeight.

See Also
maximumTabWidth
setTabHeight

Implements tgui::OBJECT.

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

Changes the height of the tabs.

Parameters
heightBy default, it is the height of the tab image that is loaded with the load function.
virtual void tgui::Tab::setTextColor ( const sf::Color &  color)
virtual

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

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

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 by changing gloabalFont from the parent.

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

Changes the character size of the text.

Parameters
textSizeThe new size of the text. If the size is 0 (default) then the text will be scaled to fit in the tab.

Member Data Documentation

unsigned int tgui::Tab::distanceToSide

The distance between the side of the tab and the text that is drawn on top of the tab.

unsigned int tgui::Tab::maximumTabWidth

The maximum width of a single tab. By default, this number is 0 which means that there is no limitation.


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