Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CEGUIWindowFactoryManager.h

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIWindowFactoryManager.h
00003         created:        22/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines interface for WindowFactoryManager class
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #ifndef _CEGUIWindowFactoryManager_h_
00027 #define _CEGUIWindowFactoryManager_h_
00028 
00029 #include "CEGUIBase.h"
00030 #include "CEGUIString.h"
00031 #include "CEGUISingleton.h"
00032 #include "CEGUILogger.h"
00033 #include "CEGUIIteratorBase.h"
00034 #include <map>
00035 #include <vector>
00036 
00037 #if defined(_MSC_VER)
00038 #       pragma warning(push)
00039 #       pragma warning(disable : 4275)
00040 #       pragma warning(disable : 4251)
00041 #endif
00042 
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00051 class CEGUIEXPORT WindowFactoryManager : public Singleton<WindowFactoryManager>
00052 {
00053 public:
00058     struct CEGUIEXPORT FalagardWindowMapping
00059     {
00060         String  d_windowType;
00061         String  d_lookName;
00062         String  d_baseType;
00063     };
00064 
00065         /*************************************************************************
00066                 Class used to track active alias targets
00067         *************************************************************************/
00068         class CEGUIEXPORT AliasTargetStack
00069         {
00070         public:
00075                 AliasTargetStack(void) {}
00076 
00077 
00082                 ~AliasTargetStack(void) {}
00083 
00084 
00092                 const String&   getActiveTarget(void) const;
00093 
00101                 uint    getStackedTargetCount(void) const;
00102 
00103 
00104         private:
00105                 friend class WindowFactoryManager;
00106                 typedef std::vector<String>     TargetTypeStack;                
00107 
00108                 TargetTypeStack d_targetStack;          
00109         };
00110 
00111 
00112         /*************************************************************************
00113                 Construction and Destruction
00114         *************************************************************************/
00119         WindowFactoryManager(void)
00120         {
00121                 Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton created");
00122         }
00123 
00124 
00129         ~WindowFactoryManager(void)
00130         {
00131                 Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton destroyed");
00132         }
00133 
00134 
00135         /*************************************************************************
00136                 Public Interface
00137         *************************************************************************/
00145         static  WindowFactoryManager&   getSingleton(void);
00146 
00147 
00155         static  WindowFactoryManager*   getSingletonPtr(void);
00156 
00157 
00171         void    addFactory(WindowFactory* factory);
00172 
00173 
00188         void    removeFactory(const String& name);
00189 
00190 
00205         void    removeFactory(WindowFactory* factory);
00206 
00207 
00215         void    removeAllFactories(void)                {d_factoryRegistry.clear();}
00216 
00217 
00230         WindowFactory*  getFactory(const String& type) const;
00231 
00232 
00243         bool    isFactoryPresent(const String& name) const;
00244 
00245 
00271         void    addWindowTypeAlias(const String& aliasName, const String& targetType);
00272 
00273 
00291         void    removeWindowTypeAlias(const String& aliasName, const String& targetType);
00292 
00318     void addFalagardWindowMapping(const String& newType, const String& targetType, const String& lookName);
00319 
00327     void removeFalagardWindowMapping(const String& type);
00328 
00340     bool isFalagardMappedType(const String& type) const;
00341 
00354     const String& getMappedLookForType(const String& type) const;
00355 
00356 private:
00357         /*************************************************************************
00358                 Implementation Data
00359         *************************************************************************/
00360         typedef std::map<String, WindowFactory*>        WindowFactoryRegistry;          
00361         typedef std::map<String, AliasTargetStack>      TypeAliasRegistry;              
00362     typedef std::map<String, FalagardWindowMapping> FalagardMapRegistry;    
00363 
00364         WindowFactoryRegistry   d_factoryRegistry;                      
00365         TypeAliasRegistry               d_aliasRegistry;                        
00366     FalagardMapRegistry     d_falagardRegistry;         
00367 
00368 public:
00369         /*************************************************************************
00370                 Iterator stuff
00371         *************************************************************************/
00372         typedef ConstBaseIterator<WindowFactoryRegistry>        WindowFactoryIterator;
00373         typedef ConstBaseIterator<TypeAliasRegistry>            TypeAliasIterator;
00374     typedef ConstBaseIterator<FalagardMapRegistry>      FalagardMappingIterator;
00375 
00380         WindowFactoryIterator   getIterator(void) const;
00381 
00382 
00387         TypeAliasIterator       getAliasIterator(void) const;
00388 
00389 
00394     FalagardMappingIterator getFalagardMappingIterator() const;
00395 };
00396 
00397 } // End of  CEGUI namespace section
00398 
00399 
00400 #if defined(_MSC_VER)
00401 #       pragma warning(pop)
00402 #endif
00403 
00404 #endif  // end of guard _CEGUIWindowFactoryManager_h_

Generated on Wed Sep 7 09:56:35 2005 for Crazy Eddies GUI System by  doxygen 1.4.3