Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
falagard/XMLHandler.h
1 /***********************************************************************
2  created: Fri Jun 17 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2012 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 _CEGUIFalagard_xmlHandler_h_
28 #define _CEGUIFalagard_xmlHandler_h_
29 
30 #include "../ChainedXMLHandler.h"
31 #include "./Dimensions.h"
32 #include "../Window.h"
33 #include <vector>
34 
35 // Start of CEGUI namespace section
36 namespace CEGUI
37 {
38  // forward refs
39  class WidgetLookManager;
40  class WidgetLookFeel;
41  class WidgetComponent;
42  class ImagerySection;
43  class StateImagery;
44  class LayerSpecification;
45  class SectionSpecification;
46  class ImageryComponent;
47  class ComponentArea;
48  class Dimension;
49  class TextComponent;
50  class NamedArea;
51  class FrameComponent;
52  class PropertyDefinitionBase;
53  class EventLinkDefinition;
54 
60  {
61  public:
67 
73 
75  static const String NativeVersion;
76 
79 
82 
84  static const String GenericDataType;
85 
86 
88  static const String ParentIdentifier;
89 
90  /*************************************************************************
91  XML element and attribute name constants
92  *************************************************************************/
93  // element names
94  static const String FalagardElement;
95  static const String WidgetLookElement;
96  static const String ChildElement;
98  static const String StateImageryElement;
99  static const String LayerElement;
100  static const String SectionElement;
104  static const String AreaElement;
105  static const String ImageElement;
106  static const String ColoursElement;
107  static const String VertFormatElement;
108  static const String HorzFormatElement;
111  static const String PropertyElement;
112  static const String DimElement;
113  static const String UnifiedDimElement;
114  static const String AbsoluteDimElement;
115  static const String ImageDimElement;
117  static const String WidgetDimElement;
118  static const String FontDimElement;
119  static const String PropertyDimElement;
120  static const String TextElement;
123  static const String NamedAreaElement;
127  static const String OperatorDimElement;
134  static const String ColourElement;
137  static const String NamedAreaSourceElement;
141  // attribute names
142  static const String VersionAttribute;
143  static const String TopLeftAttribute;
144  static const String TopRightAttribute;
147  static const String TypeAttribute;
148  static const String NameAttribute;
149  static const String PriorityAttribute;
152  static const String RendererAttribute;
153  static const String LookAttribute;
154  static const String ScaleAttribute;
155  static const String OffsetAttribute;
156  static const String ValueAttribute;
157  static const String DimensionAttribute;
158  static const String WidgetAttribute;
159  static const String StringAttribute;
160  static const String FontAttribute;
162  static const String ClippedAttribute;
163  static const String OperatorAttribute;
164  static const String PaddingAttribute;
169  static const String ColourAttribute;
170  static const String PropertyAttribute;
173  static const String HelpStringAttribute;
176  static const String EventAttribute;
178  static const String InheritsAttribute;
184  static const String ActionAttribute;
187 
188  protected:
189  /*************************************************************************
190  ChainedXMLHandler base class overrides
191  *************************************************************************/
192  void elementStartLocal(const String& element,
193  const XMLAttributes& attributes);
194  void elementEndLocal(const String& element);
195 
196  private:
197  /*************************************************************************
198  Typedefs
199  *************************************************************************/
201  typedef void (Falagard_xmlHandler::*ElementStartHandler)(const XMLAttributes& attributes);
203  typedef void (Falagard_xmlHandler::*ElementEndHandler)();
205  typedef std::map<String, ElementStartHandler, StringFastLessCompare> ElementStartHandlerMap;
207  typedef std::map<String, ElementEndHandler, StringFastLessCompare> ElementEndHandlerMap;
208 
209  /*************************************************************************
210  helper methods
211  **************************************************************************/
212  static argb_t hexStringToARGB(const String& str);
213 
214  /*************************************************************************
215  implementation methods
216  **************************************************************************/
217  void assignAreaDimension(Dimension& dim);
218  void assignColours(const ColourRect& colours);
219 
224  void doBaseDimStart(const BaseDim* dim);
225 
230  void elementFalagardStart(const XMLAttributes& attributes);
231 
236  void elementWidgetLookStart(const XMLAttributes& attributes);
237 
242  void elementChildStart(const XMLAttributes& attributes);
243 
248  void elementImagerySectionStart(const XMLAttributes& attributes);
249 
254  void elementStateImageryStart(const XMLAttributes& attributes);
255 
260  void elementLayerStart(const XMLAttributes& attributes);
261 
266  void elementSectionStart(const XMLAttributes& attributes);
267 
272  void elementImageryComponentStart(const XMLAttributes& attributes);
273 
278  void elementTextComponentStart(const XMLAttributes& attributes);
279 
284  void elementFrameComponentStart(const XMLAttributes& attributes);
285 
290  void elementAreaStart(const XMLAttributes& attributes);
291 
296  void elementImageStart(const XMLAttributes& attributes);
297 
302  void elementColoursStart(const XMLAttributes& attributes);
303 
308  void elementVertFormatStart(const XMLAttributes& attributes);
309 
314  void elementHorzFormatStart(const XMLAttributes& attributes);
315 
320  void elementVertAlignmentStart(const XMLAttributes& attributes);
321 
326  void elementHorzAlignmentStart(const XMLAttributes& attributes);
327 
332  void elementPropertyStart(const XMLAttributes& attributes);
333 
338  void elementDimStart(const XMLAttributes& attributes);
339 
344  void elementUnifiedDimStart(const XMLAttributes& attributes);
345 
350  void elementAbsoluteDimStart(const XMLAttributes& attributes);
351 
356  void elementImageDimStart(const XMLAttributes& attributes);
357 
362  void elementImagePropertyDimStart(const XMLAttributes& attributes);
363 
368  void elementWidgetDimStart(const XMLAttributes& attributes);
369 
374  void elementFontDimStart(const XMLAttributes& attributes);
375 
380  void elementPropertyDimStart(const XMLAttributes& attributes);
381 
386  void elementTextStart(const XMLAttributes& attributes);
387 
392  void elementColourRectPropertyStart(const XMLAttributes& attributes);
393 
398  void elementNamedAreaStart(const XMLAttributes& attributes);
399 
404  void elementPropertyDefinitionStart(const XMLAttributes& attributes);
405 
410  void elementPropertyLinkDefinitionStart(const XMLAttributes& attributes);
411 
416  void elementOperatorDimStart(const XMLAttributes& attributes);
417 
422  void elementVertFormatPropertyStart(const XMLAttributes& attributes);
423 
428  void elementHorzFormatPropertyStart(const XMLAttributes& attributes);
429 
434  void elementAreaPropertyStart(const XMLAttributes& attributes);
435 
440  void elementImagePropertyStart(const XMLAttributes& attributes);
441 
446  void elementTextPropertyStart(const XMLAttributes& attributes);
447 
452  void elementFontPropertyStart(const XMLAttributes& attributes);
453 
458  void elementColourStart(const XMLAttributes& attributes);
459 
461  void elementPropertyLinkTargetStart(const XMLAttributes& attributes);
462 
464  void elementAnimationDefinitionStart(const XMLAttributes& attributes);
465 
467  void elementEventLinkDefinitionStart(const XMLAttributes& attributes);
468 
470  void elementEventLinkTargetStart(const XMLAttributes& attributes);
471 
473  void elementNamedAreaSourceStart(const XMLAttributes& attributes);
475  void elementEventActionStart(const XMLAttributes& attributes);
476 
481  void elementFalagardEnd();
482 
487  void elementWidgetLookEnd();
488 
493  void elementChildEnd();
494 
499  void elementImagerySectionEnd();
500 
505  void elementStateImageryEnd();
506 
511  void elementLayerEnd();
512 
517  void elementSectionEnd();
518 
523  void elementImageryComponentEnd();
524 
529  void elementTextComponentEnd();
530 
535  void elementFrameComponentEnd();
536 
541  void elementAreaEnd();
542 
547  void elementNamedAreaEnd();
548 
553  void elementAnyDimEnd();
554 
556  void elementPropertyLinkDefinitionEnd();
557 
559  void elementEventLinkDefinitionEnd();
560 
565  void registerElementStartHandler(const String& element, ElementStartHandler handler);
566 
571  void registerElementEndHandler(const String& element, ElementEndHandler handler);
572 
574  void processEventLinkTarget(const String& widget, const String& event);
575 
576  /*************************************************************************
577  Implementation Data
578  *************************************************************************/
579  WidgetLookManager* d_manager;
580 
581  // these are used to implement the handler without using a huge
582  // if / else if /else construct, we just register the element name, and
583  // handler member function, and everything else is done using those
584  // mappings.
585  ElementStartHandlerMap d_startHandlersMap;
586  ElementEndHandlerMap d_endHandlersMap;
587 
588  // these hold pointers to various objects under construction.
589  WidgetLookFeel* d_widgetlook;
590  WidgetComponent* d_childcomponent;
591  ImagerySection* d_imagerysection;
592  StateImagery* d_stateimagery;
593  LayerSpecification* d_layer;
594  SectionSpecification* d_section;
595  ImageryComponent* d_imagerycomponent;
596  ComponentArea* d_area;
597  Dimension d_dimension;
598  TextComponent* d_textcomponent;
599  NamedArea* d_namedArea;
600  FrameComponent* d_framecomponent;
601 
602  std::vector<BaseDim*
603  CEGUI_VECTOR_ALLOC(BaseDim*)> d_dimStack;
604 
605  PropertyDefinitionBase* d_propertyLink;
606  EventLinkDefinition* d_eventLink;
607  };
608 
609 } // End of CEGUI namespace section
610 
611 
612 #endif // end of guard _CEGUIFalagard_xmlHandler_h_
613 
static const String GenericDataType
Default or unspecified value for the "dataType" attribute.
Definition: falagard/XMLHandler.h:84
Class that encapsulates information for a text component.
Definition: TextComponent.h:48
static const String TargetPropertyAttribute
Attribute name that stores a name of a target property.
Definition: falagard/XMLHandler.h:167
static const String HelpStringAttribute
Attribute name that stores a help string.
Definition: falagard/XMLHandler.h:174
static const String ScaleAttribute
Attribute name that stores a UDim scale value.
Definition: falagard/XMLHandler.h:154
static const String SectionElement
Tag name for Section elements.
Definition: falagard/XMLHandler.h:100
static const String ClippedAttribute
Attribute name that stores whether some component will be clipped.
Definition: falagard/XMLHandler.h:162
Class that encapsulates a single layer of imagery.
Definition: LayerSpecification.h:45
static const String TypeAttribute
Attribute name that stores a type string.
Definition: falagard/XMLHandler.h:147
Abstract interface for a generic 'dimension' class.
Definition: Dimensions.h:40
static const String EventAttribute
Attribute name that stores an Event name string.
Definition: falagard/XMLHandler.h:176
common base class used for types representing a new property to be available on all widgets that use ...
Definition: PropertyDefinitionBase.h:42
static const String ActionAttribute
Attribute name that stores the name of an action to be taken.
Definition: falagard/XMLHandler.h:184
~Falagard_xmlHandler()
Destructor for Falagard_xmlHandler objects.
Manager class that gives top-level access to widget data based "look and feel" specifications loaded ...
Definition: WidgetLookManager.h:49
Falagard_xmlHandler(WidgetLookManager *mgr)
Constructor for Falagard_xmlHandler objects.
Class representing some kind of dimension.
Definition: Dimensions.h:693
uint32 argb_t
32 bit ARGB representation of a colour.
Definition: Colour.h:38
static const String ControlPropertyAttribute
Attribute name that stores a name of a property to control rendering of a section.
Definition: falagard/XMLHandler.h:168
static const String OperatorAttribute
Attribute name that stores the name of an operator.
Definition: falagard/XMLHandler.h:163
Class that represents a target area for a widget or imagery component.
Definition: Dimensions.h:780
static const String PropertyDefinitionElement
Tag name for property definition elements.
Definition: falagard/XMLHandler.h:124
static const String AreaPropertyElement
Tag name for element that specifies a URect property..
Definition: falagard/XMLHandler.h:130
static const String SectionNameAttribute
Attribute name that stores an imagery section name.
Definition: falagard/XMLHandler.h:150
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:43
static const String HorzAlignmentElement
Tag name for HorzAlignment elements.
Definition: falagard/XMLHandler.h:110
static const String NativeVersion
Stores the native version, the only version we are supposed to load.
Definition: falagard/XMLHandler.h:75
static const String WidgetLookElement
Tag name for WidgetLook elements.
Definition: falagard/XMLHandler.h:95
static const String StringAttribute
Attribute name that stores a string of text.
Definition: falagard/XMLHandler.h:159
NamedArea defines an area for a component which may later be obtained and referenced by a name unique...
Definition: NamedArea.h:40
static const String ColourRectPropertyElement
Tag name for property colour elements (fetches cols from a ColourRect property)
Definition: falagard/XMLHandler.h:122
static const String NamedAreaSourceElement
Tag name for specifying a source named area for a component.
Definition: falagard/XMLHandler.h:138
Class the encapsulates imagery for a given widget state.
Definition: StateImagery.h:46
static const String ComponentAttribute
Attribute name that stores some component enum value.
Definition: falagard/XMLHandler.h:186
void elementEndLocal(const String &element)
Function that handles elements locally (used at end of handler chain)
static const String NamedAreaElement
Tag name for named area elements.
Definition: falagard/XMLHandler.h:123
Class that encapsulates information for a single image component.
Definition: ImageryComponent.h:46
Class that represents a simple 'link' to an ImagerySection.
Definition: SectionSpecification.h:47
static const String ImagePropertyDimElement
Tag name for image property dimension elements.
Definition: falagard/XMLHandler.h:116
static const String LayoutOnWriteAttribute
Attribute name that stores whether to layout on write of a property.
Definition: falagard/XMLHandler.h:165
static const String AutoWindowAttribute
Attribute name that stores auto-window preference.
Definition: falagard/XMLHandler.h:180
static const String ValueAttribute
Attribute name that stores a property value string.
Definition: falagard/XMLHandler.h:156
static const String PropertyDefinitionHelpDefaultValue
Default value for the "type" attribute of PropertyDefinition elements.
Definition: falagard/XMLHandler.h:78
static const String ColourAttribute
Attribute name that stores colour for all corners.
Definition: falagard/XMLHandler.h:169
static const String ColourPropertyElement
Tag name for property colour elements (fetches cols from a colour property)
Definition: falagard/XMLHandler.h:121
static const String TopLeftAttribute
Attribute name that stores colour for top-left corner.
Definition: falagard/XMLHandler.h:143
static const String BottomRightAttribute
Attribute name that stores colour for bottom-right corner.
Definition: falagard/XMLHandler.h:146
static const String ImagerySectionElement
Tag name for ImagerySection elements.
Definition: falagard/XMLHandler.h:97
Class that encapsulates information regarding a sub-widget required for a widget. ...
Definition: WidgetComponent.h:50
static const String OperatorDimElement
Tag name for dimension operator elements.
Definition: falagard/XMLHandler.h:127
static const String AbsoluteDimElement
Tag name for absolute dimension elements.
Definition: falagard/XMLHandler.h:114
static const String ImageryComponentElement
Tag name for ImageryComponent elements.
Definition: falagard/XMLHandler.h:101
static const String RendererAttribute
Attribute name that stores the name of a window renderer factory.
Definition: falagard/XMLHandler.h:152
static const String FontPropertyElement
Tag name for element that specifies an Font property.
Definition: falagard/XMLHandler.h:133
static const String HorzFormatElement
Tag name for HorzFormat elements.
Definition: falagard/XMLHandler.h:108
static const String EventLinkTargetElement
Definition: falagard/XMLHandler.h:136
static const String EventLinkDefinitionElement
Tag name for event link elements.
Definition: falagard/XMLHandler.h:135
static const String TextElement
Tag name for text component text elements.
Definition: falagard/XMLHandler.h:120
static const String StateImageryElement
Tag name for StateImagery elements.
Definition: falagard/XMLHandler.h:98
static const String ColourElement
Tag name for Colour elements.
Definition: falagard/XMLHandler.h:134
static const String ImagePropertyElement
Tag name for element that specifies an Image property..
Definition: falagard/XMLHandler.h:131
static const String AreaElement
Tag name for Area elements.
Definition: falagard/XMLHandler.h:104
static const String EventActionElement
Tag name for specifying event / action responses for Child components.
Definition: falagard/XMLHandler.h:140
static const String PropertyLinkDefinitionElement
Tag name for property link elements.
Definition: falagard/XMLHandler.h:125
static const String FalagardElement
Tag name for root Falagard elements.
Definition: falagard/XMLHandler.h:94
Class representing a block of attributes associated with an XML element.
Definition: XMLAttributes.h:46
static const String DimensionAttribute
Attribute name that stores a dimension type.
Definition: falagard/XMLHandler.h:157
static const String VertFormatPropertyElement
Tag name for element that specifies a vertical formatting property.
Definition: falagard/XMLHandler.h:128
static const String VersionAttribute
Attribute name that stores the version number of the Falagard element containing the WidgetLookFeels...
Definition: falagard/XMLHandler.h:142
Handler class used to parse look & feel XML files used by the Falagard system.
Definition: falagard/XMLHandler.h:59
static const String HorzFormatPropertyElement
Tag name for element that specifies a horizontal formatting property..
Definition: falagard/XMLHandler.h:129
static const String PropertyAttribute
Attribute name that stores the name of a property.
Definition: falagard/XMLHandler.h:170
static const String ChildElement
Tag name for Child elements.
Definition: falagard/XMLHandler.h:96
static const String OffsetAttribute
Attribute name that stores a UDim offset value.
Definition: falagard/XMLHandler.h:155
static const String BottomLeftAttribute
Attribute name that stores colour for bottom-left corner.
Definition: falagard/XMLHandler.h:145
static const String ColoursElement
Tag name for Colours elements.
Definition: falagard/XMLHandler.h:106
static const String VertAlignmentElement
Tag name for VertAlignment elements.
Definition: falagard/XMLHandler.h:109
void elementStartLocal(const String &element, const XMLAttributes &attributes)
Function that handles elements locally (used at end of handler chain)
static const String VertFormatElement
Tag name for VertFormat elements.
Definition: falagard/XMLHandler.h:107
Class that encapsulates look & feel information for a particular widget type.
Definition: WidgetLookFeel.h:55
static const String TextPropertyElement
Tag name for element that specifies an Text property.
Definition: falagard/XMLHandler.h:132
static const String TopRightAttribute
Attribute name that stores colour for top-right corner.
Definition: falagard/XMLHandler.h:144
static const String ControlValueAttribute
Attribute name that stores a test value to control rendering of a section.
Definition: falagard/XMLHandler.h:171
static const String PropertyLinkDefinitionHelpDefaultValue
Default value for the "type" attribute of PropertyLinkDefinition elements.
Definition: falagard/XMLHandler.h:81
static const String RedrawOnWriteAttribute
Attribute name that stores whether to redraw on write of a property.
Definition: falagard/XMLHandler.h:166
static const String WidgetAttribute
Attribute name that stores the name of a widget (suffix).
Definition: falagard/XMLHandler.h:158
static const String FrameComponentElement
Tag name for FrameComponent elements.
Definition: falagard/XMLHandler.h:103
static const String UnifiedDimElement
Tag name for unified dimension elements.
Definition: falagard/XMLHandler.h:113
Class that encapsulates information for a frame with background (9 images in total) ...
Definition: FrameComponent.h:51
static const String PropertyDimElement
Tag name for property dimension elements.
Definition: falagard/XMLHandler.h:119
static const String NameAttribute
Attribute name that stores name string.
Definition: falagard/XMLHandler.h:148
Abstract XMLHandler based class.
Definition: ChainedXMLHandler.h:36
static const String LookAttribute
Attribute name that stores the name of a widget look.
Definition: falagard/XMLHandler.h:153
static const String PaddingAttribute
Attribute name that stores some padding value..
Definition: falagard/XMLHandler.h:164
static const String FireEventAttribute
Attribute name that stores name of event to fire for property defs.
Definition: falagard/XMLHandler.h:182
Class that encapsulates a re-usable collection of imagery specifications.
Definition: ImagerySection.h:47
static const String WidgetDimElement
Tag name for widget dimension elements.
Definition: falagard/XMLHandler.h:117
Definition: EventLinkDefinition.h:43
static const String FontAttribute
Attribute name that stores the name of a font.
Definition: falagard/XMLHandler.h:160
static const String LayerElement
Tag name for Layer elements.
Definition: falagard/XMLHandler.h:99
static const String PropertyElement
Tag name for Property elements.
Definition: falagard/XMLHandler.h:111
static const String InheritsAttribute
Attribute name that stores the name of an inherited WidgetLook.
Definition: falagard/XMLHandler.h:178
static const String DimElement
Tag name for dimension container elements.
Definition: falagard/XMLHandler.h:112
static const String FontDimElement
Tag name for font dimension elements.
Definition: falagard/XMLHandler.h:118
static const String ImageElement
Tag name for Image elements.
Definition: falagard/XMLHandler.h:105
static const String TextComponentElement
Tag name for TextComponent elements.
Definition: falagard/XMLHandler.h:102
static const String ImageDimElement
Tag name for image dimension elements.
Definition: falagard/XMLHandler.h:115
static const String ParentIdentifier
String value representing a parent link identifier.
Definition: falagard/XMLHandler.h:88
static const String PropertyLinkTargetElement
Tag name for property link target elements.
Definition: falagard/XMLHandler.h:126
static const String PriorityAttribute
Attribute name that stores an integer priority.
Definition: falagard/XMLHandler.h:149
String class used within the GUI system.
Definition: String.h:62
static const String NameSuffixAttribute
Attribute name that stores a widget name suffix.
Definition: falagard/XMLHandler.h:151
static const String ControlWidgetAttribute
Definition: falagard/XMLHandler.h:172
static const String InitialValueAttribute
Attribute name that stores the initial default value for a property definition.
Definition: falagard/XMLHandler.h:161