Crazy Eddie's GUI System  0.8.5
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 
153  void loadXMLImagesets();
154 
159  void loadImageFileImagesets();
160 
165  void loadFonts();
166 
171  void loadLookNFeels();
172 
177  void loadWindowFactories();
178 
183  void loadWindowRendererFactories();
184 
189  void loadFactoryAliases();
190 
195  void loadFalagardMappings();
196 
201  void unloadXMLImagesets();
202 
207  void unloadImageFileImagesets();
208 
213  void unloadFonts();
214 
219  void unloadLookNFeels();
220 
225  void unloadWindowFactories();
226 
231  void unloadWindowRendererFactories();
232 
237  void unloadFactoryAliases();
238 
243  void unloadFalagardMappings();
244 
249  bool areXMLImagesetsLoaded() const;
250 
255  bool areImageFileImagesetsLoaded() const;
256 
261  bool areFontsLoaded() const;
262 
267  bool areLookNFeelsLoaded() const;
268 
273  bool areWindowFactoriesLoaded() const;
274 
279  bool areWindowRendererFactoriesLoaded() const;
280 
285  bool areFactoryAliasesLoaded() const;
286 
291  bool areFalagardMappingsLoaded() const;
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 
319  LoadableUIElementIterator getXMLImagesets() const;
320 
325  LoadableUIElementIterator getImageFileImagesets() const;
326 
331  LoadableUIElementIterator getFonts() const;
332 
337  LoadableUIElementIterator getLookNFeels() const;
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_
const String & getName(void) const
Return the name of this Scheme.
Definition: Scheme.h:123
Definition: MemoryAllocatedObject.h:109
Class that wraps and gives access to a dynamically linked module (.dll, .so, etc...)
Definition: DynamicModule.h:41
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
iterator for vectors
Definition: IteratorBase.h:287
static void setDefaultResourceGroup(const String &resourceGroup)
Sets the default resource group to be used when loading scheme xml data.
Definition: Scheme.h:146
static const String & getDefaultResourceGroup()
Returns the default resource group currently set for Schemes.
Definition: Scheme.h:133
Definition: FactoryModule.h:44
Handler class used to parse the Scheme XML files using SAX2.
Definition: Scheme_xmlHandler.h:37
A single file reference to a font, imageset or so to be loaded as part of this Scheme.
Definition: Scheme.h:300
A class that groups a set of GUI elements and initialises the system to access those elements...
Definition: Scheme.h:58
String class used within the GUI system.
Definition: String.h:62