Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::GuiManager Class Reference

This class acts as a repository and regitrar of overlay components. More...

#include <OgreGuiManager.h>

Inheritance diagram for Ogre::GuiManager:

Inheritance graph
[legend]
Collaboration diagram for Ogre::GuiManager:

Collaboration graph
[legend]
List of all members.

Public Methods

 GuiManager ()
virtual ~GuiManager ()
GuiElementcreateGuiElement (const String &typeName, const String &instanceName, bool isTemplate=false)
 Creates a new GuiElement of the type requested.

GuiElementgetGuiElement (const String &name, bool isTemplate=false)
 Gets a reference to an existing element.

void destroyGuiElement (const String &instanceName, bool isTemplate=false)
 Destroys a GuiElement.

void destroyGuiElement (GuiElement *pInstance, bool isTemplate=false)
 Destroys a GuiElement.

void destroyAllGuiElements (bool isTemplate=false)
 Destroys all the GuiElement created so far.

void addGuiElementFactory (GuiElementFactory *elemFactory)
 Registers a new GuiElementFactory with this manager.

GuiElementcreateGuiElementFromTemplate (const String &templateName, const String &typeName, const String &instanceName, bool isTemplate=false)
GuiElementcreateGuiElementFromFactory (const String &typeName, const String &instanceName)

Static Public Methods

GuiManager & getSingleton (void)
 Override standard Singleton retrieval.

GuiManager * getSingletonPtr (void)

Protected Types

typedef std::map< String,
GuiElementFactory * > 
FactoryMap
typedef std::map< String,
GuiElement * > 
ElementMap

Protected Methods

ElementMapgetElementMap (bool isTemplate)
GuiElementcreateGuiElementImpl (const String &typeName, const String &instanceName, ElementMap &elementMap)
GuiElementgetGuiElementImpl (const String &name, ElementMap &elementMap)
void destroyGuiElementImpl (const String &instanceName, ElementMap &elementMap)
void destroyGuiElementImpl (GuiElement *pInstance, ElementMap &elementMap)
void destroyAllGuiElementsImpl (ElementMap &elementMap)

Protected Attributes

FactoryMap mFactories
ElementMap mInstances
ElementMap mTemplates

Static Protected Attributes

GuiManager * ms_Singleton = 0

Detailed Description

This class acts as a repository and regitrar of overlay components.

Remarks:
GuiManager's job is to manage the lifecycle of GuiElement (subclass) instances, and also to register plugin suppliers of new components.

Definition at line 39 of file OgreGuiManager.h.


Member Typedef Documentation

typedef std::map<String, GuiElement*> Ogre::GuiManager::ElementMap [protected]
 

Definition at line 107 of file OgreGuiManager.h.

typedef std::map<String, GuiElementFactory*> Ogre::GuiManager::FactoryMap [protected]
 

Definition at line 104 of file OgreGuiManager.h.


Constructor & Destructor Documentation

Ogre::GuiManager::GuiManager  
 

Definition at line 39 of file OgreGuiManager.cpp.

Ogre::GuiManager::~GuiManager   [virtual]
 

Definition at line 43 of file OgreGuiManager.cpp.

References destroyAllGuiElements().


Member Function Documentation

void Ogre::GuiManager::addGuiElementFactory GuiElementFactory   elemFactory
 

Registers a new GuiElementFactory with this manager.

Remarks:
Should be used by plugins or other apps wishing to provide a new GuiElement subclass.

Definition at line 210 of file OgreGuiManager.cpp.

References Ogre::GuiElementFactory::getTypeName(), and mFactories.

GuiElement * Ogre::GuiManager::createGuiElement const String   typeName,
const String   instanceName,
bool    isTemplate = false
 

Creates a new GuiElement of the type requested.

Remarks:
The type of element to create is passed in as a string because this allows plugins to register new types of component.
Parameters:
typeName  The type of element to create.
instanceName  The name to give the new instance.

Definition at line 89 of file OgreGuiManager.cpp.

References createGuiElementImpl(), and getElementMap().

Referenced by createGuiElementFromTemplate().

GuiElement * Ogre::GuiManager::createGuiElementFromFactory const String   typeName,
const String   instanceName
 

Definition at line 116 of file OgreGuiManager.cpp.

References Except, and mFactories.

Referenced by createGuiElementImpl().

