]>
Commit | Line | Data |
---|---|---|
56d2f750 VS |
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 | ||
ab7ce33c | 10 | #if defined(__GNUG__) && !defined(__APPLE__) |
56d2f750 VS |
11 | #pragma interface "nodehnd.h" |
12 | #endif | |
13 | ||
14 | #ifndef _NODEHND_H_ | |
15 | #define _NODEHND_H_ | |
16 | ||
17 | ||
1ad83f6b VS |
18 | class WXDLLEXPORT wxXmlNode; |
19 | class WXDLLEXPORT wxList; | |
20 | class WXDLLEXPORT wxListCtrl; | |
56d2f750 VS |
21 | |
22 | class EditorFrame; | |
23 | ||
24 | #include "wx/treectrl.h" | |
c74caa09 | 25 | #include "wx/xml/xml.h" |
12d9e308 | 26 | #include "nodesdb.h" |
c74caa09 | 27 | #include "wx/arrstr.h" |
56d2f750 VS |
28 | |
29 | ||
30 | ||
31 | class NodeHandler : public wxObject | |
32 | { | |
33 | public: | |
12d9e308 | 34 | static NodeHandler *Find(wxXmlNode *node); |
56d2f750 | 35 | |
12d9e308 | 36 | NodeHandler(NodeInfo *ni); |
56d2f750 VS |
37 | virtual ~NodeHandler(); |
38 | ||
39 | virtual bool CanHandle(wxXmlNode *node); | |
40 | virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, | |
41 | wxXmlNode *node); | |
12d9e308 | 42 | virtual PropertyInfoArray& GetPropsList(wxXmlNode *node); |
56d2f750 VS |
43 | virtual int GetTreeIcon(wxXmlNode * WXUNUSED(node)) {return m_NodeInfo->Icon;} |
44 | virtual wxString GetTreeString(wxXmlNode *node); | |
56d2f750 VS |
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: | |
12d9e308 | 50 | |
56d2f750 VS |
51 | NodeInfo *m_NodeInfo; |
52 | wxArrayString m_ChildTypes; | |
56d2f750 | 53 | |
12d9e308 VS |
54 | static wxList ms_Handlers; |
55 | static bool ms_HandlersLoaded; | |
56d2f750 VS |
56 | }; |
57 | ||
58 | // wxPanel handler | |
59 | class NodeHandlerPanel : public NodeHandler | |
60 | { | |
61 | public: | |
12d9e308 | 62 | NodeHandlerPanel(NodeInfo *ni) : NodeHandler(ni) {} |
56d2f750 VS |
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: | |
12d9e308 | 74 | NodeHandlerSizer(NodeInfo *ni) : NodeHandlerPanel(ni) {} |
56d2f750 VS |
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: | |
12d9e308 | 85 | NodeHandlerSizerItem(NodeInfo *ni) : NodeHandler(ni) {} |
56d2f750 VS |
86 | |
87 | virtual wxTreeItemId CreateTreeNode(wxTreeCtrl *treectrl, wxTreeItemId parent, | |
88 | wxXmlNode *node); | |
12d9e308 | 89 | virtual PropertyInfoArray& GetPropsList(wxXmlNode *node); |
56d2f750 VS |
90 | virtual wxString GetTreeString(wxXmlNode *node); |
91 | virtual int GetTreeIcon(wxXmlNode *node); | |
92 | virtual wxXmlNode *GetRealNode(wxXmlNode *node); | |
12d9e308 VS |
93 | |
94 | private: | |
95 | PropertyInfoArray m_dummy; | |
56d2f750 VS |
96 | }; |
97 | ||
98 | ||
99 | ||
ab13d1c5 VS |
100 | // wxNotebook handler |
101 | class NodeHandlerNotebook : public NodeHandlerPanel | |
102 | { | |
103 | public: | |
12d9e308 | 104 | NodeHandlerNotebook(NodeInfo *ni) : NodeHandlerPanel(ni) {} |
ab13d1c5 VS |
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: | |
12d9e308 VS |
114 | NodeHandlerNotebookPage(NodeInfo *ni) : |
115 | NodeHandlerSizerItem(ni) {} | |
ab13d1c5 VS |
116 | }; |
117 | ||
118 | ||
119 | ||
56d2f750 VS |
120 | // Generic handler which handles everything |
121 | class NodeHandlerUnknown : public NodeHandler | |
122 | { | |
123 | public: | |
12d9e308 | 124 | NodeHandlerUnknown() : NodeHandler(new NodeInfo) {} |
56d2f750 | 125 | |
d1f47235 | 126 | virtual bool CanHandle(wxXmlNode *WXUNUSED(node)) { return TRUE; } |
56d2f750 VS |
127 | }; |
128 | ||
129 | ||
130 | #endif |