| 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 | DECLARE_CLASS(wxPropertyTextEdit) |
| 195 | public: |
| 196 | wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id, |
| 197 | const wxString& value, const wxPoint& pos = wxDefaultPosition, |
| 198 | const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text"); |
| 199 | void OnSetFocus(void); |
| 200 | void OnKillFocus(void); |
| 201 | |
| 202 | wxPropertyListView* m_view; |
| 203 | }; |
| 204 | |
| 205 | #define wxPROP_ALLOW_TEXT_EDITING 1 |
| 206 | |
| 207 | /* |
| 208 | * The type of validator used for property lists (Visual Basic style) |
| 209 | */ |
| 210 | |
| 211 | class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator |
| 212 | { |
| 213 | DECLARE_DYNAMIC_CLASS(wxPropertyListValidator) |
| 214 | protected: |
| 215 | public: |
| 216 | wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { } |
| 217 | ~wxPropertyListValidator(void) {} |
| 218 | |
| 219 | // Called when the property is selected or deselected: typically displays the value |
| 220 | // in the edit control (having chosen a suitable control to display: (non)editable text or listbox) |
| 221 | virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 222 | |
| 223 | // Called when the property is double clicked. Extra functionality can be provided, such as |
| 224 | // cycling through possible values. |
| 225 | inline virtual bool OnDoubleClick( |
| 226 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) |
| 227 | { return TRUE; } |
| 228 | |
| 229 | // Called when the value listbox is selected. Default behaviour is to copy |
| 230 | // string to text control, and retrieve the value into the property. |
| 231 | virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 232 | |
| 233 | // Called when the property value is edited using standard text control |
| 234 | inline virtual bool OnPrepareControls( |
| 235 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) |
| 236 | { return TRUE; } |
| 237 | |
| 238 | virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 239 | |
| 240 | // Called when the property is edited in detail |
| 241 | inline virtual bool OnPrepareDetailControls( |
| 242 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) |
| 243 | { return TRUE; } |
| 244 | |
| 245 | // Called if focus lost, IF we're in a modeless property editing situation. |
| 246 | inline virtual bool OnClearDetailControls( |
| 247 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) |
| 248 | { return TRUE; } |
| 249 | |
| 250 | // Called when the edit (...) button is pressed. The default implementation |
| 251 | // calls view->BeginDetailedEditing; the filename validator (for example) overrides |
| 252 | // this function to show the file selector. |
| 253 | virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 254 | |
| 255 | // Called when TICK is pressed or focus is lost. |
| 256 | // Return FALSE if value didn't check out; signal to restore old value. |
| 257 | inline virtual bool OnCheckValue( |
| 258 | wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) ) |
| 259 | { return TRUE; } |
| 260 | |
| 261 | // Called when TICK is pressed or focus is lost or view wants to update |
| 262 | // the property list. |
| 263 | // Does the transferance from the property editing area to the property itself |
| 264 | virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 265 | |
| 266 | virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 267 | }; |
| 268 | |
| 269 | /* |
| 270 | * A default dialog box class to use. |
| 271 | */ |
| 272 | |
| 273 | class WXDLLEXPORT wxPropertyListDialog: public wxDialog |
| 274 | { |
| 275 | DECLARE_CLASS(wxPropertyListDialog) |
| 276 | public: |
| 277 | wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, |
| 278 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
| 279 | long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); |
| 280 | void OnCloseWindow(wxCloseEvent& event); |
| 281 | void OnDefaultAction(wxControl *item); |
| 282 | void OnCancel(wxCommandEvent& event); |
| 283 | |
| 284 | // Extend event processing to search the view's event table |
| 285 | virtual bool ProcessEvent(wxEvent& event); |
| 286 | |
| 287 | private: |
| 288 | wxPropertyListView* m_view; |
| 289 | |
| 290 | DECLARE_EVENT_TABLE() |
| 291 | }; |
| 292 | |
| 293 | /* |
| 294 | * A default panel class to use. |
| 295 | */ |
| 296 | |
| 297 | class WXDLLEXPORT wxPropertyListPanel: public wxPanel |
| 298 | { |
| 299 | DECLARE_CLASS(wxPropertyListPanel) |
| 300 | public: |
| 301 | wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, |
| 302 | const wxSize& size = wxDefaultSize, |
| 303 | long style = 0, const wxString& name = "panel"): |
| 304 | wxPanel(parent, -1, pos, size, style, name) |
| 305 | { |
| 306 | m_view = v; |
| 307 | } |
| 308 | ~wxPropertyListPanel(); |
| 309 | void OnDefaultAction(wxControl *item); |
| 310 | |
| 311 | inline void SetView(wxPropertyListView* v) { m_view = v; } |
| 312 | inline wxPropertyListView* GetView() const { return m_view; } |
| 313 | |
| 314 | // Extend event processing to search the view's event table |
| 315 | virtual bool ProcessEvent(wxEvent& event); |
| 316 | |
| 317 | // Call Layout() |
| 318 | void OnSize(wxSizeEvent& event); |
| 319 | |
| 320 | private: |
| 321 | wxPropertyListView* m_view; |
| 322 | |
| 323 | DECLARE_EVENT_TABLE() |
| 324 | }; |
| 325 | |
| 326 | /* |
| 327 | * A default frame class to use. |
| 328 | */ |
| 329 | |
| 330 | class WXDLLEXPORT wxPropertyListFrame: public wxFrame |
| 331 | { |
| 332 | DECLARE_CLASS(wxPropertyListFrame) |
| 333 | public: |
| 334 | wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, |
| 335 | const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, |
| 336 | long style = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame"): |
| 337 | wxFrame(parent, -1, title, pos, size, style, name) |
| 338 | { |
| 339 | m_view = v; |
| 340 | m_propertyPanel = NULL; |
| 341 | } |
| 342 | void OnCloseWindow(wxCloseEvent& event); |
| 343 | |
| 344 | // Must call this to create panel and associate view |
| 345 | virtual bool Initialize(void); |
| 346 | virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); |
| 347 | inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; } |
| 348 | |
| 349 | private: |
| 350 | wxPropertyListView* m_view; |
| 351 | wxPropertyListPanel* m_propertyPanel; |
| 352 | |
| 353 | DECLARE_EVENT_TABLE() |
| 354 | }; |
| 355 | |
| 356 | /* |
| 357 | * Some default validators |
| 358 | */ |
| 359 | |
| 360 | class WXDLLEXPORT wxRealListValidator: public wxPropertyListValidator |
| 361 | { |
| 362 | DECLARE_DYNAMIC_CLASS(wxRealListValidator) |
| 363 | public: |
| 364 | // 0.0, 0.0 means no range |
| 365 | wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) |
| 366 | { |
| 367 | m_realMin = min; m_realMax = max; |
| 368 | } |
| 369 | ~wxRealListValidator(void) {} |
| 370 | |
| 371 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 372 | |
| 373 | // Called when TICK is pressed or focus is lost. |
| 374 | // Return FALSE if value didn't check out; signal to restore old value. |
| 375 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 376 | |
| 377 | // Called when TICK is pressed or focus is lost or view wants to update |
| 378 | // the property list. |
| 379 | // Does the transfer from the property editing area to the property itself |
| 380 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 381 | |
| 382 | protected: |
| 383 | float m_realMin; |
| 384 | float m_realMax; |
| 385 | }; |
| 386 | |
| 387 | class WXDLLEXPORT wxIntegerListValidator: public wxPropertyListValidator |
| 388 | { |
| 389 | DECLARE_DYNAMIC_CLASS(wxIntegerListValidator) |
| 390 | public: |
| 391 | // 0, 0 means no range |
| 392 | wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) |
| 393 | { |
| 394 | m_integerMin = min; m_integerMax = max; |
| 395 | } |
| 396 | ~wxIntegerListValidator(void) {} |
| 397 | |
| 398 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 399 | |
| 400 | // Called when TICK is pressed or focus is lost. |
| 401 | // Return FALSE if value didn't check out; signal to restore old value. |
| 402 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 403 | |
| 404 | // Called when TICK is pressed or focus is lost or view wants to update |
| 405 | // the property list. |
| 406 | // Does the transfer from the property editing area to the property itself |
| 407 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 408 | |
| 409 | protected: |
| 410 | long m_integerMin; |
| 411 | long m_integerMax; |
| 412 | }; |
| 413 | |
| 414 | class WXDLLEXPORT wxBoolListValidator: public wxPropertyListValidator |
| 415 | { |
| 416 | DECLARE_DYNAMIC_CLASS(wxBoolListValidator) |
| 417 | protected: |
| 418 | public: |
| 419 | wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags) |
| 420 | { |
| 421 | } |
| 422 | ~wxBoolListValidator(void) {} |
| 423 | |
| 424 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 425 | bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 426 | bool OnClearDetailControls(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 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 437 | |
| 438 | // Called when the property is double clicked. Extra functionality can be provided, |
| 439 | // cycling through possible values. |
| 440 | virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 441 | }; |
| 442 | |
| 443 | class WXDLLEXPORT wxStringListValidator: public wxPropertyListValidator |
| 444 | { |
| 445 | DECLARE_DYNAMIC_CLASS(wxStringListValidator) |
| 446 | public: |
| 447 | wxStringListValidator(wxStringList *list = NULL, long flags = 0); |
| 448 | |
| 449 | ~wxStringListValidator(void) |
| 450 | { |
| 451 | if (m_strings) |
| 452 | delete m_strings; |
| 453 | } |
| 454 | |
| 455 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 456 | bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 457 | bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 458 | |
| 459 | // Called when TICK is pressed or focus is lost. |
| 460 | // Return FALSE if value didn't check out; signal to restore old value. |
| 461 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 462 | |
| 463 | // Called when TICK is pressed or focus is lost or view wants to update |
| 464 | // the property list. |
| 465 | // Does the transfer from the property editing area to the property itself |
| 466 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 467 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 468 | |
| 469 | // Called when the property is double clicked. Extra functionality can be provided, |
| 470 | // cycling through possible values. |
| 471 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 472 | |
| 473 | protected: |
| 474 | wxStringList* m_strings; |
| 475 | }; |
| 476 | |
| 477 | class WXDLLEXPORT wxFilenameListValidator: public wxPropertyListValidator |
| 478 | { |
| 479 | DECLARE_DYNAMIC_CLASS(wxFilenameListValidator) |
| 480 | public: |
| 481 | wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0); |
| 482 | |
| 483 | ~wxFilenameListValidator(void); |
| 484 | |
| 485 | // Called when TICK is pressed or focus is lost. |
| 486 | // Return FALSE if value didn't check out; signal to restore old value. |
| 487 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 488 | |
| 489 | // Called when TICK is pressed or focus is lost or view wants to update |
| 490 | // the property list. |
| 491 | // Does the transferance from the property editing area to the property itself |
| 492 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 493 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 494 | |
| 495 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 496 | |
| 497 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 498 | |
| 499 | // Called when the edit (...) button is pressed. |
| 500 | void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 501 | |
| 502 | protected: |
| 503 | wxString m_filenameWildCard; |
| 504 | wxString m_filenameMessage; |
| 505 | |
| 506 | }; |
| 507 | |
| 508 | class WXDLLEXPORT wxColourListValidator: public wxPropertyListValidator |
| 509 | { |
| 510 | DECLARE_DYNAMIC_CLASS(wxColourListValidator) |
| 511 | protected: |
| 512 | public: |
| 513 | wxColourListValidator(long flags = 0); |
| 514 | |
| 515 | ~wxColourListValidator(void); |
| 516 | |
| 517 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 518 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 519 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 520 | |
| 521 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 522 | |
| 523 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 524 | |
| 525 | // Called when the edit (...) button is pressed. |
| 526 | void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 527 | }; |
| 528 | |
| 529 | class WXDLLEXPORT wxListOfStringsListValidator: public wxPropertyListValidator |
| 530 | { |
| 531 | DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator) |
| 532 | protected: |
| 533 | public: |
| 534 | wxListOfStringsListValidator(long flags = 0); |
| 535 | |
| 536 | ~wxListOfStringsListValidator(void) |
| 537 | { |
| 538 | } |
| 539 | |
| 540 | bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 541 | |
| 542 | // Called when TICK is pressed or focus is lost. |
| 543 | // Return FALSE if value didn't check out; signal to restore old value. |
| 544 | bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 545 | |
| 546 | // Called when TICK is pressed or focus is lost or view wants to update |
| 547 | // the property list. |
| 548 | // Does the transfer from the property editing area to the property itself |
| 549 | bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 550 | bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 551 | |
| 552 | // Called when the property is double clicked. |
| 553 | bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 554 | |
| 555 | bool EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title = _T("String List Editor")); |
| 556 | |
| 557 | // Called when the edit (...) button is pressed. |
| 558 | void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); |
| 559 | }; |
| 560 | |
| 561 | #endif |
| 562 | // _WX_PROPLIST_H_ |