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