Crazy Eddies GUI System  0.6.0
CEGUIScheme.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 "CEGUIBase.h"
34 #include "CEGUIString.h"
35 #include "CEGUISchemeManager.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 {
61  friend class Scheme_xmlHandler;
62 public:
70  void loadResources(void);
71 
72 
80  void unloadResources(void);
81 
82 
90  bool resourcesLoaded(void) const;
91 
92 
100  const String& getName(void) const {return d_name;}
101 
110  static const String& getDefaultResourceGroup()
111  { return d_defaultResourceGroup; }
112 
123  static void setDefaultResourceGroup(const String& resourceGroup)
124  { d_defaultResourceGroup = resourceGroup; }
125 
126 private:
127  /*************************************************************************
128  Implementation Constants
129  *************************************************************************/
130  static const char GUISchemeSchemaName[];
131 
132  /*************************************************************************
133  Friends
134  *************************************************************************/
135  friend Scheme* SchemeManager::loadScheme(const String& scheme_filename, const String& resourceGroup);
136  friend void SchemeManager::unloadScheme(const String& scheme_name);
137 
138 
139  /*************************************************************************
140  Construction and Destruction
141  *************************************************************************/
156  Scheme(const String& filename, const String& resourceGroup);
157 
162  void loadXMLImagesets();
163 
168  void loadImageFileImagesets();
169 
174  void loadFonts();
175 
180  void loadLookNFeels();
181 
186  void loadWindowFactories();
187 
192  void loadWindowRendererFactories();
193 
198  void loadFactoryAliases();
199 
204  void loadFalagardMappings();
205 
210  void unloadXMLImagesets();
211 
216  void unloadImageFileImagesets();
217 
222  void unloadFonts();
223 
228  void unloadLookNFeels();
229 
234  void unloadWindowFactories();
235 
240  void unloadWindowRendererFactories();
241 
246  void unloadFactoryAliases();
247 
252  void unloadFalagardMappings();
253 
258  bool areXMLImagesetsLoaded() const;
259 
264  bool areImageFileImagesetsLoaded() const;
265 
270  bool areFontsLoaded() const;
271 
276  bool areLookNFeelsLoaded() const;
277 
282  bool areWindowFactoriesLoaded() const;
283 
288  bool areWindowRendererFactoriesLoaded() const;
289 
294  bool areFactoryAliasesLoaded() const;
295 
300  bool areFalagardMappingsLoaded() const;
301 
302 public: // for luabind compatibility
310  ~Scheme(void);
311 
312 
313 private:
314  /*************************************************************************
315  Structs used to hold scheme information
316  *************************************************************************/
317  struct LoadableUIElement
318  {
319  String name;
320  String filename;
321  String resourceGroup;
322  };
323 
324  struct UIElementFactory
325  {
326  String name;
327  };
328 
329  struct UIModule
330  {
331  String name;
332  FactoryModule* module;
333  std::vector<UIElementFactory> factories;
334  };
335 
336  struct AliasMapping
337  {
338  String aliasName;
339  String targetName;
340  };
341 
342  struct FalagardMapping
343  {
344  String windowName;
345  String targetName;
346  String rendererName;
347  String lookName;
348  };
349 
350  /*************************************************************************
351  Implementation Data
352  *************************************************************************/
353  String d_name;
354 
355  std::vector<LoadableUIElement> d_imagesets;
356  std::vector<LoadableUIElement> d_imagesetsFromImages;
357  std::vector<LoadableUIElement> d_fonts;
358  std::vector<UIModule> d_widgetModules;
359  std::vector<UIModule> d_windowRendererModules;
360  std::vector<AliasMapping> d_aliasMappings;
361  std::vector<LoadableUIElement> d_looknfeels;
362  std::vector<FalagardMapping> d_falagardMappings;
363 
364  static String d_defaultResourceGroup;
365 };
366 
367 } // End of CEGUI namespace section
368 
369 #if defined(_MSC_VER)
370 # pragma warning(pop)
371 #endif
372 
373 #endif // end of guard _CEGUIScheme_h_