00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CEGUIGUILayout_xmlHandler_h_
00031 #define _CEGUIGUILayout_xmlHandler_h_
00032
00033 #include "CEGUIWindowManager.h"
00034 #include "CEGUIWindow.h"
00035 #include "CEGUIXMLHandler.h"
00036
00037 #include <vector>
00038
00039
00040 namespace CEGUI
00041 {
00046 class GUILayout_xmlHandler : public XMLHandler
00047 {
00048 typedef WindowManager::PropertyCallback PropertyCallback;
00049 public:
00050
00051
00052
00057 GUILayout_xmlHandler(const String& name_prefix, PropertyCallback* callback = 0, void* userdata = 0) :
00058 d_root(0),
00059 d_namingPrefix(name_prefix),
00060 d_propertyCallback(callback),
00061 d_userData(userdata)
00062 {}
00063
00068 virtual ~GUILayout_xmlHandler(void) {}
00069
00070
00071
00072
00077 virtual void elementStart(const String& element, const XMLAttributes& attributes);
00078 virtual void elementEnd(const String& element);
00079 virtual void text(const String& text);
00080
00081
00082
00083
00088 void cleanupLoadedWindows(void);
00089
00090
00095 Window* getLayoutRootWindow(void) const;
00096
00097 private:
00098
00099
00100
00101 static const String GUILayoutElement;
00102 static const String WindowElement;
00103 static const String AutoWindowElement;
00104 static const String PropertyElement;
00105 static const String LayoutImportElement;
00106 static const String EventElement;
00107 static const String WindowTypeAttribute;
00108 static const String WindowNameAttribute;
00109 static const String AutoWindowNameSuffixAttribute;
00110 static const String PropertyNameAttribute;
00111 static const String PropertyValueAttribute;
00112 static const String LayoutParentAttribute;
00113 static const String LayoutImportFilenameAttribute;
00114 static const String LayoutImportPrefixAttribute;
00115 static const String LayoutImportResourceGroupAttribute;
00116 static const String EventNameAttribute;
00117 static const String EventFunctionAttribute;
00118
00123 void elementGUILayoutStart(const XMLAttributes& attributes);
00124
00129 void elementWindowStart(const XMLAttributes& attributes);
00130
00135 void elementAutoWindowStart(const XMLAttributes& attributes);
00136
00141 void elementPropertyStart(const XMLAttributes& attributes);
00142
00147 void elementLayoutImportStart(const XMLAttributes& attributes);
00148
00153 void elementEventStart(const XMLAttributes& attributes);
00154
00159 void elementGUILayoutEnd();
00160
00165 void elementWindowEnd();
00166
00171 void elementAutoWindowEnd();
00172
00177 void elementPropertyEnd();
00178
00179
00180
00181 typedef std::pair<Window*,bool> WindowStackEntry;
00182 typedef std::vector<WindowStackEntry> WindowStack;
00183 Window* d_root;
00184 WindowStack d_stack;
00185 String d_layoutParent;
00186 const String& d_namingPrefix;
00187 PropertyCallback* d_propertyCallback;
00188 void* d_userData;
00189 String d_propertyName;
00190 String d_propertyValue;
00191 };
00192
00193
00194 }
00195
00196
00197 #endif // end of guard _CEGUIGUILayout_xmlHandler_h_