Crazy Eddies GUI System: CEGUIGUILayout_xmlHandler.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

# CEGUIGUILayout_xmlHandler.h

    00001 /************************************************************************
    00002         filename:       CEGUIGUILayout_xmlHandler.h
    00003         created:        5/7/2004
    00004         author:         Paul D Turner
    00005
    00006         purpose:        Interface to XML parser for GUILayout files
    00007 *************************************************************************/
    00008 /*************************************************************************
    00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
    00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
    00011
    00012     This library is free software; you can redistribute it and/or
    00013     modify it under the terms of the GNU Lesser General Public
    00014     License as published by the Free Software Foundation; either
    00015     version 2.1 of the License, or (at your option) any later version.
    00016
    00017     This library is distributed in the hope that it will be useful,
    00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020     Lesser General Public License for more details.
    00021
    00022     You should have received a copy of the GNU Lesser General Public
    00023     License along with this library; if not, write to the Free Software
    00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025 *************************************************************************/
    00026 #ifndef _CEGUIGUILayout_xmlHandler_h_
    00027 #define _CEGUIGUILayout_xmlHandler_h_
    00028
    00029 #include "CEGUIWindowManager.h"
    00030 #include "CEGUIWindow.h"
    00031 #include "CEGUIXMLHandler.h"
    00032
    00033 #include <vector>
    00034
    00035 // Start of CEGUI namespace section
    00036 namespace CEGUI
    00037 {
    00042 class GUILayout_xmlHandler : public XMLHandler
    00043 {
    00044         typedef WindowManager::PropertyCallback PropertyCallback;
    00045 public:
    00046         /*************************************************************************
    00047                 Construction & Destruction
    00048         *************************************************************************/
    00053         GUILayout_xmlHandler(const String& name_prefix, PropertyCallback* callback = NULL, void* userdata = NULL) :
    00054           d_root(NULL),
    00055           d_namingPrefix(name_prefix),
    00056           d_propertyCallback(callback),
    00057           d_userData(userdata)
    00058           {}
    00059
    00064         virtual ~GUILayout_xmlHandler(void) {}
    00065
    00066         /*************************************************************************
    00067                 SAX2 Handler overrides
    00068         *************************************************************************/
    00073     virtual void elementStart(const String& element, const XMLAttributes& attributes);
    00074     virtual void elementEnd(const String& element);
    00075
    00076         /*************************************************************************
    00077                 Functions used by our implementation
    00078         *************************************************************************/
    00083         void    cleanupLoadedWindows(void);
    00084
    00085
    00090         Window* getLayoutRootWindow(void) const;
    00091
    00092 private:
    00093         /*************************************************************************
    00094                 Implementation Constants
    00095         *************************************************************************/
    00096         static const String GUILayoutElement;
    00097         static const String WindowElement;
    00098         static const String PropertyElement;
    00099         static const String LayoutImportElement;
    00100         static const String EventElement;
    00101         static const char       WindowTypeAttribute[];
    00102         static const char       WindowNameAttribute[];
    00103         static const char       PropertyNameAttribute[];
    00104         static const char       PropertyValueAttribute[];
    00105         static const char       LayoutParentAttribute[];
    00106         static const char       LayoutImportFilenameAttribute[];
    00107         static const char       LayoutImportPrefixAttribute[];
    00108     static const char   LayoutImportResourceGroupAttribute[];
    00109         static const char       EventNameAttribute[];
    00110         static const char       EventFunctionAttribute[];
    00111
    00112
    00113         /*************************************************************************
    00114                 Implementation Data
    00115         *************************************************************************/
    00116         typedef std::vector<Window*>    WindowStack;
    00117         Window* d_root;
    00118         WindowStack     d_stack;
    00119         String          d_layoutParent;
    00120         const String&           d_namingPrefix;
    00121         PropertyCallback*       d_propertyCallback;
    00122         void*                           d_userData;
    00123 };
    00124
    00125
    00126 } // End of  CEGUI namespace section
    00127
    00128
    00129 #endif  // end of guard _CEGUIGUILayout_xmlHandler_h_