Crazy Eddie's GUI System  0.8.7
GUILayout_xmlHandler.h
1 /***********************************************************************
2  created: 5/7/2004
3  author: Paul D Turner
4 
5  purpose: Interface to XML parser for GUILayout files
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIGUILayout_xmlHandler_h_
30 #define _CEGUIGUILayout_xmlHandler_h_
31 
32 #include "CEGUI/WindowManager.h"
33 #include "CEGUI/Window.h"
34 #include "CEGUI/XMLHandler.h"
35 
36 #include <vector>
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
46 {
47  typedef WindowManager::PropertyCallback PropertyCallback;
48 public:
49  static const String NativeVersion;
50 
51  /*************************************************************************
52  Construction & Destruction
53  *************************************************************************/
58  GUILayout_xmlHandler(PropertyCallback* callback = 0, void* userdata = 0) :
59  d_root(0),
60  d_propertyCallback(callback),
61  d_userData(userdata)
62  {}
63 
68  virtual ~GUILayout_xmlHandler(void) {}
69 
70  virtual const String& getSchemaName() const;
71  virtual const String& getDefaultResourceGroup() const;
72 
73  /*************************************************************************
74  SAX2 Handler overrides
75  *************************************************************************/
80  virtual void elementStart(const String& element, const XMLAttributes& attributes);
81  virtual void elementEnd(const String& element);
82  virtual void text(const String& text);
83 
84  /*************************************************************************
85  Functions used by our implementation
86  *************************************************************************/
92 
93 
99 
100  static const String GUILayoutElement;
102  static const String EventElement;
105  static const String EventNameAttribute;
108 
109 private:
118  void elementGUILayoutStart(const XMLAttributes& attributes);
119 
124  void elementWindowStart(const XMLAttributes& attributes);
125 
130  void elementAutoWindowStart(const XMLAttributes& attributes);
131 
136  void elementUserStringStart(const XMLAttributes& attributes);
137 
142  void elementPropertyStart(const XMLAttributes& attributes);
143 
148  void elementLayoutImportStart(const XMLAttributes& attributes);
149 
154  void elementEventStart(const XMLAttributes& attributes);
155 
160  void elementWindowEnd();
161 
166  void elementAutoWindowEnd();
167 
172  void elementUserStringEnd();
173 
178  void elementPropertyEnd();
179 
180  void operator=(const GUILayout_xmlHandler&) {}
181 
182  /*************************************************************************
183  Implementation Data
184  *************************************************************************/
185  typedef std::pair<Window*, bool> WindowStackEntry;
186  typedef std::vector<WindowStackEntry
187  CEGUI_VECTOR_ALLOC(WindowStackEntry)> WindowStack;
188  Window* d_root;
189  WindowStack d_stack;
190  PropertyCallback* d_propertyCallback;
191  void* d_userData;
192  String d_stringItemName;
193  String d_stringItemValue;
194 };
195 
196 
197 } // End of CEGUI namespace section
198 
199 
200 #endif // end of guard _CEGUIGUILayout_xmlHandler_h_
Handler class used to parse the GUILayout XML files using SAX2.
Definition: GUILayout_xmlHandler.h:46
static const String LayoutImportResourceGroupAttribute
Attribute name that stores the resource group identifier used when loading imported file.
Definition: GUILayout_xmlHandler.h:104
static const String GUILayoutElement
Tag name for GUILayout elements.
Definition: GUILayout_xmlHandler.h:100
virtual ~GUILayout_xmlHandler(void)
Destructor for GUILayout_xmlHandler objects.
Definition: GUILayout_xmlHandler.h:68
virtual const String & getDefaultResourceGroup() const
Retrieves the default resource group to be used when handling files.
static const String EventNameAttribute
Attribute name that stores the event name to be subscribed.
Definition: GUILayout_xmlHandler.h:105
static const String EventElement
Tag name for Event elements.
Definition: GUILayout_xmlHandler.h:102
virtual const String & getSchemaName() const
Retrieves the schema file name to use with resources handled by this handler.
static const String EventFunctionAttribute
Attribute name that stores the name of the scripted function to be bound.
Definition: GUILayout_xmlHandler.h:106
virtual void elementEnd(const String &element)
Method called to notify the handler at the end of each XML element encountered.
virtual void elementStart(const String &element, const XMLAttributes &attributes)
document processing (only care about elements, schema validates format)
static const String LayoutImportFilenameAttribute
Attribute name that stores the file name of the layout to import.
Definition: GUILayout_xmlHandler.h:103
static const String GUILayoutVersionAttribute
Attribute name that stores the xml file version.
Definition: GUILayout_xmlHandler.h:107
static const String LayoutImportElement
Tag name for LayoutImport elements.
Definition: GUILayout_xmlHandler.h:101
GUILayout_xmlHandler(PropertyCallback *callback=0, void *userdata=0)
Constructor for GUILayout_xmlHandler objects.
Definition: GUILayout_xmlHandler.h:58
static const String NativeVersion
The only version that we will allow to load.
Definition: GUILayout_xmlHandler.h:49
virtual void text(const String &text)
Method called to notify text node, several successiv text node are agregated.
Window * getLayoutRootWindow(void) const
Return a pointer to the 'root' window created.
void cleanupLoadedWindows(void)
Destroy all windows created so far.
String class used within the GUI system.
Definition: String.h:64
bool PropertyCallback(Window *window, String &propname, String &propvalue, void *userdata)
Function type that is used as a callback when loading layouts from XML; the function is called for ea...
Definition: WindowManager.h:105
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
Class representing a block of attributes associated with an XML element.
Definition: XMLAttributes.h:48
Definition: XMLHandler.h:37
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1