TGUI  v0.5.2
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Public Member Functions | Public Attributes | List of all members
tgui::Group Struct Referenceabstract

Parent struct for objects that store multiple objects. More...

#include <Group.hpp>

Inheritance diagram for tgui::Group:
tgui::Form tgui::GroupObject tgui::Window tgui::Grid tgui::Panel tgui::ChildWindow

Public Member Functions

 Group ()
 Default constructor. More...
 
 Group (const Group &copy)
 Copy constructor. More...
 
virtual ~Group ()
 Destructor. More...
 
Groupoperator= (const Group &right)
 Overload of assignment operator. More...
 
template<typename T >
T * add (const sf::String &objectName="")
 Creates and adds an object to the group. More...
 
template<typename T >
T * get (const sf::String &objectName) const
 Returns a pointer to an earlier created object. More...
 
template<typename T >
T * copy (T *oldObject, const sf::String &newObjectName="")
 Makes a copy of any existing object and returns the pointer to the new object. More...
 
template<typename T >
T * copy (const sf::String &oldObjectName, const sf::String &newObjectName="")
 Makes a copy of any existing object and returns the pointer to the new object. More...
 
virtual bool loadObjectsFromFile (const std::string &filename)
 Loads a form from a file. More...
 
virtual std::vector< OBJECT * > & getObjects ()
 Returns a list of all the objects. More...
 
virtual std::vector< sf::String > & getObjectNames ()
 Returns a list of the names of all the objects. More...
 
virtual void remove (const sf::String &objectName)
 Removes a single object that was added to the group. More...
 
virtual void remove (OBJECT *object)
 Removes a single object that was added to the group. More...
 
virtual void removeAllObjects ()
 Removes all objects that were added to the group. More...
 
virtual void focusObject (OBJECT *const object)
 Focuses an object. More...
 
virtual void unfocusObject (OBJECT *const object)
 Unfocuses an object. More...
 
virtual void unfocusAllObjects ()
 Unfocuses all the objects. More...
 
virtual void uncheckRadioButtons ()
 Uncheck all the radio buttons. More...
 
virtual void addCallback (const Callback &callback)=0
 Adds a callback to the list in tgui::Window. More...
 
virtual void updateTime (const sf::Time &elapsedTime)
 Update the internal clock to make animation possible. More...
 
virtual void moveObjectToFront (OBJECT *object)
 Places an object before all other objects. More...
 
virtual void moveObjectToBack (OBJECT *object)
 Places an object behind all other objects. More...
 

Public Attributes

sf::Font globalFont
 The internal font, used by all objects by default. If not changed then this is the default SFML font. More...
 

Detailed Description

Parent struct for objects that store multiple objects.

Constructor & Destructor Documentation

tgui::Group::Group ( )

Default constructor.

tgui::Group::Group ( const Group copy)

Copy constructor.

virtual tgui::Group::~Group ( )
virtual

Destructor.

Member Function Documentation

template<typename T >
T* tgui::Group::add ( const sf::String &  objectName = "")
inline

Creates and adds an object to the group.

Parameters
objectNameIf you want to access the object later then you must do this with this name.

Usage example:

tgui::Picture* pic = group.add<tgui::Picture>("picName");
virtual void tgui::Group::addCallback ( const Callback callback)
pure virtual

Adds a callback to the list in tgui::Window.

This callback can be obtained by calling the getCallback function of the window.

Implemented in tgui::Grid, tgui::Panel, tgui::Window, and tgui::Form.

template<typename T >
T* tgui::Group::copy ( T *  oldObject,
const sf::String &  newObjectName = "" 
)
inline

Makes a copy of any existing object and returns the pointer to the new object.

Parameters
oldObjectA pointer to the old object.
newObjectNameIf you want to access the object later then you must do this with this name.

Usage example:

tgui::Picture* pic = group.copy(pictureToCopy, "NameOfNewPic");
template<typename T >
T* tgui::Group::copy ( const sf::String &  oldObjectName,
const sf::String &  newObjectName = "" 
)
inline

Makes a copy of any existing object and returns the pointer to the new object.

Parameters
oldObjectNameThe name that was given to the object when it was added to the group.
newObjectNameIf you want to access the copied object later then you must do this with this name.
Warning
This function will return NULL when an unknown object name was passed.

Usage example:

tgui::Picture* pic = group.copy<tgui::Picture>("PicToCopy", "NameOfNewPic");
virtual void tgui::Group::focusObject ( OBJECT *const  object)
virtual

Focuses an object.

The previously focused object will be unfocused.

Parameters
objectThe object that has to be focused.
See Also
unfocusObject
unfocusAllObjects
template<typename T >
T* tgui::Group::get ( const sf::String &  objectName) const
inline

Returns a pointer to an earlier created object.

Parameters
objectNameThe name that was given to the object when it was added to the group.
Warning
Make sure that the name belongs to the object you are trying to get. Behaviour is undefined when e.g. calling this function to get a picture but when passing a name that was given to a button.
This function will return NULL when an unknown object name was passed.

Usage example:

tgui::Picture* pic = group.get<tgui::Picture>("picName");
virtual std::vector<sf::String>& tgui::Group::getObjectNames ( )
virtual

Returns a list of the names of all the objects.

virtual std::vector<OBJECT*>& tgui::Group::getObjects ( )
virtual

Returns a list of all the objects.

virtual bool tgui::Group::loadObjectsFromFile ( const std::string &  filename)
virtual

Loads a form from a file.

The objects will be loaded and added to the group. Note that even when this function fails, some objects might have been loaded already.

Returns
  • true on success
  • false when the file could not be opened
  • false when the file contains a mistake
  • false when one of the objects couldn't be loaded
virtual void tgui::Group::moveObjectToBack ( OBJECT object)
virtual

Places an object behind all other objects.

virtual void tgui::Group::moveObjectToFront ( OBJECT object)
virtual

Places an object before all other objects.

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

Overload of assignment operator.

virtual void tgui::Group::remove ( const sf::String &  objectName)
virtual

Removes a single object that was added to the group.

If there are multiple objects with the same name then only the first matching object will be removed.

See Also
remove(OBJECT*)
virtual void tgui::Group::remove ( OBJECT object)
virtual

Removes a single object that was added to the group.

See Also
remove(sf::String)

Reimplemented in tgui::Grid.

virtual void tgui::Group::removeAllObjects ( )
virtual

Removes all objects that were added to the group.

Reimplemented in tgui::Grid.

virtual void tgui::Group::uncheckRadioButtons ( )
virtual

Uncheck all the radio buttons.

virtual void tgui::Group::unfocusAllObjects ( )
virtual

Unfocuses all the objects.

See Also
focusObject
unfocusObject
virtual void tgui::Group::unfocusObject ( OBJECT *const  object)
virtual

Unfocuses an object.

The next object will be focused.

Parameters
objectThe object that has to be unfocused.
See Also
focusObject
unfocusAllObjects
virtual void tgui::Group::updateTime ( const sf::Time &  elapsedTime)
virtual

Update the internal clock to make animation possible.

Member Data Documentation

sf::Font tgui::Group::globalFont

The internal font, used by all objects by default. If not changed then this is the default SFML font.


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