CEGUIScheme.h

00001 /***********************************************************************
00002         filename:       CEGUIScheme.h
00003         created:        21/2/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Defines abstract base class for the GUI Scheme object.
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 _CEGUIScheme_h_
00031 #define _CEGUIScheme_h_
00032 
00033 #include "CEGUIBase.h"
00034 #include "CEGUIString.h"
00035 #include "CEGUISchemeManager.h"
00036 
00037 
00038 #include <vector>
00039 
00040 
00041 #if defined(_MSC_VER)
00042 #       pragma warning(push)
00043 #       pragma warning(disable : 4251)
00044 #endif
00045 
00046 
00047 // Start of CEGUI namespace section
00048 namespace CEGUI
00049 {
00059 class CEGUIEXPORT Scheme
00060 {
00061         friend class Scheme_xmlHandler;
00062 public:
00070         void    loadResources(void);
00071 
00072 
00080         void    unloadResources(void);
00081 
00082 
00090         bool    resourcesLoaded(void) const;
00091 
00092 
00100         const String& getName(void) const               {return d_name;}
00101 
00110     static const String& getDefaultResourceGroup()
00111         { return d_defaultResourceGroup; }
00112 
00123     static void setDefaultResourceGroup(const String& resourceGroup)
00124         { d_defaultResourceGroup = resourceGroup; }
00125 
00126 private:
00127         /*************************************************************************
00128                 Implementation Constants
00129         *************************************************************************/
00130         static const char       GUISchemeSchemaName[];                  
00131 
00132         /*************************************************************************
00133                 Friends
00134         *************************************************************************/
00135         friend  Scheme* SchemeManager::loadScheme(const String& scheme_filename, const String& resourceGroup);
00136         friend  void    SchemeManager::unloadScheme(const String& scheme_name);
00137 
00138 
00139         /*************************************************************************
00140                 Construction and Destruction
00141         *************************************************************************/
00156         Scheme(const String& filename, const String& resourceGroup);
00157 
00162     void loadXMLImagesets();
00163 
00168     void loadImageFileImagesets();
00169 
00174     void loadFonts();
00175 
00180     void loadLookNFeels();
00181 
00186     void loadWindowFactories();
00187 
00192     void loadWindowRendererFactories();
00193 
00198     void loadFactoryAliases();
00199 
00204     void loadFalagardMappings();
00205 
00210     void unloadXMLImagesets();
00211 
00216     void unloadImageFileImagesets();
00217 
00222     void unloadFonts();
00223 
00228     void unloadLookNFeels();
00229 
00234     void unloadWindowFactories();
00235 
00240     void unloadWindowRendererFactories();
00241 
00246     void unloadFactoryAliases();
00247 
00252     void unloadFalagardMappings();
00253 
00258     bool areXMLImagesetsLoaded() const;
00259 
00264     bool areImageFileImagesetsLoaded() const;
00265 
00270     bool areFontsLoaded() const;
00271 
00276     bool areLookNFeelsLoaded() const;
00277 
00282     bool areWindowFactoriesLoaded() const;
00283 
00288     bool areWindowRendererFactoriesLoaded() const;
00289 
00294     bool areFactoryAliasesLoaded() const;
00295 
00300     bool areFalagardMappingsLoaded() const;
00301 
00302 public:         // for luabind compatibility
00310         ~Scheme(void);
00311 
00312 
00313 private:
00314         /*************************************************************************
00315                 Structs used to hold scheme information
00316         *************************************************************************/
00317         struct LoadableUIElement
00318         {
00319                 String  name;
00320                 String  filename;
00321         String  resourceGroup;
00322         };
00323 
00324         struct  UIElementFactory
00325         {
00326                 String name;
00327         };
00328 
00329         struct  UIModule
00330         {
00331                 String name;
00332                 FactoryModule*  module;
00333                 std::vector<UIElementFactory>   factories;
00334         };
00335 
00336         struct AliasMapping
00337         {
00338                 String aliasName;
00339                 String targetName;
00340         };
00341 
00342     struct FalagardMapping
00343     {
00344         String windowName;
00345         String targetName;
00346         String rendererName;
00347         String lookName;
00348     };
00349 
00350         /*************************************************************************
00351                 Implementation Data
00352         *************************************************************************/
00353         String  d_name;                 
00354 
00355         std::vector<LoadableUIElement>          d_imagesets;
00356         std::vector<LoadableUIElement>          d_imagesetsFromImages;
00357         std::vector<LoadableUIElement>          d_fonts;
00358         std::vector<UIModule>                           d_widgetModules;
00359     std::vector<UIModule>               d_windowRendererModules;
00360         std::vector<AliasMapping>                       d_aliasMappings;
00361     std::vector<LoadableUIElement>              d_looknfeels;
00362     std::vector<FalagardMapping>        d_falagardMappings;
00363 
00364     static String d_defaultResourceGroup;   
00365 };
00366 
00367 } // End of  CEGUI namespace section
00368 
00369 #if defined(_MSC_VER)
00370 #       pragma warning(pop)
00371 #endif
00372 
00373 #endif  // end of guard _CEGUIScheme_h_

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