1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPropertyGrid
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @section propgrid_window_styles wxPropertyGrid Window Styles
13 SetWindowStyleFlag method can be used to modify some of these at run-time.
16 enum wxPG_WINDOW_STYLES
20 This will cause Sort() automatically after an item is added.
21 When inserting a lot of items in this mode, it may make sense to
22 use Freeze() before operations and Thaw() afterwards to increase
25 wxPG_AUTO_SORT
= 0x00000010,
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.
33 wxPG_HIDE_CATEGORIES
= 0x00000020,
36 This style combines non-categoric mode and automatic sorting.
38 wxPG_ALPHABETIC_MODE
= (wxPG_HIDE_CATEGORIES
|wxPG_AUTO_SORT
),
41 Modified values are shown in bold font. Changing this requires Refresh()
44 wxPG_BOLD_MODIFIED
= 0x00000040,
47 When wxPropertyGrid is resized, splitter moves to the center. This
48 behavior stops once the user manually moves the splitter.
50 wxPG_SPLITTER_AUTO_CENTER
= 0x00000080,
53 Display tool tips for cell text that cannot be shown completely. If
54 wxUSE_TOOLTIPS is 0, then this doesn't have any effect.
56 wxPG_TOOLTIPS
= 0x00000100,
59 Disables margin and hides all expand/collapse buttons that would appear
60 outside the margin (for sub-properties). Toggling this style automatically
61 expands all collapsed items.
63 wxPG_HIDE_MARGIN
= 0x00000200,
66 This style prevents user from moving the splitter.
68 wxPG_STATIC_SPLITTER
= 0x00000400,
71 Combination of other styles that make it impossible for user to modify
74 wxPG_STATIC_LAYOUT
= (wxPG_HIDE_MARGIN
|wxPG_STATIC_SPLITTER
),
77 Disables wxTextCtrl based editors for properties which
78 can be edited in another way. Equals calling
79 wxPropertyGrid::LimitPropertyEditing() for all added properties.
81 wxPG_LIMITED_EDITING
= 0x00000800,
84 wxPropertyGridManager only: Show tool bar for mode and page selection.
86 wxPG_TOOLBAR
= 0x00001000,
89 wxPropertyGridManager only: Show adjustable text box showing description
90 or help text, if available, for currently selected property.
92 wxPG_DESCRIPTION
= 0x00002000,
94 /** wxPropertyGridManager only: don't show an internal border around the
95 property grid. Recommended if you use a header.
97 wxPG_NO_INTERNAL_BORDER
= 0x00004000
101 enum wxPG_EX_WINDOW_STYLES
105 NOTE: wxPG_EX_xxx are extra window styles and must be set using SetExtraStyle()
108 Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if
109 wxPG_HIDE_CATEGORIES is not defined, the non-categorized data storage is not
110 activated, and switching the mode first time becomes somewhat slower.
111 wxPG_EX_INIT_NOCAT activates the non-categorized data storage right away.
113 NOTE: If you do plan not switching to non-categoric mode, or if
114 you don't plan to use categories at all, then using this style will result
115 in waste of resources.
117 wxPG_EX_INIT_NOCAT
= 0x00001000,
120 Extended window style that sets wxPropertyGridManager tool bar to not
123 wxPG_EX_NO_FLAT_TOOLBAR
= 0x00002000,
126 Shows alphabetic/categoric mode buttons from tool bar.
128 wxPG_EX_MODE_BUTTONS
= 0x00008000,
131 Show property help strings as tool tips instead as text on the status bar.
132 You can set the help strings using SetPropertyHelpString member function.
134 wxPG_EX_HELP_AS_TOOLTIPS
= 0x00010000,
137 Allows relying on native double-buffering.
139 wxPG_EX_NATIVE_DOUBLE_BUFFERING
= 0x00080000,
142 Set this style to let user have ability to set values of properties to
143 unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
146 wxPG_EX_AUTO_UNSPECIFIED_VALUES
= 0x00200000,
149 If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION and
150 wxPG_STRING_PASSWORD) are not stored into property's attribute storage (thus
151 they are not readable).
153 Note that this option is global, and applies to all wxPG property containers.
155 wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES
= 0x00400000,
158 Hides page selection buttons from tool bar.
160 wxPG_EX_HIDE_PAGE_BUTTONS
= 0x01000000,
162 /** Allows multiple properties to be selected by user (by pressing SHIFT
163 when clicking on a property, or by dragging with left mouse button
166 You can get array of selected properties with
167 wxPropertyGridInterface::GetSelectedProperties(). In multiple selection
168 mode wxPropertyGridInterface::GetSelection() returns
169 property which has editor active (usually the first one
170 selected). Other useful member functions are ClearSelection(),
171 AddToSelection() and RemoveFromSelection().
173 wxPG_EX_MULTIPLE_SELECTION
= 0x02000000,
176 This enables top-level window tracking which allows wxPropertyGrid to
177 notify the application of last-minute property value changes by user.
179 This style is not enabled by default because it may cause crashes when
180 wxPropertyGrid is used in with wxAUI or similar system.
182 @remarks If you are not in fact using any system that may change
183 wxPropertyGrid's top-level parent window on its own, then you
184 are recommended to enable this style.
186 wxPG_EX_ENABLE_TLP_TRACKING
= 0x04000000,
188 /** Don't show divider above toolbar, on Windows.
190 wxPG_EX_NO_TOOLBAR_DIVIDER
= 0x04000000,
192 /** Show a separator below the toolbar.
194 wxPG_EX_TOOLBAR_SEPARATOR
= 0x08000000
198 /** Combines various styles.
200 #define wxPG_DEFAULT_STYLE (0)
202 /** Combines various styles.
204 #define wxPGMAN_DEFAULT_STYLE (0)
209 // -----------------------------------------------------------------------
212 @section propgrid_vfbflags wxPropertyGrid Validation Failure Behavior Flags
216 enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
220 Prevents user from leaving property unless value is valid. If this
221 behavior flag is not used, then value change is instead cancelled.
223 wxPG_VFB_STAY_IN_PROPERTY
= 0x01,
226 Calls wxBell() on validation failure.
228 wxPG_VFB_BEEP
= 0x02,
231 Cell with invalid value will be marked (with red colour).
233 wxPG_VFB_MARK_CELL
= 0x04,
236 Display customizable text message explaining the situation.
238 wxPG_VFB_SHOW_MESSAGE
= 0x08,
243 wxPG_VFB_DEFAULT
= wxPG_VFB_STAY_IN_PROPERTY
|wxPG_VFB_BEEP
,
249 typedef wxByte wxPGVFBFlags
;
254 Used to convey validation information to and from functions that
255 actually perform validation. Mostly used in custom property classes.
257 class wxPGValidationInfo
261 @return Returns failure behavior which is a combination of
262 @ref propgrid_vfbflags.
264 wxPGVFBFlags
GetFailureBehavior();
267 Returns current failure message.
269 const wxString
& GetFailureMessage() const;
272 Returns reference to pending value.
274 wxVariant
& GetValue();
276 /** Set validation failure behavior
278 @param failureBehavior
279 Mixture of @ref propgrid_vfbflags.
281 void SetFailureBehavior(wxPGVFBFlags failureBehavior
);
284 Set current failure message.
286 void SetFailureMessage(const wxString
& message
);
289 // -----------------------------------------------------------------------
292 @section propgrid_keyboard_actions wxPropertyGrid Action Identifiers
294 These are used with wxPropertyGrid::AddActionTrigger() and
295 wxPropertyGrid::ClearActionTriggers().
299 enum wxPG_KEYBOARD_ACTIONS
301 wxPG_ACTION_INVALID
= 0,
302 wxPG_ACTION_NEXT_PROPERTY
,
303 wxPG_ACTION_PREV_PROPERTY
,
304 wxPG_ACTION_EXPAND_PROPERTY
,
305 wxPG_ACTION_COLLAPSE_PROPERTY
,
306 wxPG_ACTION_CANCEL_EDIT
,
313 /** This callback function is used for sorting properties.
315 Call wxPropertyGrid::SetSortFunction() to set it.
317 Sort function should return a value greater than 0 if position of p1 is
318 after p2. So, for instance, when comparing property names, you can use
319 following implementation:
322 int MyPropertySortFunction(wxPropertyGrid* propGrid,
326 return p1->GetBaseName().compare( p2->GetBaseName() );
330 typedef int (*wxPGSortCallback
)(wxPropertyGrid
* propGrid
,
334 // -----------------------------------------------------------------------
337 @class wxPropertyGrid
339 wxPropertyGrid is a specialized grid for editing properties - in other
340 words name = value pairs. List of ready-to-use property classes include
341 strings, numbers, flag sets, fonts, colours and many others. It is possible,
342 for example, to categorize properties, set up a complete tree-hierarchy,
343 add more than two columns, and set arbitrary per-property attributes.
345 Please note that most member functions are inherited and as such not
346 documented on this page. This means you will probably also want to read
347 wxPropertyGridInterface class reference.
349 See also @ref overview_propgrid.
351 @section propgrid_window_styles_ Window Styles
353 See @ref propgrid_window_styles.
355 @section propgrid_event_handling Event Handling
357 To process input from a property grid control, use these event handler macros
358 to direct input to member functions that take a wxPropertyGridEvent argument.
360 @beginEventEmissionTable{wxPropertyGridEvent}
361 @event{EVT_PG_SELECTED (id, func)}
362 Respond to wxEVT_PG_SELECTED event, generated when a property selection
363 has been changed, either by user action or by indirect program
364 function. For instance, collapsing a parent property programmatically
365 causes any selected child property to become unselected, and may
366 therefore cause this event to be generated.
367 @event{EVT_PG_CHANGING(id, func)}
368 Respond to wxEVT_PG_CHANGING event, generated when property value
369 is about to be changed by user. Use wxPropertyGridEvent::GetValue()
370 to take a peek at the pending value, and wxPropertyGridEvent::Veto()
371 to prevent change from taking place, if necessary.
372 @event{EVT_PG_HIGHLIGHTED(id, func)}
373 Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse
374 moves over a property. Event's property is NULL if hovered area does
375 not belong to any property.
376 @event{EVT_PG_RIGHT_CLICK(id, func)}
377 Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is
378 clicked on with right mouse button.
379 @event{EVT_PG_DOUBLE_CLICK(id, func)}
380 Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is
381 double-clicked on with left mouse button.
382 @event{EVT_PG_ITEM_COLLAPSED(id, func)}
383 Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses
384 a property or category.
385 @event{EVT_PG_ITEM_EXPANDED(id, func)}
386 Respond to wxEVT_PG_ITEM_EXPANDED event, generated when user expands
387 a property or category.
388 @event{EVT_PG_LABEL_EDIT_BEGIN(id, func)}
389 Respond to wxEVT_PG_LABEL_EDIT_BEGIN event, generated when is about to
390 begin editing a property label. You can veto this event to prevent the
392 @event{EVT_PG_LABEL_EDIT_ENDING(id, func)}
393 Respond to wxEVT_PG_LABEL_EDIT_ENDING event, generated when is about to
394 end editing of a property label. You can veto this event to prevent the
396 @event{EVT_PG_COL_BEGIN_DRAG(id, func)}
397 Respond to wxEVT_PG_COL_BEGIN_DRAG event, generated when user
398 starts resizing a column - can be vetoed.
399 @event{EVT_PG_COL_DRAGGING,(id, func)}
400 Respond to wxEVT_PG_COL_DRAGGING, event, generated when a
401 column resize by user is in progress. This event is also generated
402 when user double-clicks the splitter in order to recenter
404 @event{EVT_PG_COL_END_DRAG(id, func)}
405 Respond to wxEVT_PG_COL_END_DRAG event, generated after column
406 resize by user has finished.
410 Use Freeze() and Thaw() respectively to disable and enable drawing.
411 This will also delay sorting etc. miscellaneous calculations to the last
416 @appearance{propertygrid.png}
418 class wxPropertyGrid
: public wxScrolledWindow
, public wxPropertyGridInterface
422 Two step constructor.
423 Call Create() when this constructor is called to build up the wxPropertyGrid
429 The styles to be used are styles valid for the wxWindow and wxScrolledWindow.
431 @see @ref propgrid_window_styles.
433 wxPropertyGrid( wxWindow
*parent
, wxWindowID id
= wxID_ANY
,
434 const wxPoint
& pos
= wxDefaultPosition
,
435 const wxSize
& size
= wxDefaultSize
,
436 long style
= wxPG_DEFAULT_STYLE
,
437 const wxChar
* name
= wxPropertyGridNameStr
);
440 virtual ~wxPropertyGrid();
443 Adds given key combination to trigger given action.
446 Which action to trigger. See @ref propgrid_keyboard_actions.
448 Which keycode triggers the action.
450 Which key event modifiers, in addition to keycode, are needed to
453 void AddActionTrigger( int action
, int keycode
, int modifiers
= 0 );
456 Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION
457 extra style is not used, then this has same effect as
458 calling SelectProperty().
460 @remarks Multiple selection is not supported for categories. This
461 means that if you have properties selected, you cannot
462 add category to selection, and also if you have category
463 selected, you cannot add other properties to selection.
464 This member function will fail silently in these cases,
467 bool AddToSelection( wxPGPropArg id
);
470 This static function enables or disables automatic use of
471 wxGetTranslation() for following strings: wxEnumProperty list labels,
472 wxFlagsProperty child property labels.
476 static void AutoGetTranslation( bool enable
);
479 Creates label editor wxTextCtrl for given column, for property
480 that is currently selected. When multiple selection is
481 enabled, this applies to whatever property GetSelection()
485 Which column's label to edit. Note that you should not
486 use value 1, which is reserved for property value
489 @see EndLabelEdit(), MakeColumnEditable()
491 void BeginLabelEdit( unsigned int column
= 0 );
494 Changes value of a property, as if from an editor. Use this instead of
495 SetPropertyValue() if you need the value to run through validation
496 process, and also send the property change event.
498 @return Returns true if value was successfully changed.
500 bool ChangePropertyValue( wxPGPropArg id
, wxVariant newValue
);
503 Centers the splitter. If argument is true, automatic splitter centering
504 is enabled (only applicable if style wxPG_SPLITTER_AUTO_CENTER was
507 void CenterSplitter( bool enable_auto_centering
= false );
510 Deletes all properties.
512 virtual void Clear();
515 Clears action triggers for given action.
518 Which action to trigger. @ref propgrid_keyboard_actions.
520 void ClearActionTriggers( int action
);
523 Forces updating the value of property from the editor control.
524 Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
525 ProcessEvent, meaning your event handlers will be called immediately.
527 @return Returns @true if anything was changed.
529 virtual bool CommitChangesFromEditor( wxUint32 flags
= 0 );
532 Two step creation. Whenever the control is created without any
533 parameters, use Create to actually create it. Don't access the control's
534 public methods before this is called
536 @see @ref propgrid_window_styles.
538 bool Create( wxWindow
*parent
, wxWindowID id
= wxID_ANY
,
539 const wxPoint
& pos
= wxDefaultPosition
,
540 const wxSize
& size
= wxDefaultSize
,
541 long style
= wxPG_DEFAULT_STYLE
,
542 const wxChar
* name
= wxPropertyGridNameStr
);
545 Enables or disables (shows/hides) categories according to parameter
548 @remarks This functions deselects selected property, if any. Validation
549 failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
550 selection is cleared even if editor had invalid value.
552 bool EnableCategories( bool enable
);
555 Destroys label editor wxTextCtrl, if any.
558 Use @true (default) to store edited label text in
561 @see BeginLabelEdit(), MakeColumnEditable()
563 void EndLabelEdit( bool commit
= true );
566 Scrolls and/or expands items to ensure that the given item is visible.
568 @return Returns @true if something was actually done.
570 bool EnsureVisible( wxPGPropArg id
);
573 Reduces column sizes to minimum possible, while still retaining
574 fully visible grid contents (labels, images).
576 @return Minimum size for the grid to still display everything.
578 @remarks Does not work well with wxPG_SPLITTER_AUTO_CENTER window style.
580 This function only works properly if grid size prior to call was
581 already fairly large.
583 Note that you can also get calculated column widths by calling
584 GetState->GetColumnWidth() immediately after this function
590 Returns currently active label editor, NULL if none.
592 wxTextCtrl
* GetLabelEditor() const;
595 Returns wxWindow that the properties are painted on, and which should be
596 used as the parent for editor controls.
598 wxWindow
* GetPanel();
601 Returns current category caption background colour.
603 wxColour
GetCaptionBackgroundColour() const;
606 Returns current category caption font.
608 wxFont
& GetCaptionFont();
611 Returns current category caption text colour.
613 wxColour
GetCaptionForegroundColour() const;
616 Returns current cell background colour.
618 wxColour
GetCellBackgroundColour() const;
621 Returns current cell text colour when disabled.
623 wxColour
GetCellDisabledTextColour() const;
626 Returns current cell text colour.
628 wxColour
GetCellTextColour() const;
631 Returns number of columns currently on grid.
633 unsigned int GetColumnCount() const;
636 Returns colour of empty space below properties.
638 wxColour
GetEmptySpaceColour() const;
641 Returns height of highest characters of used font.
643 int GetFontHeight() const;
646 Returns pointer to itself. Dummy function that enables same kind
647 of code to use wxPropertyGrid and wxPropertyGridManager.
649 wxPropertyGrid
* GetGrid();
652 Returns rectangle of custom paint image.
655 Return image rectangle for this property.
658 Which choice of property to use (each choice may have
661 wxRect
GetImageRect( wxPGProperty
* property
, int item
) const;
664 Returns size of the custom paint image in front of property.
667 Return image rectangle for this property.
668 If this argument is NULL, then preferred size is returned.
671 Which choice of property to use (each choice may have
674 wxSize
GetImageSize( wxPGProperty
* property
= NULL
, int item
= -1 ) const;
677 Returns last item which could be iterated using given flags.
680 See @ref propgrid_iterator_flags.
682 wxPGProperty
* GetLastItem( int flags
= wxPG_ITERATE_DEFAULT
);
685 Returns colour of lines between cells.
687 wxColour
GetLineColour() const;
690 Returns background colour of margin.
692 wxColour
GetMarginColour() const;
695 Returns "root property". It does not have name, etc. and it is not
696 visible. It is only useful for accessing its children.
698 wxPGProperty
* GetRoot() const;
701 Returns height of a single grid row (in pixels).
703 int GetRowHeight() const;
706 Returns currently selected property.
708 wxPGProperty
* GetSelectedProperty() const;
711 Returns currently selected property.
713 wxPGProperty
* GetSelection() const;
716 Returns current selection background colour.
718 wxColour
GetSelectionBackgroundColour() const;
721 Returns current selection text colour.
723 wxColour
GetSelectionForegroundColour() const;
726 Returns the property sort function (default is @NULL).
730 wxPGSortCallback
GetSortFunction() const;
733 Returns current splitter x position.
735 int GetSplitterPosition() const;
738 Returns wxTextCtrl active in currently selected property, if any. Takes
739 wxOwnerDrawnComboBox into account.
741 wxTextCtrl
* GetEditorTextCtrl() const;
744 Returns current vertical spacing.
746 int GetVerticalSpacing() const;
749 Returns information about arbitrary position in the grid.
752 Coordinates in the virtual grid space. You may need to use
753 wxScrolledWindow::CalcScrolledPosition() for translating
754 wxPropertyGrid client coordinates into something this member
757 wxPropertyGridHitTestResult
HitTest( const wxPoint
& pt
) const;
760 Returns true if any property has been modified by the user.
762 bool IsAnyModified() const;
765 Returns @true if a property editor control has focus.
767 bool IsEditorFocused() const;
770 Returns true if updating is frozen (ie. Freeze() called but not
773 bool IsFrozen() const;
776 Makes given column editable by user.
779 Using @false here will disable column from being editable.
781 @see BeginLabelEdit(), EndLabelEdit()
783 void MakeColumnEditable( unsigned int column
, bool editable
= true );
786 It is recommended that you call this function any time your code causes
787 wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle()
788 handler should be able to detect most changes, but it is not perfect.
791 New top-level parent that is about to be set. Old top-level parent
792 window should still exist as the current one.
794 @remarks This function is automatically called from wxPropertyGrid::
795 Reparent() and wxPropertyGridManager::Reparent(). You only
796 need to use it if you reparent wxPropertyGrid indirectly.
798 void OnTLPChanging( wxWindow
* newTLP
);
801 Refreshes any active editor control.
803 void RefreshEditor();
806 Redraws given property.
808 virtual void RefreshProperty( wxPGProperty
* p
);
811 Registers a new editor class.
813 @return Returns pointer to the editor class instance that should be used.
815 static wxPGEditor
* RegisterEditorClass( wxPGEditor
* editor
,
816 const wxString
& name
,
817 bool noDefCheck
= false );
820 Resets all colours to the original system values.
825 Removes given property from selection. If property is not selected,
826 an assertion failure will occur.
828 bool RemoveFromSelection( wxPGPropArg id
);
831 Selects a property. Editor widget is automatically created, but
832 not focused unless focus is true.
835 Property to select (name or pointer).
838 If @true, move keyboard focus to the created editor right away.
840 @return returns @true if selection finished successfully. Usually only
841 fails if current value in editor is not valid.
843 @remarks In wxPropertyGrid 1.4, this member function used to generate
844 wxEVT_PG_SELECTED. In wxWidgets 2.9 and later, it no longer
847 @remarks This clears any previous selection.
849 @see wxPropertyGridInterface::ClearSelection()
851 bool SelectProperty( wxPGPropArg id
, bool focus
= false );
854 Changes keyboard shortcut to push the editor button.
856 @remarks You can set default with keycode 0. Good value for the platform
857 is guessed, but don't expect it to be very accurate.
859 void SetButtonShortcut( int keycode
, bool ctrlDown
= false, bool altDown
= false );
862 Sets category caption background colour.
864 void SetCaptionBackgroundColour(const wxColour
& col
);
867 Sets category caption text colour.
869 void SetCaptionTextColour(const wxColour
& col
);
872 Sets default cell background colour - applies to property cells.
873 Note that appearance of editor widgets may not be affected.
875 void SetCellBackgroundColour(const wxColour
& col
);
878 Sets cell text colour for disabled properties.
880 void SetCellDisabledTextColour(const wxColour
& col
);
883 Sets default cell text colour - applies to property name and value text.
884 Note that appearance of editor widgets may not be affected.
886 void SetCellTextColour(const wxColour
& col
);
889 Set number of columns (2 or more).
891 void SetColumnCount( int colCount
);
894 Sets the 'current' category - Append will add non-category properties
897 void SetCurrentCategory( wxPGPropArg id
);
900 Sets colour of empty space below properties.
902 void SetEmptySpaceColour(const wxColour
& col
);
905 Sets colour of lines between cells.
907 void SetLineColour(const wxColour
& col
);
910 Sets background colour of margin.
912 void SetMarginColour(const wxColour
& col
);
915 Set entire new selection from given list of properties.
917 void SetSelection( const wxArrayPGProperty
& newSelection
);
920 Sets selection background colour - applies to selected property name
923 void SetSelectionBackgroundColour(const wxColour
& col
);
926 Sets selection foreground colour - applies to selected property name text.
928 void SetSelectionTextColour(const wxColour
& col
);
932 Sets the property sorting function.
935 The sorting function to be used. It should return a value greater
936 than 0 if position of p1 is after p2. So, for instance, when
937 comparing property names, you can use following implementation:
940 int MyPropertySortFunction(wxPropertyGrid* propGrid,
944 return p1->GetBaseName().compare( p2->GetBaseName() );
949 Default property sort function sorts properties by their labels
950 (case-insensitively).
952 @see GetSortFunction, wxPropertyGridInterface::Sort,
953 wxPropertyGridInterface::SortChildren
955 void SetSortFunction( wxPGSortCallback sortFunction
);
958 Sets x coordinate of the splitter.
960 @remarks Splitter position cannot exceed grid size, and therefore setting
961 it during form creation may fail as initial grid size is often
962 smaller than desired splitter position, especially when sizers
965 void SetSplitterPosition( int newxpos
, int col
= 0 );
968 Moves splitter as left as possible, while still allowing all
969 labels to be shown in full.
971 @param privateChildrenToo
972 If @false, will still allow private children to be cropped.
974 void SetSplitterLeft( bool privateChildrenToo
= false );
977 Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font
978 height. Value of 2 should be default on most platforms.
980 void SetVerticalSpacing( int vspacing
);
984 @name Property development functions
986 These member functions are usually only called when creating custom
992 Call when editor widget's contents is modified. For example, this is
993 called when changes text in wxTextCtrl (used in wxStringProperty and
996 @remarks This function should only be called by custom properties.
998 @see wxPGProperty::OnEvent()
1000 void EditorsValueWasModified();
1003 Reverse of EditorsValueWasModified().
1005 @remarks This function should only be called by custom properties.
1007 void EditorsValueWasNotModified();
1010 Returns most up-to-date value of selected property. This will return
1011 value different from GetSelectedProperty()->GetValue() only when text
1012 editor is activate and string edited by user represents valid,
1013 uncommitted property value.
1015 wxVariant
GetUncommittedPropertyValue();
1018 Returns true if editor's value was marked modified.
1020 bool IsEditorsValueModified() const;
1023 Shows an brief error message that is related to a property.
1025 void ShowPropertyError( wxPGPropArg id
, const wxString
& msg
);
1028 You can use this member function, for instance, to detect in
1029 wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was
1030 already called in wxPGEditor::OnEvent(). It really only detects
1031 if was value was changed using wxPGProperty::SetValueInEvent(), which
1032 is usually used when a 'picker' dialog is displayed. If value was
1033 written by "normal means" in wxPGProperty::StringToValue() or
1034 IntToValue(), then this function will return false (on the other hand,
1035 wxPGProperty::OnEvent() is not even called in those cases).
1037 bool WasValueChangedInEvent() const;
1044 @class wxPropertyGridEvent
1046 A property grid event holds information about events associated with
1047 wxPropertyGrid objects.
1049 @library{wxpropgrid}
1052 class wxPropertyGridEvent
: public wxCommandEvent
1057 wxPropertyGridEvent(wxEventType commandType
=0, int id
=0);
1059 /** Copy constructor. */
1060 wxPropertyGridEvent(const wxPropertyGridEvent
& event
);
1063 ~wxPropertyGridEvent();
1066 Returns true if you can veto the action that the event is signaling.
1068 bool CanVeto() const;
1071 Returns the column index associated with this event.
1072 For the column dragging events, it is the column to the left
1073 of the splitter being dragged
1075 unsigned int GetColumn() const;
1078 Returns highest level non-category, non-root parent of property for
1079 which event occurred. Useful when you have nested properties with
1082 @remarks If immediate parent is root or category, this will return the
1085 wxPGProperty
* GetMainParent() const;
1088 Returns property associated with this event.
1090 wxPGProperty
* GetProperty() const;
1093 Returns current validation failure flags.
1095 wxPGVFBFlags
GetValidationFailureBehavior() const;
1098 Returns name of the associated property.
1100 @remarks Property name is stored in event, so it remains
1101 accessible even after the associated property or
1102 the property grid has been deleted.
1104 wxString
GetPropertyName() const;
1107 Returns value of the associated property. Works for all event
1108 types, but for wxEVT_PG_CHANGING this member function returns
1109 the value that is pending, so you can call Veto() if the
1110 value is not satisfactory.
1112 @remarks Property value is stored in event, so it remains
1113 accessible even after the associated property or
1114 the property grid has been deleted.
1116 wxVariant
GetPropertyValue() const
1119 @see GetPropertyValue()
1121 wxVariant
GetValue() const;
1124 Set if event can be vetoed.
1126 void SetCanVeto( bool canVeto
);
1128 /** Changes the property associated with this event. */
1129 void SetProperty( wxPGProperty
* p
);
1132 Set override validation failure behavior. Only effective if Veto() was
1133 also called, and only allowed if event type is wxEVT_PG_CHANGING.
1135 void SetValidationFailureBehavior( wxPGVFBFlags flags
);
1138 Sets custom failure message for this time only. Only applies if
1139 wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
1141 void SetValidationFailureMessage( const wxString
& message
);
1144 Call this from your event handler to veto action that the event is
1145 signaling. You can only veto a shutdown if wxPropertyGridEvent::CanVeto()
1148 @remarks Currently only wxEVT_PG_CHANGING supports vetoing.
1150 void Veto( bool veto
= true );
1153 Returns @true if event was vetoed.
1155 bool WasVetoed() const;