Crazy Eddie's GUI System  0.8.5
WidgetLookManager.h
1 /***********************************************************************
2  created: Mon Jun 13 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIFalWidgetLookManager_h_
28 #define _CEGUIFalWidgetLookManager_h_
29 
30 #include "../Singleton.h"
31 #include "../String.h"
32 #include "../Exceptions.h"
33 #include "./WidgetLookFeel.h"
34 #include <map>
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 # pragma warning(disable : 4275)
40 #endif
41 
42 // Start of CEGUI namespace section
43 namespace CEGUI
44 {
49  class CEGUIEXPORT WidgetLookManager :
50  public Singleton<WidgetLookManager>,
51  public AllocatedObject<WidgetLookManager>
52  {
53  public:
59 
65 
73  static WidgetLookManager& getSingleton(void);
74 
75 
83  static WidgetLookManager* getSingletonPtr(void);
84 
85 
87  typedef std::set<String, StringFastLessCompare CEGUI_SET_ALLOC(String)> WidgetLookNameSet;
88 
90  typedef std::map<String, WidgetLookFeel*, StringFastLessCompare CEGUI_MAP_ALLOC(String, WidgetLookFeel*)> WidgetLookPointerMap;
91 
113  void parseLookNFeelSpecificationFromContainer(const RawDataContainer& source);
114 
118  void parseLookNFeelSpecificationFromFile(const String& filename, const String& resourceGroup = "");
119 
123  void parseLookNFeelSpecificationFromString(const String& source);
124 
136  bool isWidgetLookAvailable(const String& widget) const;
137 
138 
151  const WidgetLookFeel& getWidgetLook(const String& widget) const;
152 
153 
165  void eraseWidgetLook(const String& widget);
166 
168  void eraseAllWidgetLooks();
169 
186  void addWidgetLook(const WidgetLookFeel& look);
187 
188 
200  void writeWidgetLookToStream(const String& widgetLookName, OutStream& out_stream) const;
201 
213  String getWidgetLookAsString(const String& widgetLookName) const;
214 
226  String getWidgetLookSetAsString(const WidgetLookNameSet& widgetLookNameSet) const;
227 
244  void writeWidgetLookSeriesToStream(const String& prefix, OutStream& out_stream) const;
245 
260  void writeWidgetLookSetToStream(const WidgetLookNameSet& widgetLookNameSet, OutStream& out_stream) const;
261 
271  { return d_defaultResourceGroup; }
272 
283  static void setDefaultResourceGroup(const String& resourceGroup)
284  { d_defaultResourceGroup = resourceGroup; }
285 
294  WidgetLookPointerMap getWidgetLookPointerMap();
295 
296  private:
298  static const String FalagardSchemaName;
300  static String d_defaultResourceGroup;
301 
302 
304  // \deprecated Will use the correct allocator in the next version and will
305  // be renamed to "WidgetLookMap"
306  typedef std::map<String, WidgetLookFeel, StringFastLessCompare> WidgetLookList;
307 
309  WidgetLookList d_widgetLooks;
310 
311  public:
315  WidgetLookIterator getWidgetLookIterator() const;
316  };
317 
318 } // End of CEGUI namespace section
319 
320 
321 #if defined(_MSC_VER)
322 # pragma warning(pop)
323 #endif
324 
325 #endif // end of guard _CEGUIFalWidgetLookManager_h_
std::set< String, StringFastLessCompare CEGUI_SET_ALLOC(String)> WidgetLookNameSet
Definition: WidgetLookManager.h:87
std::map< String, WidgetLookFeel *, StringFastLessCompare CEGUI_MAP_ALLOC(String, WidgetLookFeel *)> WidgetLookPointerMap
Typedef for a map of Strings to WidgetLookFeel objects.
Definition: WidgetLookManager.h:90
Definition: MemoryAllocatedObject.h:109
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Manager class that gives top-level access to widget data based "look and feel" specifications loaded ...
Definition: WidgetLookManager.h:49
std::ostream OutStream
Output stream class.
Definition: Base.h:185
Definition: Singleton.h:55
ConstMapIterator< WidgetLookList > WidgetLookIterator
Definition: WidgetLookManager.h:313
Class used as the databuffer for loading files throughout the library.
Definition: DataContainer.h:42
iterator class for maps
Definition: IteratorBase.h:196
Class that encapsulates Look N' Feel information for a widget.
Definition: WidgetLookFeel.h:54
static const String & getDefaultResourceGroup()
Returns the default resource group currently set for LookNFeels.
Definition: WidgetLookManager.h:270
static void setDefaultResourceGroup(const String &resourceGroup)
Sets the default resource group to be used when loading LookNFeel data.
Definition: WidgetLookManager.h:283
String class used within the GUI system.
Definition: String.h:62