Crazy Eddie's GUI System  0.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
GUILayout_xmlHandler.h
1 /***********************************************************************
2  filename: CEGUIGUILayout_xmlHandler.h
3  created: 5/7/2004
4  author: Paul D Turner
5 
6  purpose: Interface to XML parser for GUILayout files
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIGUILayout_xmlHandler_h_
31 #define _CEGUIGUILayout_xmlHandler_h_
32 
33 #include "CEGUI/WindowManager.h"
34 #include "CEGUI/Window.h"
35 #include "CEGUI/XMLHandler.h"
36 
37 #include <vector>
38 
39 // Start of CEGUI namespace section
40 namespace CEGUI
41 {
47 {
48  typedef WindowManager::PropertyCallback PropertyCallback;
49 public:
50  static const String NativeVersion;
51 
52  /*************************************************************************
53  Construction & Destruction
54  *************************************************************************/
59  GUILayout_xmlHandler(PropertyCallback* callback = 0, void* userdata = 0) :
60  d_root(0),
61  d_propertyCallback(callback),
62  d_userData(userdata)
63  {}
64 
69  virtual ~GUILayout_xmlHandler(void) {}
70 
71  virtual const String& getSchemaName() const;
72  virtual const String& getDefaultResourceGroup() const;
73 
74  /*************************************************************************
75  SAX2 Handler overrides
76  *************************************************************************/
81  virtual void elementStart(const String& element, const XMLAttributes& attributes);
82  virtual void elementEnd(const String& element);
83  virtual void text(const String& text);
84 
85  /*************************************************************************
86  Functions used by our implementation
87  *************************************************************************/
92  void cleanupLoadedWindows(void);
93 
94 
99  Window* getLayoutRootWindow(void) const;
100 
101  static const String GUILayoutElement;
103  static const String EventElement;
106  static const String EventNameAttribute;
109 
110 private:
119  void elementGUILayoutStart(const XMLAttributes& attributes);
120 
125  void elementWindowStart(const XMLAttributes& attributes);
126 
131  void elementAutoWindowStart(const XMLAttributes& attributes);
132 
137  void elementUserStringStart(const XMLAttributes& attributes);
138 
143  void elementPropertyStart(const XMLAttributes& attributes);
144 
149  void elementLayoutImportStart(const XMLAttributes& attributes);
150 
155  void elementEventStart(const XMLAttributes& attributes);
156 
161  void elementWindowEnd();
162 
167  void elementAutoWindowEnd();
168 
173  void elementUserStringEnd();
174 
179  void elementPropertyEnd();
180 
181  void operator=(const GUILayout_xmlHandler&) {}
182 
183  /*************************************************************************
184  Implementation Data
185  *************************************************************************/
186  typedef std::pair<Window*, bool> WindowStackEntry;
187  typedef std::vector<WindowStackEntry
188  CEGUI_VECTOR_ALLOC(WindowStackEntry)> WindowStack;
189  Window* d_root;
190  WindowStack d_stack;
191  PropertyCallback* d_propertyCallback;
192  void* d_userData;
193  String d_stringItemName;
194  String d_stringItemValue;
195 };
196 
197 
198 } // End of CEGUI namespace section
199 
200 
201 #endif // end of guard _CEGUIGUILayout_xmlHandler_h_