Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Scheme.h
1 /***********************************************************************
2  filename: CEGUIScheme.h
3  created: 21/2/2004
4  author: Paul D Turner
5 
6  purpose: Defines abstract base class for the GUI Scheme object.
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIScheme_h_
31 #define _CEGUIScheme_h_
32 
33 #include "CEGUI/Base.h"
34 #include "CEGUI/String.h"
35 #include "CEGUI/SchemeManager.h"
36 
37 
38 #include <vector>
39 
40 
41 #if defined(_MSC_VER)
42 # pragma warning(push)
43 # pragma warning(disable : 4251)
44 #endif
45 
46 
47 // Start of CEGUI namespace section
48 namespace CEGUI
49 {
59 class CEGUIEXPORT Scheme :
60  public AllocatedObject<Scheme>
61 {
62 private:
63  friend class Scheme_xmlHandler;
64 
65  /*************************************************************************
66  Construction and Destruction
67  *************************************************************************/
75  Scheme(const String& name);
76 
77 public:
85  ~Scheme(void);
86 
94  void loadResources(void);
95 
96 
104  void unloadResources(void);
105 
106 
114  bool resourcesLoaded(void) const;
115 
116 
124  const String& getName(void) const {return d_name;}
125 
134  static const String& getDefaultResourceGroup()
135  { return d_defaultResourceGroup; }
136 
147  static void setDefaultResourceGroup(const String& resourceGroup)
148  { d_defaultResourceGroup = resourceGroup; }
149 
154  void loadXMLImagesets();
155 
160  void loadImageFileImagesets();
161 
166  void loadFonts();
167 
172  void loadLookNFeels();
173 
178  void loadWindowFactories();
179 
184  void loadWindowRendererFactories();
185 
190  void loadFactoryAliases();
191 
196  void loadFalagardMappings();
197 
202  void unloadXMLImagesets();
203 
208  void unloadImageFileImagesets();
209 
214  void unloadFonts();
215 
220  void unloadLookNFeels();
221 
226  void unloadWindowFactories();
227 
232  void unloadWindowRendererFactories();
233 
238  void unloadFactoryAliases();
239 
244  void unloadFalagardMappings();
245 
250  bool areXMLImagesetsLoaded() const;
251 
256  bool areImageFileImagesetsLoaded() const;
257 
262  bool areFontsLoaded() const;
263 
268  bool areLookNFeelsLoaded() const;
269 
274  bool areWindowFactoriesLoaded() const;
275 
280  bool areWindowRendererFactoriesLoaded() const;
281 
286  bool areFactoryAliasesLoaded() const;
287 
292  bool areFalagardMappingsLoaded() const;
293 
302  {
303  String name;
304  String filename;
305  String resourceGroup;
306  };
307 
308 private:
310  typedef std::vector<LoadableUIElement
311  CEGUI_VECTOR_ALLOC(LoadableUIElement)> LoadableUIElementList;
312 
313 public:
315 
320  LoadableUIElementIterator getXMLImagesets() const;
321 
326  LoadableUIElementIterator getImageFileImagesets() const;
327 
332  LoadableUIElementIterator getFonts() const;
333 
338  LoadableUIElementIterator getLookNFeels() const;
339 
340 private:
341  /*************************************************************************
342  Structs used to hold scheme information
343  *************************************************************************/
344 
345  struct UIModule
346  {
347  String name;
348  DynamicModule* dynamicModule;
349  FactoryModule* factoryModule;
350 
351  typedef std::vector<String
352  CEGUI_VECTOR_ALLOC(String)> TypeList;
353 
354  TypeList types;
355  };
356 
357  struct AliasMapping
358  {
359  String aliasName;
360  String targetName;
361  };
362 
363  struct FalagardMapping
364  {
365  String windowName;
366  String targetName;
367  String rendererName;
368  String lookName;
369  String effectName;
370  };
371 
372  /*************************************************************************
373  Implementation Data
374  *************************************************************************/
375  String d_name;
376 
377  LoadableUIElementList d_imagesets;
378  LoadableUIElementList d_imagesetsFromImages;
379  LoadableUIElementList d_fonts;
380 
381  typedef std::vector<UIModule
382  CEGUI_VECTOR_ALLOC(UIModule)> UIModuleList;
383  UIModuleList d_widgetModules;
384 
385  typedef std::vector<UIModule
386  CEGUI_VECTOR_ALLOC(UIModule)> WRModuleList;
387  WRModuleList d_windowRendererModules;
388 
389  typedef std::vector<AliasMapping
390  CEGUI_VECTOR_ALLOC(AliasMapping)> AliasMappingList;
391  AliasMappingList d_aliasMappings;
392 
393  LoadableUIElementList d_looknfeels;
394 
395  typedef std::vector<FalagardMapping
396  CEGUI_VECTOR_ALLOC(FalagardMapping)> FalagardMappingList;
397  FalagardMappingList d_falagardMappings;
398 
399  static String d_defaultResourceGroup;
400 };
401 
402 } // End of CEGUI namespace section
403 
404 #if defined(_MSC_VER)
405 # pragma warning(pop)
406 #endif
407 
408 #endif // end of guard _CEGUIScheme_h_