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