Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
WidgetComponent.h
1 /***********************************************************************
2  created: Mon Jun 13 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2006 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 _CEGUIFalWidgetComponent_h_
28 #define _CEGUIFalWidgetComponent_h_
29 
30 #include "CEGUI/falagard/Dimensions.h"
31 #include "CEGUI/falagard/PropertyInitialiser.h"
32 #include "CEGUI/falagard/EventAction.h"
33 #include "CEGUI/Window.h"
34 
35 #if defined(_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
38 #endif
39 
40 // Start of CEGUI namespace section
41 namespace CEGUI
42 {
50  class CEGUIEXPORT WidgetComponent :
51  public AllocatedObject<WidgetComponent>
52  {
53  public:
54  WidgetComponent() {}
55  WidgetComponent(const String& type,
56  const String& look,
57  const String& suffix,
58  const String& renderer,
59  bool autoWindow);
60 
66  void create(Window& parent) const;
67 
73  void cleanup(Window& parent) const;
74 
75  const ComponentArea& getComponentArea() const;
76  void setComponentArea(const ComponentArea& area);
77 
78  const String& getBaseWidgetType() const;
79  void setBaseWidgetType(const String& type);
80 
81  const String& getWidgetLookName() const;
82  void setWidgetLookName(const String& look);
83 
84  const String& getWidgetName() const;
85  void setWidgetName(const String& name);
86 
87  const String& getWindowRendererType() const;
88  void setWindowRendererType(const String& type);
89 
90  VerticalAlignment getVerticalWidgetAlignment() const;
91  void setVerticalWidgetAlignment(VerticalAlignment alignment);
92 
93  HorizontalAlignment getHorizontalWidgetAlignment() const;
94  void setHorizontalWidgetAlignment(HorizontalAlignment alignment);
95 
96  void addPropertyInitialiser(const PropertyInitialiser& initialiser);
97  void removePropertyInitialiser(const String& name);
98  void clearPropertyInitialisers();
99 
100  void setAutoWindow(bool is_auto);
101  bool isAutoWindow() const;
102 
103  void addEventAction(const EventAction& event_action);
104  void clearEventActions();
105 
106  void layout(const Window& owner) const;
107 
119  void writeXMLToStream(XMLSerializer& xml_stream) const;
120 
130  const PropertyInitialiser* findPropertyInitialiser(const String& propertyName) const;
131 
133  bool handleFontRenderSizeChange(Window& window, const Font* font) const;
134 
139 
140  private:
141  typedef std::vector<PropertyInitialiser
142  CEGUI_VECTOR_ALLOC(PropertyInitialiser)> PropertiesList;
143  typedef std::vector<EventAction
144  CEGUI_VECTOR_ALLOC(EventAction)> EventActionList;
145 
146  public:
147  /*************************************************************************
148  Iterator stuff
149  *************************************************************************/
152 
157  PropertyIterator getPropertyIterator() const;
158 
163  EventActionIterator getEventActionIterator() const;
164 
165  private:
166  ComponentArea d_area;
167  String d_baseType;
168  String d_imageryName;
169  String d_name;
170  String d_rendererType;
171  bool d_autoWindow;
172  VerticalAlignment d_vertAlign;
173  HorizontalAlignment d_horzAlign;
174  PropertiesList d_properties;
175 
176  EventActionList d_eventActions;
177  };
178 
179 } // End of CEGUI namespace section
180 
181 
182 #if defined(_MSC_VER)
183 # pragma warning(pop)
184 #endif
185 
186 #endif // end of guard _CEGUIFalWidgetComponent_h_