Crazy Eddie's GUI System 0.8.7
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
43namespace CEGUI
44{
49 class CEGUIEXPORT WidgetLookManager :
50 public Singleton<WidgetLookManager>,
51 public AllocatedObject<WidgetLookManager>
52 {
53 public:
59
65
74
75
84
85
87 typedef std::set<String, StringFastLessCompare CEGUI_SET_ALLOC(String)> WidgetLookNameSet;
88
91
114
118 void parseLookNFeelSpecificationFromFile(const String& filename, const String& resourceGroup = "");
119
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
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
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 CEGUI_MAP_ALLOC(String, WidgetLookFeel)> WidgetLookList;
307
309 WidgetLookList d_widgetLooks;
310
311 public:
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_
Definition: MemoryAllocatedObject.h:110
iterator class for maps
Definition: IteratorBase.h:197
Class used as the databuffer for loading files throughout the library.
Definition: DataContainer.h:44
Definition: Singleton.h:56
String class used within the GUI system.
Definition: String.h:64
Class that encapsulates Look N' Feel information for a widget.
Definition: WidgetLookFeel.h:56
Manager class that gives top-level access to widget data based "look and feel" specifications loaded ...
Definition: WidgetLookManager.h:52
static WidgetLookManager * getSingletonPtr(void)
Return pointer to singleton WidgetLookManager object.
void eraseAllWidgetLooks()
erase all defined WidgetLookFeel.
ConstMapIterator< WidgetLookList > WidgetLookIterator
Definition: WidgetLookManager.h:313
void writeWidgetLookToStream(const String &widgetLookName, OutStream &out_stream) const
Writes a complete WidgetLookFeel to a stream. Note that XML file header and Falagard opening/closing ...
std::set< String, StringFastLessCompare CEGUI_SET_ALLOC(String)> WidgetLookNameSet
Definition: WidgetLookManager.h:87
static void setDefaultResourceGroup(const String &resourceGroup)
Sets the default resource group to be used when loading LookNFeel data.
Definition: WidgetLookManager.h:283
String getWidgetLookAsString(const String &widgetLookName) const
Writes a complete WidgetLookFeel to a string. Note that XML file header and Falagard opening/closing ...
const WidgetLookFeel & getWidgetLook(const String &widget) const
Return a const reference to a WidgetLookFeel object which has the specified name.
void parseLookNFeelSpecificationFromString(const String &source)
WidgetLookIterator getWidgetLookIterator() const
void writeWidgetLookSeriesToStream(const String &prefix, OutStream &out_stream) const
Writes a series of complete WidgetLook objects to a stream. Note that XML file header and Falagard op...
void addWidgetLook(const WidgetLookFeel &look)
Add the given WidgetLookFeel.
void parseLookNFeelSpecificationFromContainer(const RawDataContainer &source)
Parses a file containing window look & feel specifications (in the form of XML).
void writeWidgetLookSetToStream(const WidgetLookNameSet &widgetLookNameSet, OutStream &out_stream) const
Writes a series of complete WidgetLook objects to a stream. Note that XML file header and Falagard op...
std::map< String, WidgetLookFeel *, StringFastLessCompare CEGUI_MAP_ALLOC(String, WidgetLookFeel *)> WidgetLookPointerMap
Typedef for a map of Strings to WidgetLookFeel objects.
Definition: WidgetLookManager.h:90
void parseLookNFeelSpecificationFromFile(const String &filename, const String &resourceGroup="")
WidgetLookManager()
Constructor.
static const String & getDefaultResourceGroup()
Returns the default resource group currently set for LookNFeels.
Definition: WidgetLookManager.h:270
bool isWidgetLookAvailable(const String &widget) const
Return whether a WidgetLookFeel has been created with the specified name.
static WidgetLookManager & getSingleton(void)
Return singleton WidgetLookManager object.
~WidgetLookManager()
Destructor.
WidgetLookPointerMap getWidgetLookPointerMap()
Returns a map containing Strings to WidgetLookFeel pointers. The map contains pointers to the WidgetL...
void eraseWidgetLook(const String &widget)
Erase the WidgetLookFeel that has the specified name.
String getWidgetLookSetAsString(const WidgetLookNameSet &widgetLookNameSet) const
Writes a set WidgetLookFeels to a string. Note that XML file header and Falagard opening/closing tags...
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
std::ostream OutStream
Output stream class.
Definition: Base.h:185
Functor that can be used as comparator in a std::map with String keys. It's faster than using the def...
Definition: String.h:5580