Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
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  *************************************************************************/
91  void cleanupLoadedWindows(void);
92 
93 
98  Window* getLayoutRootWindow(void) const;
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_