26 #ifndef _TGUI_GROUP_INCLUDED_
27 #define _TGUI_GROUP_INCLUDED_
49 Group(
const Group& copy);
61 Group& operator= (
const Group& right);
73 T*
add(
const sf::String& objectName =
"")
75 T* newObject =
new T();
76 newObject->m_Parent =
this;
77 m_EventManager.m_Objects.push_back(newObject);
78 m_ObjName.push_back(objectName);
80 newObject->initialize();
100 template <
typename T>
101 T*
get(
const sf::String& objectName)
const
103 for (
unsigned int i=0; i<m_ObjName.size(); ++i)
105 if (m_ObjName[i].toWideString().compare(objectName) == 0)
106 return static_cast<T*>(m_EventManager.m_Objects[i]);
122 template <
typename T>
123 T*
copy(T* oldObject,
const sf::String& newObjectName =
"")
125 T* newObject =
new T(*oldObject);
127 m_EventManager.m_Objects.push_back(newObject);
128 m_ObjName.push_back(newObjectName);
145 template <
typename T>
146 T*
copy(
const sf::String& oldObjectName,
const sf::String& newObjectName =
"")
148 for (
unsigned int i=0; i<m_ObjName.size(); ++i)
150 if (m_ObjName[i].toWideString().compare(oldObjectName) == 0)
152 T* newObject =
new T(*static_cast<T*>(m_EventManager.m_Objects[i]));
154 m_EventManager.m_Objects.push_back(newObject);
155 m_ObjName.push_back(newObjectName);
177 virtual bool loadObjectsFromFile(
const std::string& filename);
183 virtual std::vector<OBJECT*>& getObjects();
189 virtual std::vector<sf::String>& getObjectNames();
199 virtual void remove(
const sf::String& objectName);
207 virtual void remove(
OBJECT* object);
213 virtual void removeAllObjects();
227 virtual void focusObject(
OBJECT*
const object);
241 virtual void unfocusObject(
OBJECT*
const object);
251 virtual void unfocusAllObjects();
257 virtual void uncheckRadioButtons();
265 virtual void addCallback(
const Callback& callback) = 0;
271 virtual void updateTime(
const sf::Time& elapsedTime);
277 virtual void moveObjectToFront(
OBJECT*
object);
283 virtual void moveObjectToBack(
OBJECT*
object);
292 virtual void drawObjectGroup(sf::RenderTarget* target,
const sf::RenderStates& states = sf::RenderStates::Default)
const;
305 std::vector<sf::String> m_ObjName;
308 EventManager m_EventManager;
322 #endif //_TGUI_GROUP_INCLUDED_
When you receive an action callback from an object then this struct will be passed as parameter...
Definition: Objects.hpp:362
The parent struct for every object.
Definition: Objects.hpp:36
Parent struct for objects that store multiple objects.
Definition: Group.hpp:38
T * copy(T *oldObject, const sf::String &newObjectName="")
Makes a copy of any existing object and returns the pointer to the new object.
Definition: Group.hpp:123
T * add(const sf::String &objectName="")
Creates and adds an object to the group.
Definition: Group.hpp:73
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.
Definition: Group.hpp:146
sf::Font globalFont
The internal font, used by all objects by default. If not changed then this is the default SFML font...
Definition: Group.hpp:299