00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef __GuiManager_H__ 00027 #define __GuiManager_H__ 00028 00029 #include "OgrePrerequisites.h" 00030 #include "OgreSingleton.h" 00031 #include "OgreIteratorWrappers.h" 00032 00033 namespace Ogre { 00034 00040 class _OgreExport GuiManager : public Singleton<GuiManager> 00041 { 00042 public: 00043 GuiManager(); 00044 virtual ~GuiManager(); 00052 GuiElement* createGuiElement(const String& typeName, const String& instanceName, bool isTemplate = false); 00053 00055 GuiElement* getGuiElement(const String& name, bool isTemplate = false); 00056 00062 void destroyGuiElement(const String& instanceName, bool isTemplate = false); 00063 00069 void destroyGuiElement(GuiElement* pInstance, bool isTemplate = false); 00070 00076 void destroyAllGuiElements(bool isTemplate = false); 00077 00078 00079 00080 00086 void addGuiElementFactory(GuiElementFactory* elemFactory); 00087 00088 GuiElement* createGuiElementFromTemplate(const String& templateName, const String& typeName, const String& instanceName, bool isTemplate = false); 00094 GuiElement* cloneGuiElementFromTemplate(const String& templateName, const String& instanceName); 00095 00096 GuiElement* createGuiElementFromFactory(const String& typeName, const String& instanceName); 00097 00098 typedef std::map<String, GuiElement*> ElementMap; 00099 typedef MapIterator<ElementMap> TemplateIterator; 00101 TemplateIterator getTemplateIterator () 00102 { 00103 return TemplateIterator (mTemplates.begin (), mTemplates.end ()) ; 00104 } 00105 /* Returns whether the Element with the given name is a Template */ 00106 bool isTemplate (String strName) const { 00107 return (mTemplates.find (strName) != mTemplates.end()) ; 00108 } 00109 00125 static GuiManager& getSingleton(void); 00141 static GuiManager* getSingletonPtr(void); 00142 protected: 00143 typedef std::map<String, GuiElementFactory*> FactoryMap; 00144 FactoryMap mFactories; 00145 00146 ElementMap mInstances; 00147 ElementMap mTemplates; 00148 00149 00150 00151 ElementMap& getElementMap(bool isTemplate); 00152 00153 GuiElement* createGuiElementImpl(const String& typeName, const String& instanceName, ElementMap& elementMap); 00154 00155 GuiElement* getGuiElementImpl(const String& name, ElementMap& elementMap); 00156 00157 void destroyGuiElementImpl(const String& instanceName, ElementMap& elementMap); 00158 00159 void destroyGuiElementImpl(GuiElement* pInstance, ElementMap& elementMap); 00160 00161 void destroyAllGuiElementsImpl(ElementMap& elementMap); 00162 00163 }; 00164 00165 00166 00167 } 00168 00169 00170 00171 00172 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:16 2004