GuiElement * Ogre::GuiManager::createGuiElementFromTemplate const String   templateName,
const String   typeName,
const String   instanceName,
bool    isTemplate = false
 

Definition at line 56 of file OgreGuiManager.cpp.

References createGuiElement(), getGuiElement(), and Ogre::GuiElement::getTypeName().

GuiElement * Ogre::GuiManager::createGuiElementImpl const String   typeName,
const String   instanceName,
ElementMap   elementMap
[protected]
 

Definition at line 95 of file OgreGuiManager.cpp.

References createGuiElementFromFactory(), Except, and Ogre::GuiElement::initialise().

Referenced by createGuiElement().

void Ogre::GuiManager::destroyAllGuiElements bool    isTemplate = false
 

Destroys all the GuiElement created so far.

Remarks:
Best to leave this to the engine to call internally, there should rarely be a need to call it yourself.

Definition at line 183 of file OgreGuiManager.cpp.

References destroyAllGuiElementsImpl(), and getElementMap().

Referenced by ~GuiManager().

void Ogre::GuiManager::destroyAllGuiElementsImpl ElementMap   elementMap [protected]
 

Definition at line 188 of file OgreGuiManager.cpp.

References Except, and mFactories.

Referenced by destroyAllGuiElements().

void Ogre::GuiManager::destroyGuiElement GuiElement   pInstance,
bool    isTemplate = false
 

Destroys a GuiElement.

Remarks:
Make sure you're not still using this in an Overlay. If in doubt, let OGRE destroy elements on shutdown.

Definition at line 155 of file OgreGuiManager.cpp.

References destroyGuiElementImpl(), getElementMap(), and Ogre::GuiElement::getName().

void Ogre::GuiManager::destroyGuiElement const String   instanceName,
bool    isTemplate = false
 

Destroys a GuiElement.

Remarks:
Make sure you're not still using this in an Overlay. If in doubt, let OGRE destroy elements on shutdown.

Definition at line 149 of file OgreGuiManager.cpp.

References destroyGuiElementImpl(), and getElementMap().

void Ogre::GuiManager::destroyGuiElementImpl GuiElement   pInstance,
ElementMap   elementMap
[protected]
 

void Ogre::GuiManager::destroyGuiElementImpl const String   instanceName,
ElementMap   elementMap
[protected]
 

Definition at line 161 of file OgreGuiManager.cpp.

References Except, and mFactories.

Referenced by destroyGuiElement().

GuiManager::ElementMap & Ogre::GuiManager::getElementMap bool    isTemplate [protected]
 

Definition at line 50 of file OgreGuiManager.cpp.

References mInstances, and mTemplates.

Referenced by createGuiElement(), destroyAllGuiElements(), destroyGuiElement(), and getGuiElement().

GuiElement * Ogre::GuiManager::getGuiElement const String   name,
bool    isTemplate = false
 

Gets a reference to an existing element.

Definition at line 131 of file OgreGuiManager.cpp.

References getElementMap(), and getGuiElementImpl().

Referenced by createGuiElementFromTemplate().

GuiElement * Ogre::GuiManager::getGuiElementImpl const String   name,
ElementMap   elementMap
[protected]
 

Definition at line 136 of file OgreGuiManager.cpp.

References Except.

Referenced by getGuiElement().

GuiManager & Ogre::GuiManager::getSingleton void    [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< GuiManager >.

Definition at line 219 of file OgreGuiManager.cpp.

GuiManager* Ogre::Singleton< GuiManager >::getSingletonPtr void    [static, inherited]
 

Definition at line 71 of file OgreSingleton.h.


Member Data Documentation

FactoryMap Ogre::GuiManager::mFactories [protected]
 

Definition at line 105 of file OgreGuiManager.h.

Referenced by addGuiElementFactory(), createGuiElementFromFactory(), destroyAllGuiElementsImpl(), and destroyGuiElementImpl().

ElementMap Ogre::GuiManager::mInstances [protected]
 

Definition at line 108 of file OgreGuiManager.h.

Referenced by getElementMap().

GuiManager * Ogre::Singleton< GuiManager >::ms_Singleton = 0 [static, protected, inherited]
 

Definition at line 37 of file OgreGuiManager.cpp.

ElementMap Ogre::GuiManager::mTemplates [protected]
 

Definition at line 109 of file OgreGuiManager.h.

Referenced by getElementMap().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:17:43 2004