Crazy Eddies GUI System  0.7.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  Construction and Destruction
129  *************************************************************************/
137  Scheme(const String& name);
138 
143  void loadXMLImagesets();
144 
149  void loadImageFileImagesets();
150 
155  void loadFonts();
156 
161  void loadLookNFeels();
162 
167  void loadWindowFactories();
168 
173  void loadWindowRendererFactories();
174 
179  void loadFactoryAliases();
180 
185  void loadFalagardMappings();
186 
191  void unloadXMLImagesets();
192 
197  void unloadImageFileImagesets();
198 
203  void unloadFonts();
204 
209  void unloadLookNFeels();
210 
215  void unloadWindowFactories();
216 
221  void unloadWindowRendererFactories();
222 
227  void unloadFactoryAliases();
228 
233  void unloadFalagardMappings();
234 
239  bool areXMLImagesetsLoaded() const;
240 
245  bool areImageFileImagesetsLoaded() const;
246 
251  bool areFontsLoaded() const;
252 
257  bool areLookNFeelsLoaded() const;
258 
263  bool areWindowFactoriesLoaded() const;
264 
269  bool areWindowRendererFactoriesLoaded() const;
270 
275  bool areFactoryAliasesLoaded() const;
276 
281  bool areFalagardMappingsLoaded() const;
282 
283 public: // for luabind compatibility
291  ~Scheme(void);
292 
293 
294 private:
295  /*************************************************************************
296  Structs used to hold scheme information
297  *************************************************************************/
298  struct LoadableUIElement
299  {
300  String name;
301  String filename;
302  String resourceGroup;
303  };
304 
305  struct UIElementFactory
306  {
307  String name;
308  };
309 
310  struct UIModule
311  {
312  String name;
313  FactoryModule* module;
314  std::vector<UIElementFactory> factories;
315  };
316 
317  struct WRModule
318  {
319  String name;
320  DynamicModule* dynamicModule;
321  WindowRendererModule* wrModule;
322  std::vector<String> wrTypes;
323  };
324 
325  struct AliasMapping
326  {
327  String aliasName;
328  String targetName;
329  };
330 
331  struct FalagardMapping
332  {
333  String windowName;
334  String targetName;
335  String rendererName;
336  String lookName;
337  };
338 
339  /*************************************************************************
340  Implementation Data
341  *************************************************************************/
342  String d_name;
343 
344  std::vector<LoadableUIElement> d_imagesets;
345  std::vector<LoadableUIElement> d_imagesetsFromImages;
346  std::vector<LoadableUIElement> d_fonts;
347  std::vector<UIModule> d_widgetModules;
348  std::vector<WRModule> d_windowRendererModules;
349  std::vector<AliasMapping> d_aliasMappings;
350  std::vector<LoadableUIElement> d_looknfeels;
351  std::vector<FalagardMapping> d_falagardMappings;
352 
353  static String d_defaultResourceGroup;
354 };
355 
356 } // End of CEGUI namespace section
357 
358 #if defined(_MSC_VER)
359 # pragma warning(pop)
360 #endif
361 
362 #endif // end of guard _CEGUIScheme_h_