1 /////////////////////////////////////////////////////////////////////////////
2 // Purpose: XML resources editor
3 // Author: Vaclav Slavik
6 // Copyright: (c) 2000 Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma interface "nodehnd.h"
18 class WXDLLEXPORT wxXmlNode
;
19 class WXDLLEXPORT wxList
;
20 class WXDLLEXPORT wxListCtrl
;
24 #include "wx/treectrl.h"
25 #include "wx/xrc/xml.h"
31 class NodeHandler
: public wxObject
34 static NodeHandler
*Find(wxXmlNode
*node
);
36 NodeHandler(NodeInfo
*ni
);
37 virtual ~NodeHandler();
39 virtual bool CanHandle(wxXmlNode
*node
);
40 virtual wxTreeItemId
CreateTreeNode(wxTreeCtrl
*treectrl
, wxTreeItemId parent
,
42 virtual PropertyInfoArray
& GetPropsList(wxXmlNode
*node
);
43 virtual int GetTreeIcon(wxXmlNode
* WXUNUSED(node
)) {return m_NodeInfo
->Icon
;}
44 virtual wxString
GetTreeString(wxXmlNode
*node
);
45 wxArrayString
& GetChildTypes();
46 virtual void InsertNode(wxXmlNode
*parent
, wxXmlNode
*node
, wxXmlNode
*insert_before
= NULL
);
47 virtual wxXmlNode
*GetRealNode(wxXmlNode
*node
) { return node
; }
52 wxArrayString m_ChildTypes
;
54 static wxList ms_Handlers
;
55 static bool ms_HandlersLoaded
;
59 class NodeHandlerPanel
: public NodeHandler
62 NodeHandlerPanel(NodeInfo
*ni
) : NodeHandler(ni
) {}
64 virtual wxTreeItemId
CreateTreeNode(wxTreeCtrl
*treectrl
, wxTreeItemId parent
,
66 virtual void InsertNode(wxXmlNode
*parent
, wxXmlNode
*node
, wxXmlNode
*insert_before
= NULL
);
71 class NodeHandlerSizer
: public NodeHandlerPanel
74 NodeHandlerSizer(NodeInfo
*ni
) : NodeHandlerPanel(ni
) {}
76 virtual void InsertNode(wxXmlNode
*parent
, wxXmlNode
*node
, wxXmlNode
*insert_before
= NULL
);
77 virtual int GetTreeIcon(wxXmlNode
*node
);
81 // item of wxSizer handler
82 class NodeHandlerSizerItem
: public NodeHandler
85 NodeHandlerSizerItem(NodeInfo
*ni
) : NodeHandler(ni
) {}
87 virtual wxTreeItemId
CreateTreeNode(wxTreeCtrl
*treectrl
, wxTreeItemId parent
,
89 virtual PropertyInfoArray
& GetPropsList(wxXmlNode
*node
);
90 virtual wxString
GetTreeString(wxXmlNode
*node
);
91 virtual int GetTreeIcon(wxXmlNode
*node
);
92 virtual wxXmlNode
*GetRealNode(wxXmlNode
*node
);
95 PropertyInfoArray m_dummy
;
100 // wxNotebook handler
101 class NodeHandlerNotebook
: public NodeHandlerPanel
104 NodeHandlerNotebook(NodeInfo
*ni
) : NodeHandlerPanel(ni
) {}
106 virtual void InsertNode(wxXmlNode
*parent
, wxXmlNode
*node
, wxXmlNode
*insert_before
= NULL
);
110 // notebook page handler
111 class NodeHandlerNotebookPage
: public NodeHandlerSizerItem
114 NodeHandlerNotebookPage(NodeInfo
*ni
) :
115 NodeHandlerSizerItem(ni
) {}
120 // Generic handler which handles everything
121 class NodeHandlerUnknown
: public NodeHandler
124 NodeHandlerUnknown() : NodeHandler(new NodeInfo
) {}
126 virtual bool CanHandle(wxXmlNode
*node
) { return TRUE
; }