1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: propgrid.h 3 // Purpose: interface of wxPropertyGrid 4 // Author: wxWidgets team 5 // Licence: wxWindows licence 6 ///////////////////////////////////////////////////////////////////////////// 7 8 9 /** 10 @section propgrid_window_styles wxPropertyGrid Window Styles 11 12 SetWindowStyleFlag method can be used to modify some of these at run-time. 13 @{ 14 */ 15 enum wxPG_WINDOW_STYLES 16 { 17 18 /** 19 This will cause Sort() automatically after an item is added. 20 When inserting a lot of items in this mode, it may make sense to 21 use Freeze() before operations and Thaw() afterwards to increase 22 performance. 23 @hideinitializer 24 */ 25 wxPG_AUTO_SORT = 0x00000010, 26 27 /** 28 Categories are not initially shown (even if added). 29 IMPORTANT NOTE: If you do not plan to use categories, then this 30 style will waste resources. 31 This flag can also be changed using wxPropertyGrid::EnableCategories method. 32 @hideinitializer 33 */ 34 wxPG_HIDE_CATEGORIES = 0x00000020, 35 36 /** 37 This style combines non-categoric mode and automatic sorting. 38 @hideinitializer 39 */ 40 wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT), 41 42 /** 43 Modified values are shown in bold font. Changing this requires Refresh() 44 to show changes. 45 @hideinitializer 46 */ 47 wxPG_BOLD_MODIFIED = 0x00000040, 48 49 /** 50 When wxPropertyGrid is resized, splitter moves to the center. This 51 behaviour stops once the user manually moves the splitter. 52 @hideinitializer 53 */ 54 wxPG_SPLITTER_AUTO_CENTER = 0x00000080, 55 56 /** 57 Display tool tips for cell text that cannot be shown completely. If 58 wxUSE_TOOLTIPS is 0, then this doesn't have any effect. 59 @hideinitializer 60 */ 61 wxPG_TOOLTIPS = 0x00000100, 62 63 /** 64 Disables margin and hides all expand/collapse buttons that would appear 65 outside the margin (for sub-properties). Toggling this style automatically 66 expands all collapsed items. 67 @hideinitializer 68 */ 69 wxPG_HIDE_MARGIN = 0x00000200, 70 71 /** 72 This style prevents user from moving the splitter. 73 @hideinitializer 74 */ 75 wxPG_STATIC_SPLITTER = 0x00000400, 76 77 /** 78 Combination of other styles that make it impossible for user to modify 79 the layout. 80 @hideinitializer 81 */ 82 wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER), 83 84 /** 85 Disables wxTextCtrl based editors for properties which 86 can be edited in another way. Equals calling 87 wxPropertyGrid::LimitPropertyEditing() for all added properties. 88 @hideinitializer 89 */ 90 wxPG_LIMITED_EDITING = 0x00000800, 91 92 /** 93 wxPropertyGridManager only: Show tool bar for mode and page selection. 94 @hideinitializer 95 */ 96 wxPG_TOOLBAR = 0x00001000, 97 98 /** 99 wxPropertyGridManager only: Show adjustable text box showing description 100 or help text, if available, for currently selected property. 101 @hideinitializer 102 */ 103 wxPG_DESCRIPTION = 0x00002000, 104 105 /** wxPropertyGridManager only: don't show an internal border around the 106 property grid. Recommended if you use a header. 107 @hideinitializer 108 */ 109 wxPG_NO_INTERNAL_BORDER = 0x00004000, 110 111 /** A mask which can be used to filter (out) all styles. 112 @hideinitializer 113 */ 114 wxPG_WINDOW_STYLE_MASK = wxPG_AUTO_SORT|wxPG_HIDE_CATEGORIES|wxPG_BOLD_MODIFIED| 115 wxPG_SPLITTER_AUTO_CENTER|wxPG_TOOLTIPS|wxPG_HIDE_MARGIN| 116 wxPG_STATIC_SPLITTER|wxPG_LIMITED_EDITING|wxPG_TOOLBAR| 117 wxPG_DESCRIPTION|wxPG_NO_INTERNAL_BORDER 118 }; 119 120 /** 121 NOTE: wxPG_EX_xxx are extra window styles and must be set using SetExtraStyle() 122 member function. 123 */ 124 enum wxPG_EX_WINDOW_STYLES 125 { 126 /** 127 Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if 128 wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is not 129 activated, and switching the mode first time becomes somewhat slower. 130 wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away. 131 132 @remarks 133 If you do plan not switching to non-categoric mode, or if 134 you don't plan to use categories at all, then using this style will result 135 in waste of resources. 136 137 @hideinitializer 138 */ 139 wxPG_EX_INIT_NOCAT = 0x00001000, 140 141 /** 142 Extended window style that sets wxPropertyGridManager tool bar to not 143 use flat style. 144 @hideinitializer 145 */ 146 wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000, 147 148 /** 149 Shows alphabetic/categoric mode buttons on wxPropertyGridManager tool bar. 150 @hideinitializer 151 */ 152 wxPG_EX_MODE_BUTTONS = 0x00008000, 153 154 /** 155 Show property help strings as tool tips instead as text on the status bar. 156 You can set the help strings using SetPropertyHelpString member function. 157 @hideinitializer 158 */ 159 wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000, 160 161 /** 162 Allows relying on native double-buffering. 163 @hideinitializer 164 */ 165 wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000, 166 167 /** 168 Set this style to let user have ability to set values of properties to 169 unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for 170 all properties. 171 @hideinitializer 172 */ 173 wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000, 174 175 /** 176 If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION and 177 wxPG_STRING_PASSWORD) are not stored into property's attribute storage (thus 178 they are not readable). 179 180 @remarks 181 This option is global, and applies to all wxPG property containers. 182 183 @hideinitializer 184 */ 185 wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000, 186 187 /** 188 Hides page selection buttons from wxPropertyGridManager tool bar. 189 @hideinitializer 190 */ 191 wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000, 192 193 /** Allows multiple properties to be selected by user (by pressing SHIFT 194 when clicking on a property, or by dragging with left mouse button 195 down). 196 197 You can get array of selected properties with 198 wxPropertyGridInterface::GetSelectedProperties(). In multiple selection 199 mode wxPropertyGridInterface::GetSelection() returns 200 property which has editor active (usually the first one 201 selected). Other useful member functions are ClearSelection(), 202 AddToSelection() and RemoveFromSelection(). 203 @hideinitializer 204 */ 205 wxPG_EX_MULTIPLE_SELECTION = 0x02000000, 206 207 /** 208 This enables top-level window tracking which allows wxPropertyGrid to 209 notify the application of last-minute property value changes by user. 210 211 This style is not enabled by default because it may cause crashes when 212 wxPropertyGrid is used in with wxAUI or similar system. 213 214 @remarks If you are not in fact using any system that may change 215 wxPropertyGrid's top-level parent window on its own, then you 216 are recommended to enable this style. 217 218 @hideinitializer 219 */ 220 wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000, 221 222 /** Don't show divider above wxPropertyGridManager toolbar (wxMSW only). 223 @hideinitializer 224 */ 225 wxPG_EX_NO_TOOLBAR_DIVIDER = 0x04000000, 226 227 /** Show a separator below the wxPropertyGridManager toolbar. 228 @hideinitializer 229 */ 230 wxPG_EX_TOOLBAR_SEPARATOR = 0x08000000, 231 232 /** Allows taking focus on the entire area (on canvas) 233 even if wxPropertyGrid is not a standalone control. 234 @hideinitializer 235 */ 236 wxPG_EX_ALWAYS_ALLOW_FOCUS = 0x00100000, 237 238 /** A mask which can be used to filter (out) all extra styles applicable to wxPropertyGrid. 239 @hideinitializer 240 */ 241 wxPG_EX_WINDOW_PG_STYLE_MASK = wxPG_EX_INIT_NOCAT|wxPG_EX_HELP_AS_TOOLTIPS|wxPG_EX_NATIVE_DOUBLE_BUFFERING| 242 wxPG_EX_AUTO_UNSPECIFIED_VALUES|wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES| 243 wxPG_EX_MULTIPLE_SELECTION|wxPG_EX_ENABLE_TLP_TRACKING|wxPG_EX_ALWAYS_ALLOW_FOCUS, 244 245 /** A mask which can be used to filter (out) all extra styles applicable to wxPropertyGridManager. 246 @hideinitializer 247 */ 248 wxPG_EX_WINDOW_PGMAN_STYLE_MASK = wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS|wxPG_EX_HIDE_PAGE_BUTTONS| 249 wxPG_EX_NO_TOOLBAR_DIVIDER|wxPG_EX_TOOLBAR_SEPARATOR, 250 251 /** A mask which can be used to filter (out) all extra styles. 252 @hideinitializer 253 */ 254 wxPG_EX_WINDOW_STYLE_MASK = wxPG_EX_WINDOW_PG_STYLE_MASK|wxPG_EX_WINDOW_PGMAN_STYLE_MASK 255 }; 256 257 /** Combines various styles. 258 */ 259 #define wxPG_DEFAULT_STYLE (0) 260 261 /** Combines various styles. 262 */ 263 #define wxPGMAN_DEFAULT_STYLE (0) 264 265 /** @} 266 */ 267 268 // ----------------------------------------------------------------------- 269 270 /** 271 @section propgrid_vfbflags wxPropertyGrid Validation Failure behaviour Flags 272 @{ 273 */ 274 275 enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS 276 { 277 /** 278 Prevents user from leaving property unless value is valid. If this 279 behaviour flag is not used, then value change is instead cancelled. 280 @hideinitializer 281 */ 282 wxPG_VFB_STAY_IN_PROPERTY = 0x01, 283 284 /** 285 Calls wxBell() on validation failure. 286 @hideinitializer 287 */ 288 wxPG_VFB_BEEP = 0x02, 289 290 /** 291 Cell with invalid value will be marked (with red colour). 292 @hideinitializer 293 */ 294 wxPG_VFB_MARK_CELL = 0x04, 295 296 /** 297 Display a text message explaining the situation. 298 299 To customize the way the message is displayed, you need to 300 reimplement wxPropertyGrid::DoShowPropertyError() in a 301 derived class. Default behaviour is to display the text on 302 the top-level frame's status bar, if present, and otherwise 303 using wxMessageBox. 304 @hideinitializer 305 */ 306 wxPG_VFB_SHOW_MESSAGE = 0x08, 307 308 /** 309 Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the 310 message using wxMessageBox. 311 @hideinitializer 312 */ 313 wxPG_VFB_SHOW_MESSAGEBOX = 0x10, 314 315 /** 316 Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the 317 message on the status bar (when present - you can reimplement 318 wxPropertyGrid::GetStatusBar() in a derived class to specify 319 this yourself). 320 @hideinitializer 321 */ 322 wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20, 323 324 /** 325 Defaults. 326 @hideinitializer 327 */ 328 wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL | 329 wxPG_VFB_SHOW_MESSAGEBOX, 330 }; 331 332 /** @} 333 */ 334 335 /** 336 Having this as define instead of wxByte typedef makes things easier for 337 wxPython bindings (ignoring and redefining it in SWIG interface file 338 seemed rather tricky) 339 */ 340 #define wxPGVFBFlags unsigned char 341 342 /** 343 @class wxPGValidationInfo 344 345 Used to convey validation information to and from functions that 346 actually perform validation. Mostly used in custom property classes. 347 */ 348 class wxPGValidationInfo 349 { 350 friend class wxPropertyGrid; 351 352 public: 353 /** 354 @return Returns failure behaviour which is a combination of 355 @ref propgrid_vfbflags. 356 */ 357 wxPGVFBFlags GetFailureBehavior(); 358 359 /** 360 Returns current failure message. 361 */ 362 const wxString& GetFailureMessage() const; 363 364 /** 365 Returns reference to pending value. 366 */ 367 wxVariant& GetValue(); 368 369 /** Set validation failure behaviour 370 371 @param failureBehavior 372 Mixture of @ref propgrid_vfbflags. 373 */ 374 void SetFailureBehavior(wxPGVFBFlags failureBehavior); 375 376 /** 377 Set current failure message. 378 */ 379 void SetFailureMessage(const wxString& message); 380 }; 381 382 // ----------------------------------------------------------------------- 383 384 /** 385 @section propgrid_keyboard_actions wxPropertyGrid Action Identifiers 386 387 These are used with wxPropertyGrid::AddActionTrigger() and 388 wxPropertyGrid::ClearActionTriggers(). 389 @{ 390 */ 391 392 enum wxPG_KEYBOARD_ACTIONS 393 { 394 /** 395 @hideinitializer 396 */ 397 wxPG_ACTION_INVALID = 0, 398 399 /** Select the next property. */ 400 wxPG_ACTION_NEXT_PROPERTY, 401 402 /** Select the previous property. */ 403 wxPG_ACTION_PREV_PROPERTY, 404 405 /** Expand the selected property, if it has child items. */ 406 wxPG_ACTION_EXPAND_PROPERTY, 407 408 /** Collapse the selected property, if it has child items. */ 409 wxPG_ACTION_COLLAPSE_PROPERTY, 410 411 // Cancel and undo any editing done in the currently active property 412 // editor. 413 wxPG_ACTION_CANCEL_EDIT, 414 415 /** Move focus to the editor control of the currently selected 416 property. 417 */ 418 wxPG_ACTION_EDIT, 419 420 /** Causes editor's button (if any) to be pressed. */ 421 wxPG_ACTION_PRESS_BUTTON, 422 423 wxPG_ACTION_MAX 424 }; 425 426 /** @} 427 */ 428 429 /** This callback function is used for sorting properties. 430 431 Call wxPropertyGrid::SetSortFunction() to set it. 432 433 Sort function should return a value greater than 0 if position of p1 is 434 after p2. So, for instance, when comparing property names, you can use 435 following implementation: 436 437 @code 438 int MyPropertySortFunction(wxPropertyGrid* propGrid, 439 wxPGProperty* p1, 440 wxPGProperty* p2) 441 { 442 return p1->GetBaseName().compare( p2->GetBaseName() ); 443 } 444 @endcode 445 */ 446 typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid, 447 wxPGProperty* p1, 448 wxPGProperty* p2); 449 450 // ----------------------------------------------------------------------- 451 452 /** 453 @class wxPropertyGrid 454 455 wxPropertyGrid is a specialized grid for editing properties - in other 456 words name = value pairs. List of ready-to-use property classes include 457 strings, numbers, flag sets, fonts, colours and many others. It is possible, 458 for example, to categorize properties, set up a complete tree-hierarchy, 459 add more than two columns, and set arbitrary per-property attributes. 460 461 Please note that most member functions are inherited and as such not 462 documented on this page. This means you will probably also want to read 463 wxPropertyGridInterface class reference. 464 465 See also @ref overview_propgrid. 466 467 @section propgrid_window_styles_ Window Styles 468 469 See @ref propgrid_window_styles. 470 471 @section propgrid_event_handling Event Handling 472 473 Please see wxPropertyGridEvent for the documentation of all event types you 474 can use with wxPropertyGrid. 475 476 @remarks 477 Use Freeze() and Thaw() respectively to disable and enable drawing. 478 This will also delay sorting etc. miscellaneous calculations to the last 479 possible moment. 480 481 @library{wxpropgrid} 482 @category{propgrid} 483 @appearance{propertygrid} 484 */ 485 class wxPropertyGrid : public wxScrolled<wxControl>, 486 public wxPropertyGridInterface 487 { 488 public: 489 /** 490 Two step constructor. 491 Call Create() when this constructor is called to build up the wxPropertyGrid 492 */ 493 wxPropertyGrid(); 494 495 /** 496 Constructor. 497 The styles to be used are styles valid for the wxWindow. 498 499 @see @ref propgrid_window_styles. 500 */ 501 wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY, 502 const wxPoint& pos = wxDefaultPosition, 503 const wxSize& size = wxDefaultSize, 504 long style = wxPG_DEFAULT_STYLE, 505 const wxString& name = wxPropertyGridNameStr ); 506 507 /** Destructor */ 508 virtual ~wxPropertyGrid(); 509 510 /** 511 Adds given key combination to trigger given action. 512 513 Here is a sample code to make Enter key press move focus to 514 the next property. 515 516 @code 517 propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY, 518 WXK_RETURN); 519 propGrid->DedicateKey(WXK_RETURN); 520 @endcode 521 522 @param action 523 Which action to trigger. See @ref propgrid_keyboard_actions. 524 @param keycode 525 Which keycode triggers the action. 526 @param modifiers 527 Which key event modifiers, in addition to keycode, are needed to 528 trigger the action. 529 */ 530 void AddActionTrigger( int action, int keycode, int modifiers = 0 ); 531 532 /** 533 Adds given property into selection. If ::wxPG_EX_MULTIPLE_SELECTION 534 extra style is not used, then this has same effect as 535 calling SelectProperty(). 536 537 @remarks Multiple selection is not supported for categories. This 538 means that if you have properties selected, you cannot 539 add category to selection, and also if you have category 540 selected, you cannot add other properties to selection. 541 This member function will fail silently in these cases, 542 even returning @true. 543 */ 544 bool AddToSelection( wxPGPropArg id ); 545 546 /** 547 This static function enables or disables automatic use of 548 wxGetTranslation() for following strings: wxEnumProperty list labels, 549 wxFlagsProperty child property labels. 550 551 Default is @false. 552 */ 553 static void AutoGetTranslation( bool enable ); 554 555 /** 556 Creates label editor wxTextCtrl for given column, for property 557 that is currently selected. When multiple selection is 558 enabled, this applies to whatever property GetSelection() 559 returns. 560 561 @param colIndex 562 Which column's label to edit. Note that you should not 563 use value 1, which is reserved for property value 564 column. 565 566 @see EndLabelEdit(), MakeColumnEditable() 567 */ 568 void BeginLabelEdit( unsigned int colIndex = 0 ); 569 570 /** 571 Changes value of a property, as if from an editor. Use this instead of 572 SetPropertyValue() if you need the value to run through validation 573 process, and also send @c wxEVT_PG_CHANGED. 574 575 @remarks Since this function sends @c wxEVT_PG_CHANGED, it should not 576 be called from @c EVT_PG_CHANGED handler. 577 578 @return Returns @true if value was successfully changed. 579 */ 580 bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue ); 581 582 /** 583 Centers the splitter. 584 585 @param enableAutoResizing 586 If @true, automatic column resizing is enabled (only applicable 587 if window style ::wxPG_SPLITTER_AUTO_CENTER is used). 588 */ 589 void CenterSplitter( bool enableAutoResizing = false ); 590 591 /** 592 Deletes all properties. 593 */ 594 virtual void Clear(); 595 596 /** 597 Clears action triggers for given action. 598 599 @param action 600 Which action to trigger. @ref propgrid_keyboard_actions. 601 */ 602 void ClearActionTriggers( int action ); 603 604 /** 605 Forces updating the value of property from the editor control. 606 Note that @c wxEVT_PG_CHANGING and @c wxEVT_PG_CHANGED are dispatched using 607 ProcessEvent, meaning your event handlers will be called immediately. 608 609 @return Returns @true if anything was changed. 610 */ 611 virtual bool CommitChangesFromEditor( wxUint32 flags = 0 ); 612 613 /** 614 Two step creation. Whenever the control is created without any 615 parameters, use Create to actually create it. Don't access the control's 616 public methods before this is called 617 618 @see @ref propgrid_window_styles. 619 */ 620 bool Create( wxWindow *parent, wxWindowID id = wxID_ANY, 621 const wxPoint& pos = wxDefaultPosition, 622 const wxSize& size = wxDefaultSize, 623 long style = wxPG_DEFAULT_STYLE, 624 const wxString& name = wxPropertyGridNameStr ); 625 626 /** 627 Dedicates a specific keycode to wxPropertyGrid. This means that such 628 key presses will not be redirected to editor controls. 629 630 Using this function allows, for example, navigation between 631 properties using arrow keys even when the focus is in the editor 632 control. 633 */ 634 void DedicateKey( int keycode ); 635 636 /** 637 Enables or disables (shows/hides) categories according to parameter 638 enable. 639 640 @remarks This functions deselects selected property, if any. Validation 641 failure option ::wxPG_VFB_STAY_IN_PROPERTY is not respected, i.e. 642 selection is cleared even if editor had invalid value. 643 */ 644 bool EnableCategories( bool enable ); 645 646 /** 647 Destroys label editor wxTextCtrl, if any. 648 649 @param commit 650 Use @true (default) to store edited label text in 651 property cell data. 652 653 @see BeginLabelEdit(), MakeColumnEditable() 654 */ 655 void EndLabelEdit( bool commit = true ); 656 657 /** 658 Scrolls and/or expands items to ensure that the given item is visible. 659 660 @return Returns @true if something was actually done. 661 */ 662 bool EnsureVisible( wxPGPropArg id ); 663 664 /** 665 Reduces column sizes to minimum possible, while still retaining 666 fully visible grid contents (labels, images). 667 668 @return Minimum size for the grid to still display everything. 669 670 @remarks Does not work well with ::wxPG_SPLITTER_AUTO_CENTER window style. 671 672 This function only works properly if grid size prior to call was 673 already fairly large. 674 675 Note that you can also get calculated column widths by calling 676 GetState->GetColumnWidth() immediately after this function 677 returns. 678 */ 679 wxSize FitColumns(); 680 681 /** 682 Returns currently active label editor, @NULL if none. 683 */ 684 wxTextCtrl* GetLabelEditor() const; 685 686 /** 687 Returns wxWindow that the properties are painted on, and which should be 688 used as the parent for editor controls. 689 */ 690 wxWindow* GetPanel(); 691 692 /** 693 Returns current category caption background colour. 694 */ 695 wxColour GetCaptionBackgroundColour() const; 696 697 /** 698 Returns current category caption font. 699 */ 700 wxFont& GetCaptionFont(); 701 702 /** 703 Returns current category caption text colour. 704 */ 705 wxColour GetCaptionForegroundColour() const; 706 707 /** 708 Returns current cell background colour. 709 */ 710 wxColour GetCellBackgroundColour() const; 711 712 /** 713 Returns current cell text colour when disabled. 714 */ 715 wxColour GetCellDisabledTextColour() const; 716 717 /** 718 Returns current cell text colour. 719 */ 720 wxColour GetCellTextColour() const; 721 722 /** 723 Returns number of columns currently on grid. 724 */ 725 unsigned int GetColumnCount() const; 726 727 /** 728 Returns colour of empty space below properties. 729 */ 730 wxColour GetEmptySpaceColour() const; 731 732 /** 733 Returns height of highest characters of used font. 734 */ 735 int GetFontHeight() const; 736 737 /** 738 Returns pointer to itself. Dummy function that enables same kind 739 of code to use wxPropertyGrid and wxPropertyGridManager. 740 */ 741 wxPropertyGrid* GetGrid(); 742 743 /** 744 Returns rectangle of custom paint image. 745 746 @param property 747 Return image rectangle for this property. 748 749 @param item 750 Which choice of property to use (each choice may have 751 different image). 752 */ 753 wxRect GetImageRect( wxPGProperty* property, int item ) const; 754 755 /** 756 Returns size of the custom paint image in front of property. 757 758 @param property 759 Return image rectangle for this property. 760 If this argument is @NULL, then preferred size is returned. 761 762 @param item 763 Which choice of property to use (each choice may have 764 different image). 765 */ 766 wxSize GetImageSize( wxPGProperty* property = NULL, int item = -1 ) const; 767 768 /** 769 Returns last item which could be iterated using given flags. 770 771 @param flags 772 See @ref propgrid_iterator_flags. 773 */ 774 wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ); 775 776 /** 777 Returns colour of lines between cells. 778 */ 779 wxColour GetLineColour() const; 780 781 /** 782 Returns background colour of margin. 783 */ 784 wxColour GetMarginColour() const; 785 786 /** 787 Returns margin width. 788 */ 789 int GetMarginWidth() const; 790 791 /** 792 Returns "root property". It does not have name, etc. and it is not 793 visible. It is only useful for accessing its children. 794 */ 795 wxPGProperty* GetRoot() const; 796 797 /** 798 Returns height of a single grid row (in pixels). 799 */ 800 int GetRowHeight() const; 801 802 /** 803 Returns currently selected property. 804 */ 805 wxPGProperty* GetSelectedProperty() const; 806 807 /** 808 Returns currently selected property. 809 */ 810 wxPGProperty* GetSelection() const; 811 812 /** 813 Returns current selection background colour. 814 */ 815 wxColour GetSelectionBackgroundColour() const; 816 817 /** 818 Returns current selection text colour. 819 */ 820 wxColour GetSelectionForegroundColour() const; 821 822 /** 823 Returns the property sort function (default is @NULL). 824 825 @see SetSortFunction 826 */ 827 wxPGSortCallback GetSortFunction() const; 828 829 /** 830 Returns current splitter x position. 831 */ 832 int GetSplitterPosition( unsigned int splitterIndex = 0 ) const; 833 834 /** 835 Returns wxTextCtrl active in currently selected property, if any. Takes 836 wxOwnerDrawnComboBox into account. 837 */ 838 wxTextCtrl* GetEditorTextCtrl() const; 839 840 /** 841 Returns current appearance of unspecified value cells. 842 843 @see SetUnspecifiedValueAppearance() 844 */ 845 const wxPGCell& GetUnspecifiedValueAppearance() const; 846 847 /** 848 Returns (visual) text representation of the unspecified 849 property value. 850 851 @param argFlags For internal use only. 852 */ 853 wxString GetUnspecifiedValueText( int argFlags = 0 ) const; 854 855 /** 856 Returns current vertical spacing. 857 */ 858 int GetVerticalSpacing() const; 859 860 /** 861 Returns information about arbitrary position in the grid. 862 863 @param pt 864 Coordinates in the virtual grid space. You may need to use 865 wxScrolled<T>::CalcScrolledPosition() for translating 866 wxPropertyGrid client coordinates into something this member 867 function can use. 868 */ 869 wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const; 870 871 /** 872 Returns @true if any property has been modified by the user. 873 */ 874 bool IsAnyModified() const; 875 876 /** 877 Returns @true if a property editor control has focus. 878 */ 879 bool IsEditorFocused() const; 880 881 /** 882 Returns @true if updating is frozen (i.e. Freeze() called but not 883 yet Thaw() ). 884 */ 885 bool IsFrozen() const; 886 887 /** 888 Makes given column editable by user. 889 890 @param column 891 The index of the column to make editable. 892 @param editable 893 Using @false here will disable column from being editable. 894 895 Note that @a column must not be equal to 1, as the second column is 896 always editable and can be made read-only only on cell-by-cell basis 897 using @code wxPGProperty::ChangeFlag(wxPG_PROP_READONLY, true) @endcode 898 899 @see BeginLabelEdit(), EndLabelEdit() 900 */ 901 void MakeColumnEditable( unsigned int column, bool editable = true ); 902 903 /** 904 It is recommended that you call this function any time your code causes 905 wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle() 906 handler should be able to detect most changes, but it is not perfect. 907 908 @param newTLP 909 New top-level parent that is about to be set. Old top-level parent 910 window should still exist as the current one. 911 912 @remarks This function is automatically called from wxPropertyGrid:: 913 Reparent() and wxPropertyGridManager::Reparent(). You only 914 need to use it if you reparent wxPropertyGrid indirectly. 915 */ 916 void OnTLPChanging( wxWindow* newTLP ); 917 918 /** 919 Refreshes any active editor control. 920 */ 921 void RefreshEditor(); 922 923 /** 924 Redraws given property. 925 */ 926 virtual void RefreshProperty( wxPGProperty* p ); 927 928 929 /** Forwards to DoRegisterEditorClass with empty name. */ 930 static wxPGEditor* RegisterEditorClass( wxPGEditor* editor, 931 bool noDefCheck = false ); 932 /** 933 Registers a new editor class. 934 935 @return Returns pointer to the editor class instance that should be used. 936 */ 937 static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editor, 938 const wxString& name, 939 bool noDefCheck = false ); 940 941 /** 942 Resets all colours to the original system values. 943 */ 944 void ResetColours(); 945 946 /** 947 Resets column sizes and splitter positions, based on proportions. 948 949 @param enableAutoResizing 950 If @true, automatic column resizing is enabled (only applicable 951 if window style ::wxPG_SPLITTER_AUTO_CENTER is used). 952 953 @see wxPropertyGridInterface::SetColumnProportion() 954 */ 955 void ResetColumnSizes( bool enableAutoResizing = false ); 956 957 /** 958 Removes given property from selection. If property is not selected, 959 an assertion failure will occur. 960 */ 961 bool RemoveFromSelection( wxPGPropArg id ); 962 963 /** 964 Selects a property. Editor widget is automatically created, but 965 not focused unless focus is @true. 966 967 @param id 968 Property to select (name or pointer). 969 970 @param focus 971 If @true, move keyboard focus to the created editor right away. 972 973 @return returns @true if selection finished successfully. Usually only 974 fails if current value in editor is not valid. 975 976 @remarks In wxWidgets 2.9 and later, this function no longer 977 sends @c wxEVT_PG_SELECTED. 978 979 @remarks This clears any previous selection. 980 981 @see wxPropertyGridInterface::ClearSelection() 982 */ 983 bool SelectProperty( wxPGPropArg id, bool focus = false ); 984 985 /** 986 Sets category caption background colour. 987 */ 988 void SetCaptionBackgroundColour(const wxColour& col); 989 990 /** 991 Sets category caption text colour. 992 */ 993 void SetCaptionTextColour(const wxColour& col); 994 995 /** 996 Sets default cell background colour - applies to property cells. 997 Note that appearance of editor widgets may not be affected. 998 */ 999 void SetCellBackgroundColour(const wxColour& col); 1000 1001 /** 1002 Sets cell text colour for disabled properties. 1003 */ 1004 void SetCellDisabledTextColour(const wxColour& col); 1005 1006 /** 1007 Sets default cell text colour - applies to property name and value text. 1008 Note that appearance of editor widgets may not be affected. 1009 */ 1010 void SetCellTextColour(const wxColour& col); 1011 1012 /** 1013 Set number of columns (2 or more). 1014 */ 1015 void SetColumnCount( int colCount ); 1016 1017 /** 1018 Sets the 'current' category - Append will add non-category properties 1019 under it. 1020 */ 1021 void SetCurrentCategory( wxPGPropArg id ); 1022 1023 /** 1024 Sets colour of empty space below properties. 1025 */ 1026 void SetEmptySpaceColour(const wxColour& col); 1027 1028 /** 1029 Sets colour of lines between cells. 1030 */ 1031 void SetLineColour(const wxColour& col); 1032 1033 /** 1034 Sets background colour of margin. 1035 */ 1036 void SetMarginColour(const wxColour& col); 1037 1038 /** 1039 Set entire new selection from given list of properties. 1040 */ 1041 void SetSelection( const wxArrayPGProperty& newSelection ); 1042 1043 /** 1044 Sets selection background colour - applies to selected property name 1045 background. 1046 */ 1047 void SetSelectionBackgroundColour(const wxColour& col); 1048 1049 /** 1050 Sets selection foreground colour - applies to selected property name text. 1051 */ 1052 void SetSelectionTextColour(const wxColour& col); 1053 1054 1055 /** 1056 Sets the property sorting function. 1057 1058 @param sortFunction 1059 The sorting function to be used. It should return a value greater 1060 than 0 if position of p1 is after p2. So, for instance, when 1061 comparing property names, you can use following implementation: 1062 1063 @code 1064 int MyPropertySortFunction(wxPropertyGrid* propGrid, 1065 wxPGProperty* p1, 1066 wxPGProperty* p2) 1067 { 1068 return p1->GetBaseName().compare( p2->GetBaseName() ); 1069 } 1070 @endcode 1071 1072 @remarks 1073 Default property sort function sorts properties by their labels 1074 (case-insensitively). 1075 1076 @see GetSortFunction, wxPropertyGridInterface::Sort, 1077 wxPropertyGridInterface::SortChildren 1078 */ 1079 void SetSortFunction( wxPGSortCallback sortFunction ); 1080 1081 /** 1082 Sets x coordinate of the splitter. 1083 1084 @remarks Splitter position cannot exceed grid size, and therefore setting 1085 it during form creation may fail as initial grid size is often 1086 smaller than desired splitter position, especially when sizers 1087 are being used. 1088 */ 1089 void SetSplitterPosition( int newxpos, int col = 0 ); 1090 1091 /** 1092 Moves splitter as left as possible, while still allowing all 1093 labels to be shown in full. 1094 1095 @param privateChildrenToo 1096 If @false, will still allow private children to be cropped. 1097 */ 1098 void SetSplitterLeft( bool privateChildrenToo = false ); 1099 1100 /** 1101 Sets appearance of value cells representing an unspecified property 1102 value. Default appearance is blank. 1103 1104 @remarks If you set the unspecified value to have any 1105 textual representation, then that will override 1106 "InlineHelp" attribute. 1107 1108 @see wxPGProperty::SetValueToUnspecified(), 1109 wxPGProperty::IsValueUnspecified() 1110 */ 1111 void SetUnspecifiedValueAppearance( const wxPGCell& cell ); 1112 1113 /** 1114 Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font 1115 height. Value of 2 should be default on most platforms. 1116 */ 1117 void SetVerticalSpacing( int vspacing ); 1118 1119 /** 1120 Set virtual width for this particular page. Width -1 indicates that the 1121 virtual width should be disabled. 1122 */ 1123 void SetVirtualWidth( int width ); 1124 1125 /** 1126 Must be called in wxPGEditor::CreateControls() if primary editor window 1127 is wxTextCtrl, just before textctrl is created. 1128 @param text 1129 Initial text value of created wxTextCtrl. 1130 */ 1131 void SetupTextCtrlValue( const wxString& text ); 1132 1133 /** 1134 Unfocuses or closes editor if one was open, but does not deselect 1135 property. 1136 */ 1137 bool UnfocusEditor(); 1138 1139 /** 1140 Draws item, children, and consecutive parents as long as category is 1141 not met. 1142 */ 1143 void DrawItemAndValueRelated( wxPGProperty* p ); 1144 1145 /** 1146 @name wxPropertyGrid customization 1147 1148 Reimplement these member functions in derived class for better 1149 control over wxPropertyGrid behaviour. 1150 */ 1151 //@{ 1152 1153 /** 1154 Override in derived class to display error messages in custom manner 1155 (these message usually only result from validation failure). 1156 1157 @remarks If you implement this, then you also need to implement 1158 DoHidePropertyError() - possibly to do nothing, if error 1159 does not need hiding (e.g. it was logged or shown in a 1160 message box). 1161 1162 @see DoHidePropertyError() 1163 */ 1164 virtual void DoShowPropertyError( wxPGProperty* property, 1165 const wxString& msg ); 1166 1167 /** 1168 Override in derived class to hide an error displayed by 1169 DoShowPropertyError(). 1170 1171 @see DoShowPropertyError() 1172 */ 1173 virtual void DoHidePropertyError( wxPGProperty* property ); 1174 1175 /** 1176 Return wxStatusBar that is used by this wxPropertyGrid. You can 1177 reimplement this member function in derived class to override 1178 the default behaviour of using the top-level wxFrame's status 1179 bar, if any. 1180 */ 1181 virtual wxStatusBar* GetStatusBar(); 1182 1183 /** Override to customize property validation failure behaviour. 1184 1185 @param 1186 property Property with entered an invalid value 1187 1188 @param invalidValue 1189 Value which failed in validation. 1190 1191 @return 1192 Return @true if user is allowed to change to another property even 1193 if current has invalid value. 1194 */ 1195 virtual bool DoOnValidationFailure( wxPGProperty* property, 1196 wxVariant& invalidValue ); 1197 1198 /** Override to customize resetting of property validation failure status. 1199 @remarks 1200 Property is guaranteed to have flag ::wxPG_PROP_INVALID_VALUE set. 1201 */ 1202 virtual void DoOnValidationFailureReset( wxPGProperty* property ); 1203 1204 //@} 1205 1206 /** 1207 @name Property development functions 1208 1209 These member functions are usually only called when creating custom 1210 user properties. 1211 */ 1212 //@{ 1213 1214 /** 1215 Call when editor widget's contents is modified. For example, this is 1216 called when changes text in wxTextCtrl (used in wxStringProperty and 1217 wxIntProperty). 1218 1219 @remarks This function should only be called by custom properties. 1220 1221 @see wxPGProperty::OnEvent() 1222 */ 1223 void EditorsValueWasModified(); 1224 1225 /** 1226 Reverse of EditorsValueWasModified(). 1227 1228 @remarks This function should only be called by custom properties. 1229 */ 1230 void EditorsValueWasNotModified(); 1231 1232 /** 1233 Returns most up-to-date value of selected property. This will return 1234 value different from GetSelectedProperty()->GetValue() only when text 1235 editor is activate and string edited by user represents valid, 1236 uncommitted property value. 1237 */ 1238 wxVariant GetUncommittedPropertyValue(); 1239 1240 /** 1241 Returns @true if editor's value was marked modified. 1242 */ 1243 bool IsEditorsValueModified() const; 1244 1245 /** 1246 Shows a brief error message that is related to a property. 1247 */ 1248 void ShowPropertyError( wxPGPropArg id, const wxString& msg ); 1249 1250 /** 1251 Call this from wxPGProperty::OnEvent() to cause property value to be 1252 changed after the function returns (with @true as return value). 1253 ValueChangeInEvent() must be used if you wish the application to be 1254 able to use wxEVT_PG_CHANGING to potentially veto the given value. 1255 */ 1256 void ValueChangeInEvent( wxVariant variant ); 1257 1258 /** 1259 You can use this member function, for instance, to detect in 1260 wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was 1261 already called in wxPGEditor::OnEvent(). It really only detects 1262 if was value was changed using wxPGProperty::SetValueInEvent(), which 1263 is usually used when a 'picker' dialog is displayed. If value was 1264 written by "normal means" in wxPGProperty::StringToValue() or 1265 IntToValue(), then this function will return @false (on the other hand, 1266 wxPGProperty::OnEvent() is not even called in those cases). 1267 */ 1268 bool WasValueChangedInEvent() const; 1269 1270 //@} 1271 }; 1272 1273 1274 /** 1275 @class wxPropertyGridEvent 1276 1277 A property grid event holds information about events associated with 1278 wxPropertyGrid objects. 1279 To process input from a property grid control, use these event handler macros 1280 to direct input to member functions that take a wxPropertyGridEvent argument. 1281 1282 @beginEventEmissionTable{wxPropertyGridEvent} 1283 @event{EVT_PG_SELECTED (id, func)} 1284 Respond to @c wxEVT_PG_SELECTED event, generated when a property selection 1285 has been changed, either by user action or by indirect program 1286 function. For instance, collapsing a parent property programmatically 1287 causes any selected child property to become unselected, and may 1288 therefore cause this event to be generated. 1289 @event{EVT_PG_CHANGED(id, func)} 1290 Respond to @c wxEVT_PG_CHANGED event, generated when property value 1291 has been changed by the user. 1292 @event{EVT_PG_CHANGING(id, func)} 1293 Respond to @c wxEVT_PG_CHANGING event, generated when property value 1294 is about to be changed by user. Use wxPropertyGridEvent::GetValue() 1295 to take a peek at the pending value, and wxPropertyGridEvent::Veto() 1296 to prevent change from taking place, if necessary. 1297 @event{EVT_PG_HIGHLIGHTED(id, func)} 1298 Respond to @c wxEVT_PG_HIGHLIGHTED event, which occurs when mouse 1299 moves over a property. Event's property is @NULL if hovered area does 1300 not belong to any property. 1301 @event{EVT_PG_RIGHT_CLICK(id, func)} 1302 Respond to @c wxEVT_PG_RIGHT_CLICK event, which occurs when property is 1303 clicked on with right mouse button. 1304 @event{EVT_PG_DOUBLE_CLICK(id, func)} 1305 Respond to @c wxEVT_PG_DOUBLE_CLICK event, which occurs when property is 1306 double-clicked on with left mouse button. 1307 @event{EVT_PG_ITEM_COLLAPSED(id, func)} 1308 Respond to @c wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses 1309 a property or category. 1310 @event{EVT_PG_ITEM_EXPANDED(id, func)} 1311 Respond to @c wxEVT_PG_ITEM_EXPANDED event, generated when user expands 1312 a property or category. 1313 @event{EVT_PG_LABEL_EDIT_BEGIN(id, func)} 1314 Respond to @c wxEVT_PG_LABEL_EDIT_BEGIN event, generated when user is 1315 about to begin editing a property label. You can veto this event to 1316 prevent the action. 1317 @event{EVT_PG_LABEL_EDIT_ENDING(id, func)} 1318 Respond to @c wxEVT_PG_LABEL_EDIT_ENDING event, generated when user is 1319 about to end editing of a property label. You can veto this event to 1320 prevent the action. 1321 @event{EVT_PG_COL_BEGIN_DRAG(id, func)} 1322 Respond to @c wxEVT_PG_COL_BEGIN_DRAG event, generated when user 1323 starts resizing a column - can be vetoed. 1324 @event{EVT_PG_COL_DRAGGING,(id, func)} 1325 Respond to @c wxEVT_PG_COL_DRAGGING, event, generated when a 1326 column resize by user is in progress. This event is also generated 1327 when user double-clicks the splitter in order to recenter 1328 it. 1329 @event{EVT_PG_COL_END_DRAG(id, func)} 1330 Respond to @c wxEVT_PG_COL_END_DRAG event, generated after column 1331 resize by user has finished. 1332 @endEventTable 1333 1334 @library{wxpropgrid} 1335 @category{propgrid} 1336 */ 1337 class wxPropertyGridEvent : public wxCommandEvent 1338 { 1339 public: 1340 1341 /** Constructor. */ 1342 wxPropertyGridEvent(wxEventType commandType=0, int id=0); 1343 1344 /** Copy constructor. */ 1345 wxPropertyGridEvent(const wxPropertyGridEvent& event); 1346 1347 /** Destructor. */ 1348 ~wxPropertyGridEvent(); 1349 1350 /** 1351 Returns @true if you can veto the action that the event is signaling. 1352 */ 1353 bool CanVeto() const; 1354 1355 /** 1356 Returns the column index associated with this event. 1357 For the column dragging events, it is the column to the left 1358 of the splitter being dragged 1359 */ 1360 unsigned int GetColumn() const; 1361 1362 /** 1363 Returns highest level non-category, non-root parent of property for 1364 which event occurred. Useful when you have nested properties with 1365 children. 1366 1367 @remarks If immediate parent is root or category, this will return the 1368 property itself. 1369 */ 1370 wxPGProperty* GetMainParent() const; 1371 1372 /** 1373 Returns property associated with this event. 1374 1375 @remarks You should assume that this property can always be @NULL. 1376 For instance, @c wxEVT_PG_SELECTED is emitted not only when 1377 a new property is selected, but also when selection is 1378 cleared by user activity. 1379 */ 1380 wxPGProperty* GetProperty() const; 1381 1382 /** 1383 Returns current validation failure flags. 1384 */ 1385 wxPGVFBFlags GetValidationFailureBehavior() const; 1386 1387 /** 1388 Returns name of the associated property. 1389 1390 @remarks Property name is stored in event, so it remains 1391 accessible even after the associated property or 1392 the property grid has been deleted. 1393 */ 1394 wxString GetPropertyName() const; 1395 1396 /** 1397 Returns value of the associated property. Works for all event 1398 types, but for @c wxEVT_PG_CHANGING this member function returns 1399 the value that is pending, so you can call Veto() if the 1400 value is not satisfactory. 1401 1402 @remarks Property value is stored in event, so it remains 1403 accessible even after the associated property or 1404 the property grid has been deleted. 1405 */ 1406 wxVariant GetPropertyValue() const; 1407 1408 /** 1409 Returns value of the associated property. 1410 1411 @see GetPropertyValue() 1412 */ 1413 wxVariant GetValue() const; 1414 1415 /** 1416 Set if event can be vetoed. 1417 */ 1418 void SetCanVeto( bool canVeto ); 1419 1420 /** Changes the property associated with this event. */ 1421 void SetProperty( wxPGProperty* p ); 1422 1423 /** 1424 Set override validation failure behaviour. Only effective if Veto() was 1425 also called, and only allowed if event type is @c wxEVT_PG_CHANGING. 1426 */ 1427 void SetValidationFailureBehavior( wxPGVFBFlags flags ); 1428 1429 /** 1430 Sets custom failure message for this time only. Only applies if 1431 ::wxPG_VFB_SHOW_MESSAGE is set in validation failure flags. 1432 */ 1433 void SetValidationFailureMessage( const wxString& message ); 1434 1435 /** 1436 Call this from your event handler to veto action that the event is 1437 signaling. You can only veto a shutdown if wxPropertyGridEvent::CanVeto() 1438 returns @true. 1439 1440 @remarks Currently only @c wxEVT_PG_CHANGING supports vetoing. 1441 */ 1442 void Veto( bool veto = true ); 1443 1444 /** 1445 Returns @true if event was vetoed. 1446 */ 1447 bool WasVetoed() const; 1448 }; 1449 1450 1451 wxEventType wxEVT_PG_SELECTED; 1452 wxEventType wxEVT_PG_CHANGING; 1453 wxEventType wxEVT_PG_CHANGED; 1454 wxEventType wxEVT_PG_HIGHLIGHTED; 1455 wxEventType wxEVT_PG_RIGHT_CLICK; 1456 wxEventType wxEVT_PG_PAGE_CHANGED; 1457 wxEventType wxEVT_PG_ITEM_COLLAPSED; 1458 wxEventType wxEVT_PG_ITEM_EXPANDED; 1459 wxEventType wxEVT_PG_DOUBLE_CLICK; 1460 wxEventType wxEVT_PG_LABEL_EDIT_BEGIN; 1461 wxEventType wxEVT_PG_LABEL_EDIT_ENDING; 1462 wxEventType wxEVT_PG_COL_BEGIN_DRAG; 1463 wxEventType wxEVT_PG_COL_DRAGGING; 1464 wxEventType wxEVT_PG_COL_END_DRAG; 1465 1466 // ----------------------------------------------------------------------- 1467 1468 /** @class wxPropertyGridPopulator 1469 1470 Allows populating wxPropertyGrid from arbitrary text source. 1471 */ 1472 class wxPropertyGridPopulator 1473 { 1474 public: 1475 /** 1476 Default constructor. 1477 */ 1478 wxPropertyGridPopulator(); 1479 1480 /** 1481 Destructor. 1482 */ 1483 virtual ~wxPropertyGridPopulator(); 1484 1485 void SetState( wxPropertyGridPageState* state ); 1486 1487 void SetGrid( wxPropertyGrid* pg ); 1488 1489 /** 1490 Appends a new property under bottommost parent. 1491 1492 @param propClass 1493 Property class as string. 1494 1495 @param propLabel 1496 Property label. 1497 1498 @param propName 1499 Property name. 1500 1501 @param propValue 1502 Property value. 1503 1504 @param pChoices 1505 Set of choices for the property (optional). 1506 */ 1507 wxPGProperty* Add( const wxString& propClass, 1508 const wxString& propLabel, 1509 const wxString& propName, 1510 const wxString* propValue, 1511 wxPGChoices* pChoices = NULL ); 1512 1513 /** 1514 Pushes property to the back of parent array (ie it becomes bottommost 1515 parent), and starts scanning/adding children for it. 1516 1517 When finished, parent array is returned to the original state. 1518 */ 1519 void AddChildren( wxPGProperty* property ); 1520 1521 /** 1522 Adds attribute to the bottommost property. 1523 1524 @param name 1525 Attribute name. 1526 1527 @param type 1528 Allowed values: @c "string", (same as string), @c "int", @c "bool". 1529 Empty string means autodetect. 1530 1531 @param value 1532 Attribute value. 1533 */ 1534 bool AddAttribute( const wxString& name, 1535 const wxString& type, 1536 const wxString& value ); 1537 1538 /** 1539 Called once in AddChildren. 1540 */ 1541 virtual void DoScanForChildren() = 0; 1542 1543 /** 1544 Returns id of parent property for which children can currently be 1545 added. 1546 */ 1547 wxPGProperty* GetCurParent() const; 1548 1549 wxPropertyGridPageState* GetState(); 1550 const wxPropertyGridPageState* GetState() const; 1551 1552 /** 1553 Like wxString::ToLong, except allows N% in addition of N. 1554 */ 1555 static bool ToLongPCT( const wxString& s, long* pval, long max ); 1556 1557 /** 1558 Parses strings of format "choice1"[=value1] ... "choiceN"[=valueN] into 1559 wxPGChoices. Registers parsed result using idString (if not empty). 1560 Also, if choices with given id already registered, then don't parse but 1561 return those choices instead. 1562 */ 1563 wxPGChoices ParseChoices( const wxString& choicesString, 1564 const wxString& idString ); 1565 1566 /** 1567 Implement in derived class to do custom process when an error occurs. 1568 Default implementation uses wxLogError. 1569 */ 1570 virtual void ProcessError( const wxString& msg ); 1571 }; 1572