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