Crazy Eddies GUI System  0.7.2
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 
313  void addAnimationName(const String& anim_name);
314 
326  void writeXMLToStream(XMLSerializer& xml_stream) const;
327 
341  void renameChildren(const Window& widget, const String& newBaseName) const;
342 
352  const PropertyInitialiser* findPropertyInitialiser(const String& propertyName) const;
353 
362  const WidgetComponent* findWidgetComponent(const String& nameSuffix) const;
363 
365  typedef std::vector<PropertyInitialiser> PropertyList;
366  typedef std::vector<PropertyDefinition> PropertyDefinitionList;
367  typedef std::vector<PropertyLinkDefinition> PropertyLinkDefinitionList;
368 
373  const PropertyDefinitionList& getPropertyDefinitions() const { return d_propertyDefinitions; }
374 
379  const PropertyLinkDefinitionList& getPropertyLinkDefinitions() const { return d_propertyLinkDefinitions; }
380 
385  const PropertyList& getProperties() const { return d_properties; }
386 
387  private:
388  typedef std::map<String, StateImagery, String::FastLessCompare> StateList;
389  typedef std::map<String, ImagerySection, String::FastLessCompare> ImageryList;
390  typedef std::map<String, NamedArea, String::FastLessCompare> NamedAreaList;
391  typedef std::vector<WidgetComponent> WidgetList;
392  typedef std::vector<String> AnimationList;
393  typedef std::multimap<Window*, AnimationInstance*> AnimationInstanceMap;
394 
395  CEGUI::String d_lookName;
396  ImageryList d_imagerySections;
397  WidgetList d_childWidgets;
398  StateList d_stateImagery;
399  PropertyList d_properties;
400  NamedAreaList d_namedAreas;
401  mutable PropertyDefinitionList d_propertyDefinitions;
402  mutable PropertyLinkDefinitionList d_propertyLinkDefinitions;
403 
404  AnimationList d_animations;
406  mutable AnimationInstanceMap d_animationInstances;
407  };
408 
409 
410 } // End of CEGUI namespace section
411 
412 
413 #if defined(_MSC_VER)
414 # pragma warning(pop)
415 #endif
416 
417 #endif // end of guard _CEGUIFalWidgetLookFeel_h_