Crazy Eddies GUI System 0.7.5

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                 Construction and Destruction
00129         *************************************************************************/
00137         Scheme(const String& name);
00138 
00143     void loadXMLImagesets();
00144 
00149     void loadImageFileImagesets();
00150 
00155     void loadFonts();
00156 
00161     void loadLookNFeels();
00162 
00167     void loadWindowFactories();
00168 
00173     void loadWindowRendererFactories();
00174 
00179     void loadFactoryAliases();
00180 
00185     void loadFalagardMappings();
00186 
00191     void unloadXMLImagesets();
00192 
00197     void unloadImageFileImagesets();
00198 
00203     void unloadFonts();
00204 
00209     void unloadLookNFeels();
00210 
00215     void unloadWindowFactories();
00216 
00221     void unloadWindowRendererFactories();
00222 
00227     void unloadFactoryAliases();
00228 
00233     void unloadFalagardMappings();
00234 
00239     bool areXMLImagesetsLoaded() const;
00240 
00245     bool areImageFileImagesetsLoaded() const;
00246 
00251     bool areFontsLoaded() const;
00252 
00257     bool areLookNFeelsLoaded() const;
00258 
00263     bool areWindowFactoriesLoaded() const;
00264 
00269     bool areWindowRendererFactoriesLoaded() const;
00270 
00275     bool areFactoryAliasesLoaded() const;
00276 
00281     bool areFalagardMappingsLoaded() const;
00282 
00283 public:         // for luabind compatibility
00291         ~Scheme(void);
00292 
00293 
00294 private:
00295         /*************************************************************************
00296                 Structs used to hold scheme information
00297         *************************************************************************/
00298         struct LoadableUIElement
00299         {
00300                 String  name;
00301                 String  filename;
00302         String  resourceGroup;
00303         };
00304 
00305         struct  UIElementFactory
00306         {
00307                 String name;
00308         };
00309 
00310         struct  UIModule
00311         {
00312                 String name;
00313                 FactoryModule*  module;
00314                 std::vector<UIElementFactory>   factories;
00315         };
00316 
00317     struct WRModule
00318     {
00319         String name;
00320         DynamicModule* dynamicModule;
00321         WindowRendererModule* wrModule;
00322         std::vector<String> wrTypes;
00323     };
00324 
00325         struct AliasMapping
00326         {
00327                 String aliasName;
00328                 String targetName;
00329         };
00330 
00331     struct FalagardMapping
00332     {
00333         String windowName;
00334         String targetName;
00335         String rendererName;
00336         String lookName;
00337         String effectName;
00338     };
00339 
00340         /*************************************************************************
00341                 Implementation Data
00342         *************************************************************************/
00343         String  d_name;                 
00344 
00345         std::vector<LoadableUIElement>          d_imagesets;
00346         std::vector<LoadableUIElement>          d_imagesetsFromImages;
00347         std::vector<LoadableUIElement>          d_fonts;
00348         std::vector<UIModule>                           d_widgetModules;
00349     std::vector<WRModule>               d_windowRendererModules;
00350         std::vector<AliasMapping>                       d_aliasMappings;
00351     std::vector<LoadableUIElement>              d_looknfeels;
00352     std::vector<FalagardMapping>        d_falagardMappings;
00353 
00354     static String d_defaultResourceGroup;   
00355 };
00356 
00357 } // End of  CEGUI namespace section
00358 
00359 #if defined(_MSC_VER)
00360 #       pragma warning(pop)
00361 #endif
00362 
00363 #endif  // end of guard _CEGUIScheme_h_