]> git.saurik.com Git - wxWidgets.git/blame - utils/dialoged/src/winprop.h
Removed some consts from tabctrl.h; fixed some other errors
[wxWidgets.git] / utils / dialoged / src / winprop.h
CommitLineData
457814b5
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: winprop.h
3// Purpose: Window properties
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WINPROP_H_
13#define _WINPROP_H_
14
15#ifdef __GNUG__
16#pragma interface "winprop.h"
17#endif
18
19#include "reseditr.h"
20
21class wxPropertyInfo;
22
23// A kind of property list view that intercepts OnPropertyChanged
24// feedback.
25class wxResourcePropertyListView: public wxPropertyListView
26{
27 public:
28 wxPropertyInfo *propertyInfo;
29
30 wxResourcePropertyListView(wxPropertyInfo *info, wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT):
31 wxPropertyListView(propPanel, flags)
32 {
33 propertyInfo = info;
34 }
35 void OnPropertyChanged(wxProperty *property);
36 bool OnClose(void);
37};
38
39// Generic class for relating an object to a collection of properties.
40// Instead of defining new functions like wxButton::GetProperty, wxButton::SetProperty,
41// we take these functions out into of the wxWindows library and associate
42// them with separate classes.
43class wxPropertyInfo: public wxObject
44{
45 protected:
46 static wxWindow *sm_propertyWindow;
47 wxPropertyInfo(void)
48 {
49 }
50 ~wxPropertyInfo(void)
51 {
52 }
53 public:
54 virtual wxProperty *GetProperty(wxString& propName) = 0;
55 virtual bool SetProperty(wxString& propName, wxProperty *property) = 0;
56 virtual void GetPropertyNames(wxStringList& names) = 0;
57 virtual bool Edit(wxWindow *parent, char *title);
58};
59
60// For all windows
61class wxWindowPropertyInfo: public wxPropertyInfo
62{
63 protected:
64 wxWindow *propertyWindow;
65 wxItemResource *propertyResource;
66 public:
67 wxWindowPropertyInfo(wxWindow *win, wxItemResource *res = NULL);
68 ~wxWindowPropertyInfo(void);
69 wxProperty *GetProperty(wxString& name);
70 bool SetProperty(wxString& name, wxProperty *property);
71 void GetPropertyNames(wxStringList& names);
72
73 inline void SetPropertyWindow(wxWindow *win) { propertyWindow = win; }
74
75 inline void SetResource(wxItemResource *res) { propertyResource = res; }
76
77 // Helper functions for font properties
78
79 wxProperty *GetFontProperty(wxString& name, wxFont *font);
80 wxFont *SetFontProperty(wxString& name, wxProperty *property, wxFont *oldFont);
81
82 // Fill in the wxItemResource members to mirror the current window settings
83 virtual bool InstantiateResource(wxItemResource *resource);
84};
85
86// For panel items
87class wxItemPropertyInfo: public wxWindowPropertyInfo
88{
89 protected:
90 public:
91 wxItemPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
92 wxWindowPropertyInfo(win, res) {}
93 ~wxItemPropertyInfo(void) {}
94 wxProperty *GetProperty(wxString& name);
95 bool SetProperty(wxString& name, wxProperty *property);
96 void GetPropertyNames(wxStringList& names);
97 bool InstantiateResource(wxItemResource *resource);
98};
99
100// For buttons
101class wxButtonPropertyInfo: public wxItemPropertyInfo
102{
103 protected:
104 public:
105 bool isBitmapButton;
106 wxButtonPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmButton = FALSE):
107 wxItemPropertyInfo(win, res) { isBitmapButton = bmButton; }
108 ~wxButtonPropertyInfo(void) {}
109 wxProperty *GetProperty(wxString& name);
110 bool SetProperty(wxString& name, wxProperty *property);
111 void GetPropertyNames(wxStringList& names);
112 bool InstantiateResource(wxItemResource *resource);
113
114 inline bool IsBitmapButton(void) { return isBitmapButton; }
115};
116
117// For messages
118class wxStaticTextPropertyInfo: public wxItemPropertyInfo
119{
120 protected:
121 public:
122 bool isBitmapMessage;
123 wxStaticTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL, bool bmMessage = FALSE):
124 wxItemPropertyInfo(win, res) { isBitmapMessage = bmMessage; }
125 ~wxStaticTextPropertyInfo(void) {}
126 wxProperty *GetProperty(wxString& name);
127 bool SetProperty(wxString& name, wxProperty *property);
128 void GetPropertyNames(wxStringList& names);
129 bool InstantiateResource(wxItemResource *resource);
130
131 inline bool IsBitmapMessage(void) { return isBitmapMessage; }
132};
133
134// For text/multitext items
135class wxTextPropertyInfo: public wxItemPropertyInfo
136{
137 protected:
138 public:
139 wxTextPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
140 wxItemPropertyInfo(win, res) {}
141 ~wxTextPropertyInfo(void) {}
142 wxProperty *GetProperty(wxString& name);
143 bool SetProperty(wxString& name, wxProperty *property);
144 void GetPropertyNames(wxStringList& names);
145 bool InstantiateResource(wxItemResource *resource);
146};
147
148// For list boxes
149class wxListBoxPropertyInfo: public wxItemPropertyInfo
150{
151 protected:
152 public:
153 wxListBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
154 wxItemPropertyInfo(win, res) {}
155 ~wxListBoxPropertyInfo(void) {}
156 wxProperty *GetProperty(wxString& name);
157 bool SetProperty(wxString& name, wxProperty *property);
158 void GetPropertyNames(wxStringList& names);
159 bool InstantiateResource(wxItemResource *resource);
160};
161
162// For choice items
163class wxChoicePropertyInfo: public wxItemPropertyInfo
164{
165 protected:
166 public:
167 wxChoicePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
168 wxItemPropertyInfo(win, res) {}
169 ~wxChoicePropertyInfo(void) {}
170 wxProperty *GetProperty(wxString& name);
171 bool SetProperty(wxString& name, wxProperty *property);
172 void GetPropertyNames(wxStringList& names);
173 bool InstantiateResource(wxItemResource *resource);
174};
175
176// For radiobox items
177class wxRadioBoxPropertyInfo: public wxItemPropertyInfo
178{
179 protected:
180 public:
181 wxRadioBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
182 wxItemPropertyInfo(win, res) {}
183 ~wxRadioBoxPropertyInfo(void) {}
184 wxProperty *GetProperty(wxString& name);
185 bool SetProperty(wxString& name, wxProperty *property);
186 void GetPropertyNames(wxStringList& names);
187 bool InstantiateResource(wxItemResource *resource);
188};
189
190// For groupbox items
191class wxGroupBoxPropertyInfo: public wxItemPropertyInfo
192{
193 protected:
194 public:
195 wxGroupBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
196 wxItemPropertyInfo(win, res) {}
197 ~wxGroupBoxPropertyInfo(void) {}
198 wxProperty *GetProperty(wxString& name);
199 bool SetProperty(wxString& name, wxProperty *property);
200 void GetPropertyNames(wxStringList& names);
201 bool InstantiateResource(wxItemResource *resource);
202};
203
204// For checkbox items
205class wxCheckBoxPropertyInfo: public wxItemPropertyInfo
206{
207 protected:
208 public:
209 wxCheckBoxPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
210 wxItemPropertyInfo(win, res) {}
211 ~wxCheckBoxPropertyInfo(void) {}
212 wxProperty *GetProperty(wxString& name);
213 bool SetProperty(wxString& name, wxProperty *property);
214 void GetPropertyNames(wxStringList& names);
215 bool InstantiateResource(wxItemResource *resource);
216};
217
218// For gauge items
219class wxGaugePropertyInfo: public wxItemPropertyInfo
220{
221 protected:
222 public:
223 wxGaugePropertyInfo(wxWindow *win, wxItemResource *res = NULL):
224 wxItemPropertyInfo(win, res) {}
225 ~wxGaugePropertyInfo(void) {}
226 wxProperty *GetProperty(wxString& name);
227 bool SetProperty(wxString& name, wxProperty *property);
228 void GetPropertyNames(wxStringList& names);
229 bool InstantiateResource(wxItemResource *resource);
230};
231
232// For scrollbar items
233class wxScrollBarPropertyInfo: public wxItemPropertyInfo
234{
235 protected:
236 public:
237 wxScrollBarPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
238 wxItemPropertyInfo(win, res) {}
239 ~wxScrollBarPropertyInfo(void) {}
240 wxProperty *GetProperty(wxString& name);
241 bool SetProperty(wxString& name, wxProperty *property);
242 void GetPropertyNames(wxStringList& names);
243 bool InstantiateResource(wxItemResource *resource);
244};
245
246// For slider items
247class wxSliderPropertyInfo: public wxItemPropertyInfo
248{
249 protected:
250 public:
251 wxSliderPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
252 wxItemPropertyInfo(win, res) {}
253 ~wxSliderPropertyInfo(void) {}
254 wxProperty *GetProperty(wxString& name);
255 bool SetProperty(wxString& name, wxProperty *property);
256 void GetPropertyNames(wxStringList& names);
257 bool InstantiateResource(wxItemResource *resource);
258};
259
260// For panels
261class wxPanelPropertyInfo: public wxWindowPropertyInfo
262{
263 protected:
264 public:
265 wxPanelPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
266 wxWindowPropertyInfo(win, res) {}
267 ~wxPanelPropertyInfo(void) {}
268 wxProperty *GetProperty(wxString& name);
269 bool SetProperty(wxString& name, wxProperty *property);
270 void GetPropertyNames(wxStringList& names);
271 bool InstantiateResource(wxItemResource *resource);
272};
273
274// For dialogs
275class wxDialogPropertyInfo: public wxPanelPropertyInfo
276{
277 protected:
278 public:
279 wxDialogPropertyInfo(wxWindow *win, wxItemResource *res = NULL):
280 wxPanelPropertyInfo(win, res) {}
281 ~wxDialogPropertyInfo(void) {}
282 wxProperty *GetProperty(wxString& name);
283 bool SetProperty(wxString& name, wxProperty *property);
284 void GetPropertyNames(wxStringList& names);
285 bool InstantiateResource(wxItemResource *resource);
286};
287
288int wxStringToFontWeight(wxString& val);
289int wxStringToFontStyle(wxString& val);
290int wxStringToFontFamily(wxString& val);
291
292#endif
293