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