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:

Ogre::Singleton< GuiManager > List of all members.

Public Methods

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

GuiElement * getGuiElement (const String &name, bool isTemplate=false)
 Gets a reference to an existing element. More...

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

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

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

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

GuiElement * createGuiElementFromTemplate (const String &templateName, const String &typeName, const String &instanceName, bool isTemplate=false)
GuiElement * createGuiElementFromFactory (const String &typeName, const String &instanceName)

Static Public Methods

GuiManager & getSingleton (void)
 Override standard Singleton retrieval. More...

GuiManager * getSingletonPtr (void)

Protected Types

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

Protected Methods

ElementMap & getElementMap (bool isTemplate)
GuiElement * createGuiElementImpl (const String &typeName, const String &instanceName, ElementMap &elementMap)
GuiElement * getGuiElementImpl (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.


Member Typedef Documentation

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

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


Constructor & Destructor Documentation

Ogre::GuiManager::GuiManager (    ) 
 

Ogre::GuiManager::~GuiManager (    )  [virtual]
 


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.

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.

GuiElement * Ogre::GuiManager::createGuiElementFromFactory (  const String &    typeName,
const String &    instanceName
) 
 

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

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

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.

void Ogre::GuiManager::destroyAllGuiElementsImpl (  ElementMap &    elementMap )  [protected]
 

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.

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.

void Ogre::GuiManager::destroyGuiElementImpl (  GuiElement *    pInstance,
ElementMap &    elementMap
)  [protected]
 

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

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

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

Gets a reference to an existing element.

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

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 >.

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


Member Data Documentation

FactoryMap Ogre::GuiManager::mFactories [protected]
 

ElementMap Ogre::GuiManager::mInstances [protected]
 

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

ElementMap Ogre::GuiManager::mTemplates [protected]
 

Copyright © 2002 by The OGRE Team