Crazy Eddies GUI System  0.7.1
CEGUIFalWidgetLookFeel.h
1 /***********************************************************************
2  filename: CEGUIFalWidgetLookFeel.h
3  created: Mon Jun 13 2005
4  author: Paul D Turner <paul@cegui.org.uk>
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIFalWidgetLookFeel_h_
29 #define _CEGUIFalWidgetLookFeel_h_
30 
31 #include "CEGUIFalStateImagery.h"
32 #include "CEGUIFalWidgetComponent.h"
33 #include "CEGUIFalImagerySection.h"
34 #include "CEGUIFalPropertyInitialiser.h"
35 #include "CEGUIFalPropertyDefinition.h"
36 #include "CEGUIFalPropertyLinkDefinition.h"
37 #include "CEGUIFalNamedArea.h"
38 #include <map>
39 
40 #if defined(_MSC_VER)
41 # pragma warning(push)
42 # pragma warning(disable : 4251)
43 #endif
44 
45 
46 // Start of CEGUI namespace section
47 namespace CEGUI
48 {
53  class CEGUIEXPORT WidgetLookFeel
54  {
55  public:
56  WidgetLookFeel(const String& name);
57  WidgetLookFeel() {}
58 
66  const StateImagery& getStateImagery(const CEGUI::String& state) const;
67 
75  const ImagerySection& getImagerySection(const CEGUI::String& section) const;
76 
84  const String& getName() const;
85 
95  void addImagerySection(const ImagerySection& section);
96 
106  void addWidgetComponent(const WidgetComponent& widget);
107 
117  void addStateSpecification(const StateImagery& state);
118 
128  void addPropertyInitialiser(const PropertyInitialiser& initialiser);
129 
137  void clearImagerySections();
138 
146  void clearWidgetComponents();
147 
155  void clearStateSpecifications();
156 
164  void clearPropertyInitialisers();
165 
177  void initialiseWidget(Window& widget) const;
178 
189  void cleanUpWidget(Window& widget) const;
190 
202  bool isStateImageryPresent(const String& state) const;
203 
214  void addNamedArea(const NamedArea& area);
215 
223  void clearNamedAreas();
224 
235  const NamedArea& getNamedArea(const String& name) const;
236 
248  bool isNamedAreaDefined(const String& name) const;
249 
260  void layoutChildWidgets(const Window& owner) const;
261 
272  void addPropertyDefinition(const PropertyDefinition& propdef);
273 
284  void addPropertyLinkDefinition(const PropertyLinkDefinition& propdef);
285 
293  void clearPropertyDefinitions();
294 
302  void clearPropertyLinkDefinitions();
303 
315  void writeXMLToStream(XMLSerializer& xml_stream) const;
316 
330  void renameChildren(const Window& widget, const String& newBaseName) const;
331 
341  const PropertyInitialiser* findPropertyInitialiser(const String& propertyName) const;
342 
351  const WidgetComponent* findWidgetComponent(const String& nameSuffix) const;
352 
354  typedef std::vector<PropertyInitialiser> PropertyList;
355  typedef std::vector<PropertyDefinition> PropertyDefinitionList;
356  typedef std::vector<PropertyLinkDefinition> PropertyLinkDefinitionList;
357 
362  const PropertyDefinitionList& getPropertyDefinitions() const { return d_propertyDefinitions; }
363 
368  const PropertyLinkDefinitionList& getPropertyLinkDefinitions() const { return d_propertyLinkDefinitions; }
369 
374  const PropertyList& getProperties() const { return d_properties; }
375 
376  private:
377  typedef std::map<String, StateImagery, String::FastLessCompare> StateList;
378  typedef std::map<String, ImagerySection, String::FastLessCompare> ImageryList;
379  typedef std::map<String, NamedArea, String::FastLessCompare> NamedAreaList;
380  typedef std::vector<WidgetComponent> WidgetList;
381 
382  CEGUI::String d_lookName;
383  ImageryList d_imagerySections;
384  WidgetList d_childWidgets;
385  StateList d_stateImagery;
386  PropertyList d_properties;
387  NamedAreaList d_namedAreas;
388  mutable PropertyDefinitionList d_propertyDefinitions;
389  mutable PropertyLinkDefinitionList d_propertyLinkDefinitions;
390  };
391 
392 
393 } // End of CEGUI namespace section
394 
395 
396 #if defined(_MSC_VER)
397 # pragma warning(pop)
398 #endif
399 
400 #endif // end of guard _CEGUIFalWidgetLookFeel_h_