]>
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 | ||
10 | #ifdef __GNUG__ | |
11 | #pragma interface "prophnd.h" | |
12 | #endif | |
13 | ||
14 | #ifndef _PROPHND_H_ | |
15 | #define _PROPHND_H_ | |
16 | ||
17 | ||
18 | class wxXmlNode; | |
19 | class wxList; | |
20 | class wxListCtrl; | |
21 | class wxPanel; | |
22 | class wxWindow; | |
23 | ||
24 | #include "wx/xml/xml.h" | |
25 | #include "wx/dynarray.h" | |
26 | ||
27 | enum PropertyType | |
28 | { | |
29 | PROP_TEXT = 0, | |
30 | PROP_FLAGS = 1, | |
31 | PROP_COLOR = 2, | |
32 | PROP_BOOL = 3, | |
33 | PROP_INTEGER = 4, | |
34 | PROP_COORD = 5 | |
35 | }; | |
36 | #define PROP_TYPES_CNT 6 | |
37 | ||
38 | class PropertyInfo | |
39 | { | |
40 | public: | |
41 | PropertyType Type; | |
42 | wxString Name; | |
43 | wxString MoreInfo; | |
44 | }; | |
45 | ||
46 | WX_DECLARE_OBJARRAY(PropertyInfo, PropertyInfoArray); | |
47 | ||
48 | ||
49 | class PropertyHandler; | |
50 | ||
51 | class PropsListInfo : public wxObject | |
52 | { | |
53 | public: | |
54 | PropsListInfo(int index, PropertyHandler *hnd, wxXmlNode *node, | |
55 | PropertyInfo *pi, wxListCtrl *listctrl) : | |
56 | m_Index(index), m_Handler(hnd), m_Node(node), | |
57 | m_PropInfo(pi), m_ListCtrl(listctrl) {} | |
58 | virtual ~PropsListInfo() {} | |
59 | ||
60 | int m_Index; | |
61 | PropertyHandler *m_Handler; | |
62 | wxXmlNode *m_Node; | |
63 | PropertyInfo *m_PropInfo; | |
64 | wxListCtrl *m_ListCtrl; | |
65 | }; | |
66 | ||
67 | ||
68 | ||
69 | ||
70 | class PropertyHandler | |
71 | { | |
72 | public: | |
73 | PropertyHandler() {} | |
74 | ||
75 | int CreateListItem(wxListCtrl *listctrl, wxXmlNode *node, PropertyInfo *pi); | |
76 | ||
77 | virtual wxString GetBriefValue(wxXmlNode *node, PropertyInfo *pi); | |
78 | virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli) = 0; | |
79 | }; | |
80 | ||
81 | ||
82 | ||
83 | class TextPropertyHandler : public PropertyHandler | |
84 | { | |
85 | public: | |
86 | TextPropertyHandler() {} | |
87 | virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli); | |
88 | }; | |
89 | ||
90 | ||
91 | class CoordPropertyHandler : public PropertyHandler | |
92 | { | |
93 | public: | |
94 | CoordPropertyHandler() {} | |
95 | virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli); | |
96 | }; | |
97 | ||
98 | ||
99 | class BoolPropertyHandler : public PropertyHandler | |
100 | { | |
101 | public: | |
102 | BoolPropertyHandler() {} | |
103 | virtual wxString GetBriefValue(wxXmlNode *node, PropertyInfo *pi); | |
104 | virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli); | |
105 | }; | |
106 | ||
107 | ||
108 | class FlagsPropertyHandler : public PropertyHandler | |
109 | { | |
110 | public: | |
111 | FlagsPropertyHandler() {} | |
112 | virtual wxPanel *CreateEditPanel(wxWindow *parent, PropsListInfo *pli); | |
113 | }; | |
114 | ||
115 | ||
116 | #endif |