]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: proplist.h | |
3 | // Purpose: Property list classes | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | /* | |
13 | ||
14 | TO DO: | |
15 | ||
16 | (1) Optional popup-help for each item, and an optional Help button | |
17 | for dialog. | |
18 | ||
19 | (2) Align Ok, Cancel, Help buttons properly. | |
20 | ||
21 | (3) Consider retrieving the rectangle on the panel that can be | |
22 | drawn into (where the value listbox is) and giving an example | |
23 | of editing graphically. May be too fancy. | |
24 | ||
25 | (4) Deriveable types for wxPropertyValue => may need to reorganise | |
26 | wxPropertyValue to use inheritance rather than present all-types-in-one | |
27 | scheme. | |
28 | ||
29 | (5) Optional popup panel for value list, perhaps. | |
30 | ||
31 | (6) Floating point checking routine still crashes with Floating | |
32 | point error for zany input. | |
33 | ||
34 | (7) Property sheet with choice (or listbox) to select alternative | |
35 | sheets... multiple views per panel, only one active. For this | |
36 | we really need a wxChoice that can be dynamically set: XView | |
37 | may be a problem; Motif? | |
38 | ||
39 | (8) More example validators, e.g. colour selector. | |
40 | */ | |
41 | ||
42 | #ifndef _WX_PROPLIST_H_ | |
43 | #define _WX_PROPLIST_H_ | |
44 | ||
45 | #if defined(__GNUG__) && !defined(__APPLE__) | |
46 | #pragma interface "proplist.h" | |
47 | #endif | |
48 | ||
49 | #if wxUSE_PROPSHEET | |
50 | ||
51 | #include "wx/prop.h" | |
52 | #include "wx/panel.h" | |
53 | ||
54 | #define wxPROP_BUTTON_CLOSE 1 | |
55 | #define wxPROP_BUTTON_OK 2 | |
56 | #define wxPROP_BUTTON_CANCEL 4 | |
57 | #define wxPROP_BUTTON_CHECK_CROSS 8 | |
58 | #define wxPROP_BUTTON_HELP 16 | |
59 | #define wxPROP_DYNAMIC_VALUE_FIELD 32 | |
60 | #define wxPROP_PULLDOWN 64 | |
61 | #define wxPROP_SHOWVALUES 128 | |
62 | ||
63 | // Show OK/Cancel buttons on X-based systems where window management is | |
64 | // more awkward | |
65 | #if defined(__WXMOTIF__) || defined(__WXGTK__) | |
66 | #define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | |
67 | #else | |
68 | #define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | wxPROP_SHOWVALUES | |
69 | #endif | |
70 | ||
71 | #define wxID_PROP_CROSS 3000 | |
72 | #define wxID_PROP_CHECK 3001 | |
73 | #define wxID_PROP_EDIT 3002 | |
74 | #define wxID_PROP_TEXT 3003 | |
75 | #define wxID_PROP_SELECT 3004 | |
76 | #define wxID_PROP_VALUE_SELECT 3005 | |
77 | ||
78 | // Mediates between a physical panel and the property sheet | |
79 | class WXDLLEXPORT wxPropertyListView: public wxPropertyView | |
80 | { | |
81 | public: | |
82 | wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT); | |
83 | ~wxPropertyListView(void); | |
84 | ||
85 | // Associates and shows the view | |
86 | virtual void ShowView(wxPropertySheet *propertySheet, wxPanel *panel); | |
87 | ||
88 | // Update this view of the viewed object, called e.g. by | |
89 | // the object itself. | |
90 | virtual bool OnUpdateView(void); | |
91 | ||
92 | wxString MakeNameValueString(wxString name, wxString value); | |
93 | ||
94 | // Update a single line in the list of properties | |
95 | virtual bool UpdatePropertyDisplayInList(wxProperty *property); | |
96 | ||
97 | // Update the whole list | |
98 | virtual bool UpdatePropertyList(bool clearEditArea = TRUE); | |
99 | ||
100 | // Find the wxListBox index corresponding to this property | |
101 | virtual int FindListIndexForProperty(wxProperty *property); | |
102 | ||
103 | // Select and show string representation in editor the given | |
104 | // property. NULL resets to show no property. | |
105 | virtual bool ShowProperty(wxProperty *property, bool select = TRUE); | |
106 | virtual bool EditProperty(wxProperty *property); | |
107 | ||
108 | // Update the display from the property | |
109 | virtual bool DisplayProperty(wxProperty *property); | |
110 | // Update the property from the display | |
111 | virtual bool RetrieveProperty(wxProperty *property); | |
112 | ||
113 | // Find appropriate validator and load property into value controls | |
114 | virtual bool BeginShowingProperty(wxProperty *property); | |
115 | // Find appropriate validator and unload property from value controls | |
116 | virtual bool EndShowingProperty(wxProperty *property); | |
117 | ||
118 | // Begin detailed editing (e.g. using value listbox) | |
119 | virtual void BeginDetailedEditing(void); | |
120 | ||
121 | // End detailed editing (e.g. using value listbox) | |
122 | virtual void EndDetailedEditing(void); | |
123 | ||
124 | // Called by the property listbox | |
125 | void OnPropertySelect(wxCommandEvent& event); | |
126 | ||
127 | // Called by the value listbox | |
128 | void OnValueListSelect(wxCommandEvent& event); | |
129 | ||
130 | virtual bool CreateControls(void); | |
131 | virtual void ShowTextControl(bool show); | |
132 | virtual void ShowListBoxControl(bool show); | |
133 | virtual void EnableCheck(bool show); | |
134 | virtual void EnableCross(bool show); | |
135 | ||
136 | void OnOk(wxCommandEvent& event); | |
137 | void OnCancel(wxCommandEvent& event); | |
138 | void OnHelp(wxCommandEvent& event); | |
139 | void OnPropertyDoubleClick(wxCommandEvent& event); | |
140 | // virtual void OnDoubleClick(void); | |
141 | ||
142 | void OnCheck(wxCommandEvent& event); | |
143 | void OnCross(wxCommandEvent& event); | |
144 | void OnEdit(wxCommandEvent& event); | |
145 | void OnText(wxCommandEvent& event); | |
146 | ||
147 | inline virtual wxListBox *GetPropertyScrollingList() const { return m_propertyScrollingList; } | |
148 | inline virtual wxListBox *GetValueList() const { return m_valueList; } | |
149 | inline virtual wxTextCtrl *GetValueText() const { return m_valueText; } | |
150 | inline virtual wxButton *GetConfirmButton() const { return m_confirmButton; } | |
151 | inline virtual wxButton *GetCancelButton() const { return m_cancelButton; } | |
152 | inline virtual wxButton *GetEditButton() const { return m_editButton; } | |
153 | inline virtual bool GetDetailedEditing(void) const { return m_detailedEditing; } | |
154 | ||
155 | inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; } | |
156 | inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; } | |
157 | ||
158 | inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; } | |
159 | inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; } | |
160 | ||
161 | inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; } | |
162 | inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; } | |
163 | inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; } | |
164 | ||
165 | bool OnClose(void); | |
166 | ||
167 | public: | |
168 | static bool sm_dialogCancelled; | |
169 | ||
170 | protected: | |
171 | wxListBox* m_propertyScrollingList; | |
172 | wxListBox* m_valueList; // Should really be a combobox, but we don't have one. | |
173 | wxTextCtrl* m_valueText; | |
174 | wxButton* m_confirmButton; // A tick, as in VB | |
175 | wxButton* m_cancelButton; // A cross, as in VB | |
176 | wxButton* m_editButton; // Invokes the custom validator, if any | |
177 | wxSizer* m_middleSizer; | |
178 | ||
179 | bool m_detailedEditing; // E.g. using listbox for choices | |
180 | ||
181 | wxPanel* m_propertyWindow; // Panel that the controls will appear on | |
182 | wxWindow* m_managedWindow; // Frame or dialog | |
183 | ||
184 | wxButton* m_windowCloseButton; // Or OK | |
185 | wxButton* m_windowCancelButton; | |
186 | wxButton* m_windowHelpButton; | |
187 | ||
188 | private: | |
189 | DECLARE_DYNAMIC_CLASS(wxPropertyListView) | |
190 | DECLARE_EVENT_TABLE() | |
191 | ||
192 | virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *window) | |
193 | { wxPropertyView::ShowView(propertySheet, window); }; | |
194 | }; | |
195 | ||
196 | class WXDLLEXPORT wxPropertyTextEdit: public wxTextCtrl | |
197 | { | |
198 | public: | |
199 | wxPropertyTextEdit(wxPropertyListView *v = NULL, | |
200 | wxWindow *parent = NULL, | |
201 | const wxWindowID id = -1, | |
202 | const wxString& value = wxEmptyString, | |
203 | const wxPoint& pos = wxDefaultPosition, | |
204 | const wxSize& size = wxDefaultSize, | |
205 | long style = 0, | |
206 | const wxString& name = wxT("text")); | |
207 | ||
208 | void OnSetFocus(); | |
209 | void OnKillFocus(); | |
210 | ||
211 | wxPropertyListView* m_view; | |
212 | ||
213 | private: | |
214 | DECLARE_CLASS(wxPropertyTextEdit) | |
215 | }; | |
216 | ||
217 | #define wxPROP_ALLOW_TEXT_EDITING 1 | |
218 | ||
219 | /* | |
220 | * The type of validator used for property lists (Visual Basic style) | |
221 | */ | |
222 | ||
223 | class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator | |
224 | { | |
225 | public: | |
226 | wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { } | |
227 | ~wxPropertyListValidator() {} | |
228 | ||
229 | // Called when the property is selected or deselected: typically displays the value | |
230 | // in the edit control (having chosen a suitable control to display: (non)editable text or listbox) | |
231 | virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
232 | ||
233 | // Called when the property is double clicked. Extra functionality can be provided, such as | |
234 | // cycling through possible values. | |
235 | inline virtual bool OnDoubleClick( | |
236 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) | |
237 | { return TRUE; } | |
238 | ||
239 | // Called when the value listbox is selected. Default behaviour is to copy | |
240 | // string to text control, and retrieve the value into the property. | |
241 | virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
242 | ||
243 | // Called when the property value is edited using standard text control | |
244 | inline virtual bool OnPrepareControls( | |
245 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) | |
246 | { return TRUE; } | |
247 | ||
248 | virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
249 | ||
250 | // Called when the property is edited in detail | |
251 | inline virtual bool OnPrepareDetailControls( | |
252 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) | |
253 | { return TRUE; } | |
254 | ||
255 | // Called if focus lost, IF we're in a modeless property editing situation. | |
256 | inline virtual bool OnClearDetailControls( | |
257 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) | |
258 | { return TRUE; } | |
259 | ||
260 | // Called when the edit (...) button is pressed. The default implementation | |
261 | // calls view->BeginDetailedEditing; the filename validator (for example) overrides | |
262 | // this function to show the file selector. | |
263 | virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
264 | ||
265 | // Called when TICK is pressed or focus is lost. | |
266 | // Return FALSE if value didn't check out; signal to restore old value. | |
267 | inline virtual bool OnCheckValue( | |
268 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) | |
269 | { return TRUE; } | |
270 | ||
271 | // Called when TICK is pressed or focus is lost or view wants to update | |
272 | // the property list. | |
273 | // Does the transferance from the property editing area to the property itself | |
274 | virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
275 | ||
276 | virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
277 | ||
278 | private: | |
279 | DECLARE_DYNAMIC_CLASS(wxPropertyListValidator) | |
280 | }; | |
281 | ||
282 | /* | |
283 | * A default dialog box class to use. | |
284 | */ | |
285 | ||
286 | class WXDLLEXPORT wxPropertyListDialog: public wxDialog | |
287 | { | |
288 | public: | |
289 | wxPropertyListDialog(wxPropertyListView *v = NULL, | |
290 | wxWindow *parent = NULL, | |
291 | const wxString& title = wxEmptyString, | |
292 | const wxPoint& pos = wxDefaultPosition, | |
293 | const wxSize& size = wxDefaultSize, | |
294 | long style = wxDEFAULT_DIALOG_STYLE, | |
295 | const wxString& name = wxT("dialogBox")); | |
296 | ||
297 | void OnCloseWindow(wxCloseEvent& event); | |
298 | void OnDefaultAction(wxControl *item); | |
299 | void OnCancel(wxCommandEvent& event); | |
300 | ||
301 | // Extend event processing to search the view's event table | |
302 | virtual bool ProcessEvent(wxEvent& event); | |
303 | ||
304 | private: | |
305 | wxPropertyListView* m_view; | |
306 | ||
307 | private: | |
308 | DECLARE_CLASS(wxPropertyListDialog) | |
309 | DECLARE_EVENT_TABLE() | |
310 | }; | |
311 | ||
312 | /* | |
313 | * A default panel class to use. | |
314 | */ | |
315 | ||
316 | class WXDLLEXPORT wxPropertyListPanel: public wxPanel | |
317 | { | |
318 | public: | |
319 | wxPropertyListPanel(wxPropertyListView *v = NULL, | |
320 | wxWindow *parent = NULL, | |
321 | const wxPoint& pos = wxDefaultPosition, | |
322 | const wxSize& size = wxDefaultSize, | |
323 | long style = 0, | |
324 | const wxString& name = wxT("panel")) | |
325 | : wxPanel(parent, -1, pos, size, style, name) | |
326 | { | |
327 | m_view = v; | |
328 | } | |
329 | ~wxPropertyListPanel(); | |
330 | void OnDefaultAction(wxControl *item); | |
331 | ||
332 | inline void SetView(wxPropertyListView* v) { m_view = v; } | |
333 | inline wxPropertyListView* GetView() const { return m_view; } | |
334 | ||
335 | // Extend event processing to search the view's event table | |
336 | virtual bool ProcessEvent(wxEvent& event); | |
337 | ||
338 | // Call Layout() | |
339 | void OnSize(wxSizeEvent& event); | |
340 | ||
341 | private: | |
342 | wxPropertyListView* m_view; | |
343 | ||
344 | private: | |
345 | DECLARE_EVENT_TABLE() | |
346 | DECLARE_CLASS(wxPropertyListPanel) | |
347 | }; | |
348 | ||
349 | /* | |
350 | * A default frame class to use. | |
351 | */ | |
352 | ||
353 | class WXDLLEXPORT wxPropertyListFrame: public wxFrame | |
354 | { | |
355 | public: | |
356 | wxPropertyListFrame(wxPropertyListView *v = NULL, | |
357 | wxFrame *parent = NULL, | |
358 | const wxString& title = wxEmptyString, | |
359 | const wxPoint& pos = wxDefaultPosition, | |
360 | const wxSize& size = wxDefaultSize, | |
361 | long style = wxDEFAULT_FRAME_STYLE, | |
362 | const wxString& name = _T("frame")) | |
363 | : wxFrame(parent, -1, title, pos, size, style, name) | |
364 | { | |
365 | m_view = v; | |
366 | m_propertyPanel = NULL; | |
367 | } | |
368 | void OnCloseWindow(wxCloseEvent& event); | |
369 | ||
370 | // Must call this to create panel and associate view | |
371 | virtual bool Initialize(void); | |
372 | virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); | |
373 | inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; } | |
374 | inline wxPropertyListView* GetView() const { return m_view; } | |
375 | ||
376 | private: | |
377 | wxPropertyListView* m_view; | |
378 | wxPropertyListPanel* m_propertyPanel; | |
379 | ||
380 | private: | |
381 | DECLARE_EVENT_TABLE() | |
382 | DECLARE_CLASS(wxPropertyListFrame) | |
383 | }; | |
384 | ||
385 | /* | |
386 | * Some default validators | |
387 | */ | |
388 | ||
389 | class WXDLLEXPORT wxRealListValidator: public wxPropertyListValidator | |
390 | { | |
391 | public: | |
392 | // 0.0, 0.0 means no range | |
393 | wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) | |
394 | { m_realMin = min; m_realMax = max; } | |
395 | ~wxRealListValidator() {} | |
396 | ||
397 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
398 | ||
399 | // Called when TICK is pressed or focus is lost. | |
400 | // Return FALSE if value didn't check out; signal to restore old value. | |
401 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
402 | ||
403 | // Called when TICK is pressed or focus is lost or view wants to update | |
404 | // the property list. | |
405 | // Does the transfer from the property editing area to the property itself | |
406 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
407 | ||
408 | protected: | |
409 | float m_realMin; | |
410 | float m_realMax; | |
411 | ||
412 | private: | |
413 | DECLARE_DYNAMIC_CLASS(wxRealListValidator) | |
414 | }; | |
415 | ||
416 | class WXDLLEXPORT wxIntegerListValidator: public wxPropertyListValidator | |
417 | { | |
418 | public: | |
419 | // 0, 0 means no range | |
420 | wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) | |
421 | { | |
422 | m_integerMin = min; m_integerMax = max; | |
423 | } | |
424 | ~wxIntegerListValidator() {} | |
425 | ||
426 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
427 | ||
428 | // Called when TICK is pressed or focus is lost. | |
429 | // Return FALSE if value didn't check out; signal to restore old value. | |
430 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
431 | ||
432 | // Called when TICK is pressed or focus is lost or view wants to update | |
433 | // the property list. | |
434 | // Does the transfer from the property editing area to the property itself | |
435 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
436 | ||
437 | protected: | |
438 | long m_integerMin; | |
439 | long m_integerMax; | |
440 | ||
441 | private: | |
442 | DECLARE_DYNAMIC_CLASS(wxIntegerListValidator) | |
443 | }; | |
444 | ||
445 | class WXDLLEXPORT wxBoolListValidator: public wxPropertyListValidator | |
446 | { | |
447 | public: | |
448 | wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags) {} | |
449 | ~wxBoolListValidator() {} | |
450 | ||
451 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
452 | bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
453 | bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
454 | ||
455 | // Called when TICK is pressed or focus is lost. | |
456 | // Return FALSE if value didn't check out; signal to restore old value. | |
457 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
458 | ||
459 | // Called when TICK is pressed or focus is lost or view wants to update | |
460 | // the property list. | |
461 | // Does the transfer from the property editing area to the property itself | |
462 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
463 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
464 | ||
465 | // Called when the property is double clicked. Extra functionality can be provided, | |
466 | // cycling through possible values. | |
467 | virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
468 | ||
469 | private: | |
470 | DECLARE_DYNAMIC_CLASS(wxBoolListValidator) | |
471 | }; | |
472 | ||
473 | class WXDLLEXPORT wxStringListValidator: public wxPropertyListValidator | |
474 | { | |
475 | public: | |
476 | wxStringListValidator(wxStringList *list = NULL, long flags = 0); | |
477 | ||
478 | ~wxStringListValidator() | |
479 | { | |
480 | if (m_strings) | |
481 | delete m_strings; | |
482 | } | |
483 | ||
484 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
485 | bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
486 | bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
487 | ||
488 | // Called when TICK is pressed or focus is lost. | |
489 | // Return FALSE if value didn't check out; signal to restore old value. | |
490 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
491 | ||
492 | // Called when TICK is pressed or focus is lost or view wants to update | |
493 | // the property list. | |
494 | // Does the transfer from the property editing area to the property itself | |
495 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
496 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
497 | ||
498 | // Called when the property is double clicked. Extra functionality can be provided, | |
499 | // cycling through possible values. | |
500 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
501 | ||
502 | protected: | |
503 | wxStringList* m_strings; | |
504 | ||
505 | private: | |
506 | DECLARE_DYNAMIC_CLASS(wxStringListValidator) | |
507 | }; | |
508 | ||
509 | class WXDLLEXPORT wxFilenameListValidator: public wxPropertyListValidator | |
510 | { | |
511 | public: | |
512 | wxFilenameListValidator(wxString message = wxT("Select a file"), wxString wildcard = wxALL_FILES_PATTERN, long flags = 0); | |
513 | ~wxFilenameListValidator(); | |
514 | ||
515 | // Called when TICK is pressed or focus is lost. | |
516 | // Return FALSE if value didn't check out; signal to restore old value. | |
517 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
518 | ||
519 | // Called when TICK is pressed or focus is lost or view wants to update | |
520 | // the property list. | |
521 | // Does the transferance from the property editing area to the property itself | |
522 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
523 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
524 | ||
525 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
526 | ||
527 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
528 | ||
529 | // Called when the edit (...) button is pressed. | |
530 | void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
531 | ||
532 | protected: | |
533 | wxString m_filenameWildCard; | |
534 | wxString m_filenameMessage; | |
535 | ||
536 | private: | |
537 | DECLARE_DYNAMIC_CLASS(wxFilenameListValidator) | |
538 | }; | |
539 | ||
540 | class WXDLLEXPORT wxColourListValidator: public wxPropertyListValidator | |
541 | { | |
542 | public: | |
543 | wxColourListValidator(long flags = 0); | |
544 | ~wxColourListValidator(); | |
545 | ||
546 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
547 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
548 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
549 | ||
550 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
551 | ||
552 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
553 | ||
554 | // Called when the edit (...) button is pressed. | |
555 | void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
556 | ||
557 | private: | |
558 | DECLARE_DYNAMIC_CLASS(wxColourListValidator) | |
559 | }; | |
560 | ||
561 | class WXDLLEXPORT wxListOfStringsListValidator: public wxPropertyListValidator | |
562 | { | |
563 | public: | |
564 | wxListOfStringsListValidator(long flags = 0); | |
565 | ~wxListOfStringsListValidator() {} | |
566 | ||
567 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
568 | ||
569 | // Called when TICK is pressed or focus is lost. | |
570 | // Return FALSE if value didn't check out; signal to restore old value. | |
571 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
572 | ||
573 | // Called when TICK is pressed or focus is lost or view wants to update | |
574 | // the property list. | |
575 | // Does the transfer from the property editing area to the property itself | |
576 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
577 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
578 | ||
579 | // Called when the property is double clicked. | |
580 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
581 | ||
582 | bool EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title = wxT("String List Editor")); | |
583 | ||
584 | // Called when the edit (...) button is pressed. | |
585 | void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); | |
586 | ||
587 | private: | |
588 | DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator) | |
589 | }; | |
590 | ||
591 | #endif | |
592 | // wxUSE_PROPSHEET | |
593 | ||
594 | #endif | |
595 | // _WX_PROPLIST_H_ |