]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Purpose: XML resources editor | |
3 | // Author: Vaclav Slavik | |
4 | // Created: 2000/05/05 | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 2000 Vaclav Slavik | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #if defined(__GNUG__) && !defined(__APPLE__) | |
11 | #pragma interface "nodehnd.h" | |
12 | #endif | |
13 | ||
14 | #ifndef _NODEHND_H_ | |
15 | #define _NODEHND_H_ | |
16 | ||
17 | ||
18 | class WXDLLEXPORT wxXmlNode; | |
19 | class WXDLLEXPORT wxList; | |
20 | class WXDLLEXPORT wxListCtrl; | |
21 | ||
22 | class EditorFrame; | |
23 | ||
24 | #include "wx/treectrl.h" | |
25 | #include "wx/xml/xml.h" | |
26 | #include "nodesdb.h" | |
27 | #include "wx/arrstr.h" | |
28 | ||
29 | ||
30 | ||
31 | class NodeHandler : public wxObject | |
32 | { | |
33 | public: | |
34 | static NodeHandler *Find(wxXmlNode *node); | |
35 | ||
36 | NodeHandler(NodeInfo *ni); | |
37 | virtual ~NodeHandler(); | |
38 | ||
39 | virtual bool CanHandle(wxXmlNode *node); | |
40 | virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, | |
41 | wxXmlNode *node); | |
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; } | |
48 | ||
49 | protected: | |
50 | ||
51 | NodeInfo *m_NodeInfo; | |
52 | wxArrayString m_ChildTypes; | |
53 | ||
54 | static wxList ms_Handlers; | |
55 | static bool ms_HandlersLoaded; | |
56 | }; | |
57 | ||
58 | // wxPanel handler | |
59 | class NodeHandlerPanel : public NodeHandler | |
60 | { | |
61 | public: | |
62 | NodeHandlerPanel(NodeInfo *ni) : NodeHandler(ni) {} | |
63 | ||
64 | virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, | |
65 | wxXmlNode *node); | |
66 | virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL); | |
67 | }; | |
68 | ||
69 | ||
70 | // wxSizers handler | |
71 | class NodeHandlerSizer : public NodeHandlerPanel | |
72 | { | |
73 | public: | |
74 | NodeHandlerSizer(NodeInfo *ni) : NodeHandlerPanel(ni) {} | |
75 | ||
76 | virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL); | |
77 | virtual int GetTreeIcon(wxXmlNode *node); | |
78 | }; | |
79 | ||
80 | ||
81 | // item of wxSizer handler | |
82 | class NodeHandlerSizerItem : public NodeHandler | |
83 | { | |
84 | public: | |
85 | NodeHandlerSizerItem(NodeInfo *ni) : NodeHandler(ni) {} | |
86 | ||
87 | virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, | |
88 | wxXmlNode *node); | |
89 | virtual PropertyInfoArray& GetPropsList(wxXmlNode *node); | |
90 | virtual wxString GetTreeString(wxXmlNode *node); | |
91 | virtual int GetTreeIcon(wxXmlNode *node); | |
92 | virtual wxXmlNode *GetRealNode(wxXmlNode *node); | |
93 | ||
94 | private: | |
95 | PropertyInfoArray m_dummy; | |
96 | }; | |
97 | ||
98 | ||
99 | ||
100 | // wxNotebook handler | |
101 | class NodeHandlerNotebook : public NodeHandlerPanel | |
102 | { | |
103 | public: | |
104 | NodeHandlerNotebook(NodeInfo *ni) : NodeHandlerPanel(ni) {} | |
105 | ||
106 | virtual void InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before = NULL); | |
107 | }; | |
108 | ||
109 | ||
110 | // notebook page handler | |
111 | class NodeHandlerNotebookPage : public NodeHandlerSizerItem | |
112 | { | |
113 | public: | |
114 | NodeHandlerNotebookPage(NodeInfo *ni) : | |
115 | NodeHandlerSizerItem(ni) {} | |
116 | }; | |
117 | ||
118 | ||
119 | ||
120 | // Generic handler which handles everything | |
121 | class NodeHandlerUnknown : public NodeHandler | |
122 | { | |
123 | public: | |
124 | NodeHandlerUnknown() : NodeHandler(new NodeInfo) {} | |
125 | ||
126 | virtual bool CanHandle(wxXmlNode *WXUNUSED(node)) { return TRUE; } | |
127 | }; | |
128 | ||
129 | ||
130 | #endif |