Crazy Eddie's GUI System  0.8.7
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 
158 
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;
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_
Definition: MemoryAllocatedObject.h:110
Class that represents a target area for a widget or imagery component.
Definition: Dimensions.h:782
iterator for vectors
Definition: IteratorBase.h:288
Definition: EventAction.h:47
Class that encapsulates a typeface.
Definition: Font.h:62
Class that holds information about a property and it's required initial value.
Definition: PropertyInitialiser.h:42
String class used within the GUI system.
Definition: String.h:64
Class that encapsulates information regarding a sub-widget required for a widget.
Definition: WidgetComponent.h:52
void create(Window &parent) const
Create an instance of this widget component adding it as a child to the given Window.
PropertyIterator getPropertyIterator() const
bool handleFontRenderSizeChange(Window &window, const Font *font) const
perform any processing required due to the given font having changed.
const PropertyInitialiser * findPropertyInitialiser(const String &propertyName) const
Takes the name of a property and returns a pointer to the last PropertyInitialiser for this property ...
static const VerticalAlignment VerticalAlignmentDefault
Default value for the VertAlignment elements of the WidgetComponent.
Definition: WidgetComponent.h:138
void writeXMLToStream(XMLSerializer &xml_stream) const
Writes an xml representation of this WidgetComponent to out_stream.
static const HorizontalAlignment HorizontalAlignmentDefault
Default value for the HorzAlignment elements of the WidgetComponent.
Definition: WidgetComponent.h:136
void cleanup(Window &parent) const
Cleanup from the given parent widget, the instance of the child created for this WidgetComponent.
EventActionIterator getEventActionIterator() const
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
Class used to create XML Document.
Definition: XMLSerializer.h:87
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
HorizontalAlignment
Enumerated type used when specifying horizontal alignments for Element.
Definition: Element.h:53
VerticalAlignment
Enumerated type used when specifying vertical alignments for Element.
Definition: Element.h:131