Crazy Eddies GUI System  0.7.8
CEGUIFalagard_xmlHandler.h
1 /***********************************************************************
2  filename: CEGUIFalagard_xmlHandler.h
3  created: Fri Jun 17 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 _CEGUIFalagard_xmlHandler_h_
29 #define _CEGUIFalagard_xmlHandler_h_
30 
31 #include "../CEGUIChainedXMLHandler.h"
32 #include "../CEGUIcolour.h"
33 #include "CEGUIFalDimensions.h"
34 #include "../CEGUIWindow.h"
35 #include <vector>
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
40  // forward refs
41  class WidgetLookManager;
42  class WidgetLookFeel;
43  class WidgetComponent;
44  class ImagerySection;
45  class StateImagery;
46  class LayerSpecification;
47  class SectionSpecification;
48  class ImageryComponent;
49  class ComponentArea;
50  class Dimension;
51  class TextComponent;
52  class NamedArea;
53  class FrameComponent;
54  class PropertyLinkDefinition;
55 
61  {
62  public:
68 
74 
75  protected:
76  /*************************************************************************
77  ChainedXMLHandler base class overrides
78  *************************************************************************/
79  void elementStartLocal(const String& element,
80  const XMLAttributes& attributes);
81  void elementEndLocal(const String& element);
82 
83  private:
84  /*************************************************************************
85  Typedefs
86  *************************************************************************/
88  typedef void (Falagard_xmlHandler::*ElementStartHandler)(const XMLAttributes& attributes);
90  typedef void (Falagard_xmlHandler::*ElementEndHandler)();
92  typedef std::map<String, ElementStartHandler, String::FastLessCompare> ElementStartHandlerMap;
94  typedef std::map<String, ElementEndHandler, String::FastLessCompare> ElementEndHandlerMap;
95 
96  /*************************************************************************
97  Implementation Constants
98  *************************************************************************/
99  // element names
100  static const String FalagardElement;
101  static const String WidgetLookElement;
102  static const String ChildElement;
103  static const String ImagerySectionElement;
104  static const String StateImageryElement;
105  static const String LayerElement;
106  static const String SectionElement;
107  static const String ImageryComponentElement;
108  static const String TextComponentElement;
109  static const String FrameComponentElement;
110  static const String AreaElement;
111  static const String ImageElement;
112  static const String ColoursElement;
113  static const String VertFormatElement;
114  static const String HorzFormatElement;
115  static const String VertAlignmentElement;
116  static const String HorzAlignmentElement;
117  static const String PropertyElement;
118  static const String DimElement;
119  static const String UnifiedDimElement;
120  static const String AbsoluteDimElement;
121  static const String ImageDimElement;
122  static const String WidgetDimElement;
123  static const String FontDimElement;
124  static const String PropertyDimElement;
125  static const String TextElement;
126  static const String ColourPropertyElement;
127  static const String ColourRectPropertyElement;
128  static const String NamedAreaElement;
129  static const String PropertyDefinitionElement;
130  static const String PropertyLinkDefinitionElement;
131  static const String PropertyLinkTargetElement;
132  static const String DimOperatorElement;
133  static const String VertFormatPropertyElement;
134  static const String HorzFormatPropertyElement;
135  static const String AreaPropertyElement;
136  static const String ImagePropertyElement;
137  static const String TextPropertyElement;
138  static const String FontPropertyElement;
139  static const String ColourElement;
140  // attribute names
141  static const String TopLeftAttribute;
142  static const String TopRightAttribute;
143  static const String BottomLeftAttribute;
144  static const String BottomRightAttribute;
145  static const String ImagesetAttribute;
146  static const String ImageAttribute;
147  static const String TypeAttribute;
148  static const String NameAttribute;
149  static const String PriorityAttribute;
150  static const String SectionNameAttribute;
151  static const String NameSuffixAttribute;
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;
161  static const String InitialValueAttribute;
162  static const String ClippedAttribute;
163  static const String OperatorAttribute;
164  static const String PaddingAttribute;
165  static const String LayoutOnWriteAttribute;
166  static const String RedrawOnWriteAttribute;
167  static const String TargetPropertyAttribute;
168  static const String ControlPropertyAttribute;
169  static const String ColourAttribute;
170  static const String PropertyAttribute;
171  static const String ControlValueAttribute;
172  static const String ControlWidgetAttribute;
173 
174  static const String HelpStringAttribute;
175 
176  /*************************************************************************
177  helper methods
178  **************************************************************************/
179  static argb_t hexStringToARGB(const String& str);
180 
181  /*************************************************************************
182  implementation methods
183  **************************************************************************/
184  void assignAreaDimension(Dimension& dim);
185  void assignColours(const ColourRect& colours);
186 
191  void doBaseDimStart(const BaseDim* dim);
192 
197  void elementFalagardStart(const XMLAttributes& attributes);
198 
203  void elementWidgetLookStart(const XMLAttributes& attributes);
204 
209  void elementChildStart(const XMLAttributes& attributes);
210 
215  void elementImagerySectionStart(const XMLAttributes& attributes);
216 
221  void elementStateImageryStart(const XMLAttributes& attributes);
222 
227  void elementLayerStart(const XMLAttributes& attributes);
228 
233  void elementSectionStart(const XMLAttributes& attributes);
234 
239  void elementImageryComponentStart(const XMLAttributes& attributes);
240 
245  void elementTextComponentStart(const XMLAttributes& attributes);
246 
251  void elementFrameComponentStart(const XMLAttributes& attributes);
252 
257  void elementAreaStart(const XMLAttributes& attributes);
258 
263  void elementImageStart(const XMLAttributes& attributes);
264 
269  void elementColoursStart(const XMLAttributes& attributes);
270 
275  void elementVertFormatStart(const XMLAttributes& attributes);
276 
281  void elementHorzFormatStart(const XMLAttributes& attributes);
282 
287  void elementVertAlignmentStart(const XMLAttributes& attributes);
288 
293  void elementHorzAlignmentStart(const XMLAttributes& attributes);
294 
299  void elementPropertyStart(const XMLAttributes& attributes);
300 
305  void elementDimStart(const XMLAttributes& attributes);
306 
311  void elementUnifiedDimStart(const XMLAttributes& attributes);
312 
317  void elementAbsoluteDimStart(const XMLAttributes& attributes);
318 
323  void elementImageDimStart(const XMLAttributes& attributes);
324 
329  void elementWidgetDimStart(const XMLAttributes& attributes);
330 
335  void elementFontDimStart(const XMLAttributes& attributes);
336 
341  void elementPropertyDimStart(const XMLAttributes& attributes);
342 
347  void elementTextStart(const XMLAttributes& attributes);
348 
353  void elementColourPropertyStart(const XMLAttributes& attributes);
354 
359  void elementColourRectPropertyStart(const XMLAttributes& attributes);
360 
365  void elementNamedAreaStart(const XMLAttributes& attributes);
366 
371  void elementPropertyDefinitionStart(const XMLAttributes& attributes);
372 
377  void elementPropertyLinkDefinitionStart(const XMLAttributes& attributes);
378 
383  void elementDimOperatorStart(const XMLAttributes& attributes);
384 
389  void elementVertFormatPropertyStart(const XMLAttributes& attributes);
390 
395  void elementHorzFormatPropertyStart(const XMLAttributes& attributes);
396 
401  void elementAreaPropertyStart(const XMLAttributes& attributes);
402 
407  void elementImagePropertyStart(const XMLAttributes& attributes);
408 
413  void elementTextPropertyStart(const XMLAttributes& attributes);
414 
419  void elementFontPropertyStart(const XMLAttributes& attributes);
420 
425  void elementColourStart(const XMLAttributes& attributes);
426 
428  void elementPropertyLinkTargetStart(const XMLAttributes& attributes);
429 
431  void elementAnimationDefinitionStart(const XMLAttributes& attributes);
432 
437  void elementFalagardEnd();
438 
443  void elementWidgetLookEnd();
444 
449  void elementChildEnd();
450 
455  void elementImagerySectionEnd();
456 
461  void elementStateImageryEnd();
462 
467  void elementLayerEnd();
468 
473  void elementSectionEnd();
474 
479  void elementImageryComponentEnd();
480 
485  void elementTextComponentEnd();
486 
491  void elementFrameComponentEnd();
492 
497  void elementAreaEnd();
498 
503  void elementNamedAreaEnd();
504 
509  void elementAnyDimEnd();
510 
512  void elementPropertyLinkDefinitionEnd();
513 
518  void registerElementStartHandler(const String& element, ElementStartHandler handler);
519 
524  void registerElementEndHandler(const String& element, ElementEndHandler handler);
525 
526  /*************************************************************************
527  Implementation Data
528  *************************************************************************/
529  WidgetLookManager* d_manager;
530 
531  // these are used to implement the handler without using a huge
532  // if / else if /else construct, we just register the element name, and
533  // handler member function, and everything else is done using those
534  // mappings.
535  ElementStartHandlerMap d_startHandlersMap;
536  ElementEndHandlerMap d_endHandlersMap;
537 
538  // these hold pointers to various objects under construction.
539  WidgetLookFeel* d_widgetlook;
540  WidgetComponent* d_childcomponent;
541  ImagerySection* d_imagerysection;
542  StateImagery* d_stateimagery;
543  LayerSpecification* d_layer;
544  SectionSpecification* d_section;
545  ImageryComponent* d_imagerycomponent;
546  ComponentArea* d_area;
547  Dimension d_dimension;
548  TextComponent* d_textcomponent;
549  NamedArea* d_namedArea;
550  FrameComponent* d_framecomponent;
551 
552  std::vector<BaseDim*> d_dimStack;
553 
554  PropertyLinkDefinition* d_propertyLink;
555  };
556 
557 } // End of CEGUI namespace section
558 
559 
560 #endif // end of guard _CEGUIFalagard_xmlHandler_h_
561