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:

[legend]
List of all members.

## Public Types

typedef std::map< String, GuiElement * > | ElementMap
typedef MapIterator< ElementMap > | TemplateIterator

## Public Methods

| GuiManager ()
virtual | ~GuiManager ()
GuiElement * | createGuiElement (const String &typeName, const String &instanceName, bool isTemplate=false)
| Creates a new GuiElement of the type requested.
GuiElement * | getGuiElement (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.
GuiElement * | createGuiElementFromTemplate (const String &templateName, const String &typeName, const String &instanceName, bool isTemplate=false)
GuiElement * | cloneGuiElementFromTemplate (const String &templateName, const String &instanceName)
GuiElement * | createGuiElementFromFactory (const String &typeName, const String &instanceName)
TemplateIterator | getTemplateIterator ()
| Returns an iterator over all templates in this manager.
bool | isTemplate (String strName) const

## Static Public Methods

GuiManager & | getSingleton (void)
| Override standard Singleton retrieval.
GuiManager * | getSingletonPtr (void)
| Override standard Singleton retrieval.

## Protected Types

typedef std::map< String, GuiElementFactory * > | FactoryMap

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

Definition at line 40 of file OgreGuiManager.h.

## Member Typedef Documentation

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

| Definition at line 98 of file OgreGuiManager.h.

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

| Definition at line 143 of file OgreGuiManager.h.

typedef MapIterator<ElementMap> Ogre::GuiManager::TemplateIterator

| Definition at line 99 of file OgreGuiManager.h.

## Constructor & Destructor Documentation

Ogre::GuiManager::GuiManager | ( |  | ) |

| Definition at line 49 of file OgreGuiManager.cpp.

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

| Definition at line 53 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 237 of file OgreGuiManager.cpp.

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

GuiElement * Ogre::GuiManager::cloneGuiElementFromTemplate | ( | const String & | templateName,
|  | const String & | instanceName
| ) |

Remarks:
  Creates a new GuiElement object from the specified template name. The new object's name, and all of it's children, will be instanceName/orignalName.

Definition at line 100 of file OgreGuiManager.cpp.

References Ogre::GuiElement::clone(), getGuiElement(), and Ogre::String.

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 107 of file OgreGuiManager.cpp.

References createGuiElementImpl(), getElementMap(), isTemplate(), and Ogre::String.

Referenced by createGuiElementFromTemplate().

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

| Definition at line 134 of file OgreGuiManager.cpp. References Except, mFactories, and Ogre::String. Referenced by createGuiElementImpl().

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

| Definition at line 66 of file OgreGuiManager.cpp. References createGuiElement(), getGuiElement(), Ogre::GuiElement::getTypeName(), isTemplate(), and Ogre::String.

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

| Definition at line 113 of file OgreGuiManager.cpp. References createGuiElementFromFactory(), Except, Ogre::GuiElement::initialise(), and Ogre::String. 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 201 of file OgreGuiManager.cpp.

References destroyAllGuiElementsImpl(), getElementMap(), and isTemplate().

Referenced by ~GuiManager().

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

| Definition at line 206 of file OgreGuiManager.cpp. References Ogre::GuiContainer::_removeChild(), Except, Ogre::GuiElement::getName(), Ogre::GuiElement::getParent(), Ogre::GuiElement::getTypeName(), 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 173 of file OgreGuiManager.cpp.

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

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 167 of file OgreGuiManager.cpp.

References destroyGuiElementImpl(), getElementMap(), isTemplate(), and Ogre::String.

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

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

| Definition at line 179 of file OgreGuiManager.cpp. References Except, mFactories, and Ogre::String. Referenced by destroyGuiElement().

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

| Definition at line 60 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 149 of file OgreGuiManager.cpp. References getElementMap(), getGuiElementImpl(), isTemplate(), and Ogre::String. Referenced by cloneGuiElementFromTemplate(), and createGuiElementFromTemplate().

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

| Definition at line 154 of file OgreGuiManager.cpp. References Except, and Ogre::String. 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 44 of file OgreGuiManager.cpp.

References Ogre::Singleton< GuiManager >::ms_Singleton.

GuiManager * Ogre::GuiManager::getSingletonPtr | ( | 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 40 of file OgreGuiManager.cpp.

References Ogre::Singleton< GuiManager >::ms_Singleton.

TemplateIterator Ogre::GuiManager::getTemplateIterator | ( |  | ) |

| Returns an iterator over all templates in this manager. Definition at line 101 of file OgreGuiManager.h.

bool Ogre::GuiManager::isTemplate | ( | String | strName | ) | const

| Definition at line 106 of file OgreGuiManager.h. References Ogre::String. Referenced by createGuiElement(), createGuiElementFromTemplate(), destroyAllGuiElements(), destroyGuiElement(), and getGuiElement().

## Member Data Documentation

FactoryMap Ogre::GuiManager::mFactories`[protected]`

| Definition at line 144 of file OgreGuiManager.h. Referenced by addGuiElementFactory(), createGuiElementFromFactory(), destroyAllGuiElementsImpl(), and destroyGuiElementImpl().

ElementMap Ogre::GuiManager::mInstances`[protected]`

| Definition at line 146 of file OgreGuiManager.h. Referenced by getElementMap().

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

| Definition at line 39 of file OgreGuiManager.cpp. Referenced by getSingleton(), and getSingletonPtr().

ElementMap Ogre::GuiManager::mTemplates`[protected]`

| Definition at line 147 of file OgreGuiManager.h. Referenced by getElementMap().

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

- OgreGuiManager.h
- OgreGuiManager.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:51:02 2004