Crazy Eddie's GUI System  0.8.7
Scheme.h
1 /***********************************************************************
2  created: 21/2/2004
3  author: Paul D Turner
4 
5  purpose: Defines abstract base class for the GUI Scheme object.
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIScheme_h_
30 #define _CEGUIScheme_h_
31 
32 #include "CEGUI/Base.h"
33 #include "CEGUI/String.h"
34 #include "CEGUI/SchemeManager.h"
35 
36 
37 #include <vector>
38 
39 
40 #if defined(_MSC_VER)
41 # pragma warning(push)
42 # pragma warning(disable : 4251)
43 #endif
44 
45 
46 // Start of CEGUI namespace section
47 namespace CEGUI
48 {
58 class CEGUIEXPORT Scheme :
59  public AllocatedObject<Scheme>
60 {
61 private:
62  friend class Scheme_xmlHandler;
63 
64  /*************************************************************************
65  Construction and Destruction
66  *************************************************************************/
74  Scheme(const String& name);
75 
76 public:
84  ~Scheme(void);
85 
93  void loadResources(void);
94 
95 
103  void unloadResources(void);
104 
105 
113  bool resourcesLoaded(void) const;
114 
115 
123  const String& getName(void) const {return d_name;}
124 
134  { return d_defaultResourceGroup; }
135 
146  static void setDefaultResourceGroup(const String& resourceGroup)
147  { d_defaultResourceGroup = resourceGroup; }
148 
154 
160 
165  void loadFonts();
166 
172 
178 
184 
190 
196 
202 
208 
213  void unloadFonts();
214 
220 
226 
232 
238 
244 
249  bool areXMLImagesetsLoaded() const;
250 
256 
261  bool areFontsLoaded() const;
262 
267  bool areLookNFeelsLoaded() const;
268 
274 
280 
286 
292 
301  {
302  String name;
303  String filename;
304  String resourceGroup;
305  };
306 
307 private:
309  typedef std::vector<LoadableUIElement
310  CEGUI_VECTOR_ALLOC(LoadableUIElement)> LoadableUIElementList;
311 
312 public:
314 
320 
326 
332 
338 
339 private:
340  /*************************************************************************
341  Structs used to hold scheme information
342  *************************************************************************/
343 
344  struct UIModule
345  {
346  String name;
347  DynamicModule* dynamicModule;
348  FactoryModule* factoryModule;
349 
350  typedef std::vector<String
351  CEGUI_VECTOR_ALLOC(String)> TypeList;
352 
353  TypeList types;
354  };
355 
356  struct AliasMapping
357  {
358  String aliasName;
359  String targetName;
360  };
361 
362  struct FalagardMapping
363  {
364  String windowName;
365  String targetName;
366  String rendererName;
367  String lookName;
368  String effectName;
369  };
370 
371  /*************************************************************************
372  Implementation Data
373  *************************************************************************/
374  String d_name;
375 
376  LoadableUIElementList d_imagesets;
377  LoadableUIElementList d_imagesetsFromImages;
378  LoadableUIElementList d_fonts;
379 
380  typedef std::vector<UIModule
381  CEGUI_VECTOR_ALLOC(UIModule)> UIModuleList;
382  UIModuleList d_widgetModules;
383 
384  typedef std::vector<UIModule
385  CEGUI_VECTOR_ALLOC(UIModule)> WRModuleList;
386  WRModuleList d_windowRendererModules;
387 
388  typedef std::vector<AliasMapping
389  CEGUI_VECTOR_ALLOC(AliasMapping)> AliasMappingList;
390  AliasMappingList d_aliasMappings;
391 
392  LoadableUIElementList d_looknfeels;
393 
394  typedef std::vector<FalagardMapping
395  CEGUI_VECTOR_ALLOC(FalagardMapping)> FalagardMappingList;
396  FalagardMappingList d_falagardMappings;
397 
398  static String d_defaultResourceGroup;
399 };
400 
401 } // End of CEGUI namespace section
402 
403 #if defined(_MSC_VER)
404 # pragma warning(pop)
405 #endif
406 
407 #endif // end of guard _CEGUIScheme_h_
CEGUI::Scheme::areLookNFeelsLoaded
bool areLookNFeelsLoaded() const
Check state of all looknfeel files loaded by the scheme.
CEGUI::Scheme
A class that groups a set of GUI elements and initialises the system to access those elements.
Definition: Scheme.h:60
CEGUI::Scheme::loadLookNFeels
void loadLookNFeels()
Load all xml looknfeel files required by the scheme.
CEGUI::Scheme::unloadImageFileImagesets
void unloadImageFileImagesets()
Unload all image file based imagesets created by the scheme.
CEGUI::Scheme::areFalagardMappingsLoaded
bool areFalagardMappingsLoaded() const
Check state of all falagard mappings created by the scheme.
CEGUI::Scheme::getDefaultResourceGroup
static const String & getDefaultResourceGroup()
Returns the default resource group currently set for Schemes.
Definition: Scheme.h:133
CEGUI::DynamicModule
Class that wraps and gives access to a dynamically linked module (.dll, .so, etc.....
Definition: DynamicModule.h:43
CEGUI::Scheme::areImageFileImagesetsLoaded
bool areImageFileImagesetsLoaded() const
Check state of all image file based imagesets created by the scheme.
CEGUI::Scheme::getLookNFeels
LoadableUIElementIterator getLookNFeels() const
Retrieves iterator for all references to LookNFeels files that are to be loaded with this Scheme.
CEGUI::Scheme::unloadXMLImagesets
void unloadXMLImagesets()
Unload all XML based imagesets created by the scheme.
CEGUI::Scheme::unloadWindowRendererFactories
void unloadWindowRendererFactories()
Unregister all window renderer factories registered by the scheme.
CEGUI::Scheme::areWindowFactoriesLoaded
bool areWindowFactoriesLoaded() const
Check state of all window factories registered by the scheme.
CEGUI::Scheme::loadWindowRendererFactories
void loadWindowRendererFactories()
Register all window renderer factories required by the scheme.
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::Scheme::loadFactoryAliases
void loadFactoryAliases()
Register all factory aliases required by the scheme.
CEGUI::Scheme::getName
const String & getName(void) const
Return the name of this Scheme.
Definition: Scheme.h:123
CEGUI::Scheme::resourcesLoaded
bool resourcesLoaded(void) const
Return whether the resources for this Scheme are all loaded.
CEGUI::AllocatedObject
Definition: MemoryAllocatedObject.h:110
CEGUI::Scheme::~Scheme
~Scheme(void)
Destroys a Scheme object.
CEGUI::Scheme::loadXMLImagesets
void loadXMLImagesets()
Load all XML based imagesets required by the scheme.
CEGUI::Scheme::LoadableUIElement
A single file reference to a font, imageset or so to be loaded as part of this Scheme.
Definition: Scheme.h:301
CEGUI::Scheme::getXMLImagesets
LoadableUIElementIterator getXMLImagesets() const
Retrieves iterator for all references to XML imagesets that are to be loaded with this Scheme.
CEGUI::Scheme::unloadWindowFactories
void unloadWindowFactories()
Unregister all window factories registered by the scheme.
CEGUI::Scheme::areFontsLoaded
bool areFontsLoaded() const
Check state of all xml based fonts created by the scheme.
CEGUI::Scheme::loadWindowFactories
void loadWindowFactories()
Register all window factories required by the scheme.
CEGUI::ConstVectorIterator
iterator for vectors
Definition: IteratorBase.h:288
CEGUI::Scheme::unloadLookNFeels
void unloadLookNFeels()
Unload all xml looknfeel files loaded by the scheme.
CEGUI::Scheme_xmlHandler
Handler class used to parse the Scheme XML files using SAX2.
Definition: Scheme_xmlHandler.h:38
CEGUI::Scheme::unloadFalagardMappings
void unloadFalagardMappings()
Unregister all falagard mappings created by the scheme.
CEGUI::Scheme::loadFalagardMappings
void loadFalagardMappings()
Create all falagard mappings required by the scheme.
CEGUI::Scheme::areFactoryAliasesLoaded
bool areFactoryAliasesLoaded() const
Check state of all factory aliases created by the scheme.
CEGUI::Scheme::getFonts
LoadableUIElementIterator getFonts() const
Retrieves iterator for all references to font files that are to be loaded with this Scheme.
CEGUI::Scheme::areXMLImagesetsLoaded
bool areXMLImagesetsLoaded() const
Check state of all XML based imagesets created by the scheme.
CEGUI::Scheme::loadResources
void loadResources(void)
Loads all resources for this scheme.
CEGUI::Scheme::unloadFactoryAliases
void unloadFactoryAliases()
Unregister all factory aliases created by the scheme.
CEGUI::Scheme::getImageFileImagesets
LoadableUIElementIterator getImageFileImagesets() const
Retrieves iterator for all references to image file imagesets that are to be loaded with this Scheme.
CEGUI::Scheme::loadFonts
void loadFonts()
Load all xml based fonts required by the scheme.
CEGUI::Scheme::unloadFonts
void unloadFonts()
Unload all xml based fonts created by the scheme.
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::Scheme::loadImageFileImagesets
void loadImageFileImagesets()
Load all image file based imagesets required by the scheme.
CEGUI::Scheme::setDefaultResourceGroup
static void setDefaultResourceGroup(const String &resourceGroup)
Sets the default resource group to be used when loading scheme xml data.
Definition: Scheme.h:146
CEGUI::Scheme::unloadResources
void unloadResources(void)
Unloads all resources for this scheme. This should be used very carefully.
CEGUI::Scheme::areWindowRendererFactoriesLoaded
bool areWindowRendererFactoriesLoaded() const
Check state of all window renderer factories registered by the scheme.
CEGUI::FactoryModule
Definition: FactoryModule.h:46