Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 5/7/2004 00003 author: Paul D Turner 00004 00005 purpose: Interface to XML parser for GUILayout files 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUIGUILayout_xmlHandler_h_ 00030 #define _CEGUIGUILayout_xmlHandler_h_ 00031 00032 #include "CEGUI/WindowManager.h" 00033 #include "CEGUI/Window.h" 00034 #include "CEGUI/XMLHandler.h" 00035 00036 #include <vector> 00037 00038 // Start of CEGUI namespace section 00039 namespace CEGUI 00040 { 00045 class GUILayout_xmlHandler : public XMLHandler 00046 { 00047 typedef WindowManager::PropertyCallback PropertyCallback; 00048 public: 00049 static const String NativeVersion; 00050 00051 /************************************************************************* 00052 Construction & Destruction 00053 *************************************************************************/ 00058 GUILayout_xmlHandler(PropertyCallback* callback = 0, void* userdata = 0) : 00059 d_root(0), 00060 d_propertyCallback(callback), 00061 d_userData(userdata) 00062 {} 00063 00068 virtual ~GUILayout_xmlHandler(void) {} 00069 00070 virtual const String& getSchemaName() const; 00071 virtual const String& getDefaultResourceGroup() const; 00072 00073 /************************************************************************* 00074 SAX2 Handler overrides 00075 *************************************************************************/ 00080 virtual void elementStart(const String& element, const XMLAttributes& attributes); 00081 virtual void elementEnd(const String& element); 00082 virtual void text(const String& text); 00083 00084 /************************************************************************* 00085 Functions used by our implementation 00086 *************************************************************************/ 00091 void cleanupLoadedWindows(void); 00092 00093 00098 Window* getLayoutRootWindow(void) const; 00099 00100 static const String GUILayoutElement; 00101 static const String LayoutImportElement; 00102 static const String EventElement; 00103 static const String LayoutImportFilenameAttribute; 00104 static const String LayoutImportResourceGroupAttribute; 00105 static const String EventNameAttribute; 00106 static const String EventFunctionAttribute; 00107 static const String GUILayoutVersionAttribute; 00108 00109 private: 00118 void elementGUILayoutStart(const XMLAttributes& attributes); 00119 00124 void elementWindowStart(const XMLAttributes& attributes); 00125 00130 void elementAutoWindowStart(const XMLAttributes& attributes); 00131 00136 void elementUserStringStart(const XMLAttributes& attributes); 00137 00142 void elementPropertyStart(const XMLAttributes& attributes); 00143 00148 void elementLayoutImportStart(const XMLAttributes& attributes); 00149 00154 void elementEventStart(const XMLAttributes& attributes); 00155 00160 void elementWindowEnd(); 00161 00166 void elementAutoWindowEnd(); 00167 00172 void elementUserStringEnd(); 00173 00178 void elementPropertyEnd(); 00179 00180 void operator=(const GUILayout_xmlHandler&) {} 00181 00182 /************************************************************************* 00183 Implementation Data 00184 *************************************************************************/ 00185 typedef std::pair<Window*, bool> WindowStackEntry; 00186 typedef std::vector<WindowStackEntry 00187 CEGUI_VECTOR_ALLOC(WindowStackEntry)> WindowStack; 00188 Window* d_root; 00189 WindowStack d_stack; 00190 PropertyCallback* d_propertyCallback; 00191 void* d_userData; 00192 String d_stringItemName; 00193 String d_stringItemValue; 00194 }; 00195 00196 00197 } // End of CEGUI namespace section 00198 00199 00200 #endif // end of guard _CEGUIGUILayout_xmlHandler_h_