CEGUIWindowFactoryManager.h

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  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIWindowFactoryManager_h_
00031 #define _CEGUIWindowFactoryManager_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUIString.h"
00035 #include "CEGUISingleton.h"
00036 #include "CEGUILogger.h"
00037 #include "CEGUIIteratorBase.h"
00038 #include <map>
00039 #include <vector>
00040 
00041 #if defined(_MSC_VER)
00042 #       pragma warning(push)
00043 #       pragma warning(disable : 4275)
00044 #       pragma warning(disable : 4251)
00045 #endif
00046 
00047 
00048 // Start of CEGUI namespace section
00049 namespace CEGUI
00050 {
00059 class CEGUIEXPORT WindowFactoryManager : public Singleton<WindowFactoryManager>
00060 {
00061 public:
00066     struct CEGUIEXPORT FalagardWindowMapping
00067     {
00068         String  d_windowType;
00069         String  d_lookName;
00070         String  d_baseType;
00071         String  d_rendererType;
00072     };
00073 
00078         class CEGUIEXPORT AliasTargetStack
00079         {
00080         public:
00085                 AliasTargetStack(void) {}
00086 
00087 
00092                 ~AliasTargetStack(void) {}
00093 
00094 
00102                 const String&   getActiveTarget(void) const;
00103 
00111                 uint    getStackedTargetCount(void) const;
00112 
00113 
00114         private:
00115                 friend class WindowFactoryManager;
00116                 typedef std::vector<String>     TargetTypeStack;                
00117 
00118                 TargetTypeStack d_targetStack;          
00119         };
00120 
00121 
00122         /*************************************************************************
00123                 Construction and Destruction
00124         *************************************************************************/
00129         WindowFactoryManager(void)
00130         {
00131                 Logger::getSingleton().logEvent("CEGUI::WindowFactoryManager singleton created");
00132         }
00133 
00134 
00139         ~WindowFactoryManager(void)
00140         {
00141                 Logger::getSingleton().logEvent("CEGUI::WindowFactoryManager singleton destroyed");
00142         }
00143 
00144 
00145         /*************************************************************************
00146                 Public Interface
00147         *************************************************************************/
00161         void    addFactory(WindowFactory* factory);
00162 
00163 
00178         void    removeFactory(const String& name);
00179 
00180 
00195         void    removeFactory(WindowFactory* factory);
00196 
00197 
00205         void    removeAllFactories(void)                {d_factoryRegistry.clear();}
00206 
00207 
00220         WindowFactory*  getFactory(const String& type) const;
00221 
00222 
00237     bool        isFactoryPresent(const String& name) const;
00238 
00239 
00265         void    addWindowTypeAlias(const String& aliasName, const String& targetType);
00266 
00267 
00285         void    removeWindowTypeAlias(const String& aliasName, const String& targetType);
00286 
00315     void addFalagardWindowMapping(const String& newType, const String& targetType, const String& lookName, const String& renderer);
00316 
00324     void removeFalagardWindowMapping(const String& type);
00325 
00337     bool isFalagardMappedType(const String& type) const;
00338 
00351     const String& getMappedLookForType(const String& type) const;
00352 
00365     const String& getMappedRendererForType(const String& type) const;
00366 
00385     String getDereferencedAliasType(const String& type) const;
00386 
00399     const FalagardWindowMapping& getFalagardMappingForType(const String& type) const;
00400 
00401 private:
00402         /*************************************************************************
00403                 Implementation Data
00404         *************************************************************************/
00405         typedef std::map<String, WindowFactory*, String::FastLessCompare>       WindowFactoryRegistry;          
00406         typedef std::map<String, AliasTargetStack, String::FastLessCompare>     TypeAliasRegistry;              
00407     typedef std::map<String, FalagardWindowMapping, String::FastLessCompare> FalagardMapRegistry;    
00408 
00409         WindowFactoryRegistry   d_factoryRegistry;                      
00410         TypeAliasRegistry               d_aliasRegistry;                        
00411     FalagardMapRegistry     d_falagardRegistry;         
00412 
00413 public:
00414         /*************************************************************************
00415                 Iterator stuff
00416         *************************************************************************/
00417         typedef ConstBaseIterator<WindowFactoryRegistry>        WindowFactoryIterator;
00418         typedef ConstBaseIterator<TypeAliasRegistry>            TypeAliasIterator;
00419     typedef ConstBaseIterator<FalagardMapRegistry>      FalagardMappingIterator;
00420 
00425         WindowFactoryIterator   getIterator(void) const;
00426 
00427 
00432         TypeAliasIterator       getAliasIterator(void) const;
00433 
00434 
00439     FalagardMappingIterator getFalagardMappingIterator() const;
00440 };
00441 
00442 } // End of  CEGUI namespace section
00443 
00444 
00445 #if defined(_MSC_VER)
00446 #       pragma warning(pop)
00447 #endif
00448 
00449 #endif  // end of guard _CEGUIWindowFactoryManager_h_

Generated on Sun Nov 5 14:35:28 2006 for Crazy Eddies GUI System by  doxygen 1.4.7