CEGUIFalagard_xmlHandler.h

00001 /***********************************************************************
00002     filename:   CEGUIFalagard_xmlHandler.h
00003     created:    Fri Jun 17 2005
00004     author:     Paul D Turner <paul@cegui.org.uk>
00005 *************************************************************************/
00006 /***************************************************************************
00007  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00008  *
00009  *   Permission is hereby granted, free of charge, to any person obtaining
00010  *   a copy of this software and associated documentation files (the
00011  *   "Software"), to deal in the Software without restriction, including
00012  *   without limitation the rights to use, copy, modify, merge, publish,
00013  *   distribute, sublicense, and/or sell copies of the Software, and to
00014  *   permit persons to whom the Software is furnished to do so, subject to
00015  *   the following conditions:
00016  *
00017  *   The above copyright notice and this permission notice shall be
00018  *   included in all copies or substantial portions of the Software.
00019  *
00020  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00021  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00022  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00023  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00024  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00025  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00026  *   OTHER DEALINGS IN THE SOFTWARE.
00027  ***************************************************************************/
00028 #ifndef _CEGUIFalagard_xmlHandler_h_
00029 #define _CEGUIFalagard_xmlHandler_h_
00030 
00031 #include "CEGUIXMLHandler.h"
00032 #include "CEGUIcolour.h"
00033 #include "falagard/CEGUIFalDimensions.h"
00034 #include "CEGUIWindow.h"
00035 #include <vector>
00036 
00037 // Start of CEGUI namespace section
00038 namespace CEGUI
00039 {
00040     // forward refs
00041     class WidgetLookManager;
00042     class WidgetLookFeel;
00043     class WidgetComponent;
00044     class ImagerySection;
00045     class StateImagery;
00046     class LayerSpecification;
00047     class SectionSpecification;
00048     class ImageryComponent;
00049     class ComponentArea;
00050     class Dimension;
00051     class TextComponent;
00052     class NamedArea;
00053     class FrameComponent;
00054 
00059     class Falagard_xmlHandler : public XMLHandler
00060     {
00061     public:
00066         Falagard_xmlHandler(WidgetLookManager* mgr);
00067 
00072         ~Falagard_xmlHandler();
00073 
00074         /*************************************************************************
00075             XMLHandler base class overrides
00076         *************************************************************************/
00077         void elementStart(const String& element, const XMLAttributes& attributes);
00078         void elementEnd(const String& element);
00079 
00080     private:
00081         /*************************************************************************
00082             Typedefs
00083         *************************************************************************/
00085         typedef void (Falagard_xmlHandler::*ElementStartHandler)(const XMLAttributes& attributes);
00087         typedef void (Falagard_xmlHandler::*ElementEndHandler)();
00089         typedef std::map<String, ElementStartHandler, String::FastLessCompare> ElementStartHandlerMap;
00091         typedef std::map<String, ElementEndHandler, String::FastLessCompare> ElementEndHandlerMap;
00092 
00093         /*************************************************************************
00094             Implementation Constants
00095         *************************************************************************/
00096         // element names
00097         static const String FalagardElement;            
00098         static const String WidgetLookElement;          
00099         static const String ChildElement;               
00100         static const String ImagerySectionElement;      
00101         static const String StateImageryElement;        
00102         static const String LayerElement;               
00103         static const String SectionElement;             
00104         static const String ImageryComponentElement;    
00105         static const String TextComponentElement;       
00106         static const String FrameComponentElement;      
00107         static const String AreaElement;                
00108         static const String ImageElement;               
00109         static const String ColoursElement;             
00110         static const String VertFormatElement;          
00111         static const String HorzFormatElement;          
00112         static const String VertAlignmentElement;       
00113         static const String HorzAlignmentElement;       
00114         static const String PropertyElement;            
00115                 static const String DimElement;                 
00116                 static const String UnifiedDimElement;          
00117         static const String AbsoluteDimElement;         
00118         static const String ImageDimElement;            
00119         static const String WidgetDimElement;           
00120         static const String FontDimElement;             
00121         static const String PropertyDimElement;         
00122         static const String TextElement;                
00123         static const String ColourPropertyElement;      
00124         static const String ColourRectPropertyElement;  
00125         static const String NamedAreaElement;           
00126         static const String PropertyDefinitionElement;  
00127         static const String PropertyLinkDefinitionElement;  
00128         static const String DimOperatorElement;         
00129         static const String VertFormatPropertyElement;  
00130         static const String HorzFormatPropertyElement;  
00131         static const String AreaPropertyElement;        
00132         static const String ImagePropertyElement;       
00133         static const String TextPropertyElement;        
00134         static const String FontPropertyElement;        
00135         static const String ColourElement;              
00136         // attribute names
00137         static const String TopLeftAttribute;           
00138         static const String TopRightAttribute;          
00139         static const String BottomLeftAttribute;        
00140         static const String BottomRightAttribute;       
00141         static const String ImagesetAttribute;          
00142         static const String ImageAttribute;             
00143         static const String TypeAttribute;              
00144         static const String NameAttribute;              
00145         static const String PriorityAttribute;          
00146         static const String SectionNameAttribute;       
00147         static const String NameSuffixAttribute;        
00148         static const String RendererAttribute;          
00149         static const String LookAttribute;              
00150         static const String ScaleAttribute;             
00151         static const String OffsetAttribute;            
00152         static const String ValueAttribute;             
00153         static const String DimensionAttribute;         
00154         static const String WidgetAttribute;            
00155         static const String StringAttribute;            
00156         static const String FontAttribute;              
00157         static const String InitialValueAttribute;      
00158         static const String ClippedAttribute;           
00159         static const String OperatorAttribute;          
00160         static const String PaddingAttribute;           
00161         static const String LayoutOnWriteAttribute;     
00162         static const String RedrawOnWriteAttribute;     
00163         static const String TargetPropertyAttribute;    
00164         static const String ControlPropertyAttribute;   
00165         static const String ColourAttribute;            
00166 
00167         /*************************************************************************
00168             helper methods
00169         **************************************************************************/
00170         static argb_t hexStringToARGB(const String& str);
00171 
00172         /*************************************************************************
00173             implementation methods
00174         **************************************************************************/
00175         void assignAreaDimension(Dimension& dim);
00176         void assignColours(const ColourRect& colours);
00177 
00182         void doBaseDimStart(const BaseDim* dim);
00183 
00188         void elementFalagardStart(const XMLAttributes& attributes);
00189 
00194         void elementWidgetLookStart(const XMLAttributes& attributes);
00195 
00200         void elementChildStart(const XMLAttributes& attributes);
00201 
00206         void elementImagerySectionStart(const XMLAttributes& attributes);
00207 
00212         void elementStateImageryStart(const XMLAttributes& attributes);
00213 
00218         void elementLayerStart(const XMLAttributes& attributes);
00219 
00224         void elementSectionStart(const XMLAttributes& attributes);
00225 
00230         void elementImageryComponentStart(const XMLAttributes& attributes);
00231 
00236         void elementTextComponentStart(const XMLAttributes& attributes);
00237 
00242         void elementFrameComponentStart(const XMLAttributes& attributes);
00243 
00248         void elementAreaStart(const XMLAttributes& attributes);
00249 
00254         void elementImageStart(const XMLAttributes& attributes);
00255 
00260         void elementColoursStart(const XMLAttributes& attributes);
00261 
00266         void elementVertFormatStart(const XMLAttributes& attributes);
00267 
00272         void elementHorzFormatStart(const XMLAttributes& attributes);
00273 
00278         void elementVertAlignmentStart(const XMLAttributes& attributes);
00279 
00284         void elementHorzAlignmentStart(const XMLAttributes& attributes);
00285 
00290         void elementPropertyStart(const XMLAttributes& attributes);
00291 
00296         void elementDimStart(const XMLAttributes& attributes);
00297 
00302         void elementUnifiedDimStart(const XMLAttributes& attributes);
00303 
00308         void elementAbsoluteDimStart(const XMLAttributes& attributes);
00309 
00314         void elementImageDimStart(const XMLAttributes& attributes);
00315 
00320         void elementWidgetDimStart(const XMLAttributes& attributes);
00321 
00326         void elementFontDimStart(const XMLAttributes& attributes);
00327 
00332         void elementPropertyDimStart(const XMLAttributes& attributes);
00333 
00338         void elementTextStart(const XMLAttributes& attributes);
00339 
00344         void elementColourPropertyStart(const XMLAttributes& attributes);
00345 
00350         void elementColourRectPropertyStart(const XMLAttributes& attributes);
00351 
00356         void elementNamedAreaStart(const XMLAttributes& attributes);
00357 
00362         void elementPropertyDefinitionStart(const XMLAttributes& attributes);
00363 
00368         void elementPropertyLinkDefinitionStart(const XMLAttributes& attributes);
00369 
00374         void elementDimOperatorStart(const XMLAttributes& attributes);
00375 
00380         void elementVertFormatPropertyStart(const XMLAttributes& attributes);
00381 
00386         void elementHorzFormatPropertyStart(const XMLAttributes& attributes);
00387 
00392         void elementAreaPropertyStart(const XMLAttributes& attributes);
00393 
00398         void elementImagePropertyStart(const XMLAttributes& attributes);
00399 
00404         void elementTextPropertyStart(const XMLAttributes& attributes);
00405 
00410         void elementFontPropertyStart(const XMLAttributes& attributes);
00411 
00416         void elementColourStart(const XMLAttributes& attributes);
00417 
00422         void elementFalagardEnd();
00423 
00428         void elementWidgetLookEnd();
00429 
00434         void elementChildEnd();
00435 
00440         void elementImagerySectionEnd();
00441 
00446         void elementStateImageryEnd();
00447 
00452         void elementLayerEnd();
00453 
00458         void elementSectionEnd();
00459 
00464         void elementImageryComponentEnd();
00465 
00470         void elementTextComponentEnd();
00471 
00476         void elementFrameComponentEnd();
00477 
00482         void elementAreaEnd();
00483 
00488         void elementNamedAreaEnd();
00489 
00494         void elementAnyDimEnd();
00495 
00500         void registerElementStartHandler(const String& element, ElementStartHandler handler);
00501 
00506         void registerElementEndHandler(const String& element, ElementEndHandler handler);
00507 
00508         /*************************************************************************
00509             Implementation Data
00510         *************************************************************************/
00511         WidgetLookManager* d_manager;
00512 
00513         // these are used to implement the handler without using a huge
00514         // if / else if /else construct, we just register the element name, and
00515         // handler member function, and everything else is done using those
00516         // mappings.
00517         ElementStartHandlerMap  d_startHandlersMap;
00518         ElementEndHandlerMap    d_endHandlersMap;
00519 
00520         // these hold pointers to various objects under construction.
00521         WidgetLookFeel*     d_widgetlook;
00522         WidgetComponent*    d_childcomponent;
00523         ImagerySection*     d_imagerysection;
00524         StateImagery*       d_stateimagery;
00525         LayerSpecification* d_layer;
00526         SectionSpecification* d_section;
00527         ImageryComponent*   d_imagerycomponent;
00528         ComponentArea*   d_area;
00529         Dimension       d_dimension;
00530         TextComponent*  d_textcomponent;
00531         NamedArea*      d_namedArea;
00532         FrameComponent*  d_framecomponent;
00533 
00534         std::vector<BaseDim*>    d_dimStack;
00535     };
00536 
00537 } // End of  CEGUI namespace section
00538 
00539 
00540 #endif  // end of guard _CEGUIFalagard_xmlHandler_h_

Generated on Sun Nov 5 14:35:28 2006 for Crazy Eddies GUI System by  doxygen 1.4.7