#include <wx/propgrid/propgrid.h>
List of ready-to-use property classes include strings, numbers, flag sets, fonts, colours and many others. It is possible, for example, to categorize properties, set up a complete tree-hierarchy, add more than two columns, and set arbitrary per-property attributes.
Please note that most member functions are inherited and as such not documented on this page. This means you will probably also want to read wxPropertyGridInterface class reference.
See also wxPropertyGrid Overview.
The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
![]() | ![]() | ![]() |
wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
wxPropertyGrid () | |
Two step constructor. | |
wxPropertyGrid (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxPG_DEFAULT_STYLE, const wxChar *name=wxPropertyGridNameStr) | |
Constructor. | |
virtual | ~wxPropertyGrid () |
Destructor. | |
void | AddActionTrigger (int action, int keycode, int modifiers=0) |
Adds given key combination to trigger given action. | |
bool | ChangePropertyValue (wxPGPropArg id, wxVariant newValue) |
Changes value of a property, as if from an editor. | |
void | CenterSplitter (bool enable_auto_centering=false) |
Centers the splitter. | |
virtual void | Clear () |
Deletes all properties. | |
void | ClearActionTriggers (int action) |
Clears action triggers for given action. | |
virtual bool | CommitChangesFromEditor (wxUint32 flags=0) |
Forces updating the value of property from the editor control. | |
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxPG_DEFAULT_STYLE, const wxChar *name=wxPropertyGridNameStr) |
Two step creation. | |
void | EditorsValueWasModified () |
Call when editor widget's contents is modified. | |
void | EditorsValueWasNotModified () |
Reverse of EditorsValueWasModified(). | |
bool | EnableCategories (bool enable) |
Enables or disables (shows/hides) categories according to parameter enable. | |
bool | EnsureVisible (wxPGPropArg id) |
Scrolls and/or expands items to ensure that the given item is visible. | |
wxSize | FitColumns () |
Reduces column sizes to minimum possible, while still retaining fully visible grid contents (labels, images). | |
wxPanel * | GetPanel () const |
Returns wxWindow that the properties are painted on, and which should be used as the parent for editor controls. | |
wxColour | GetCaptionBackgroundColour () const |
Returns current category caption background colour. | |
wxFont & | GetCaptionFont () |
Returns current category caption font. | |
wxColour | GetCaptionForegroundColour () const |
Returns current category caption text colour. | |
wxColour | GetCellBackgroundColour () const |
Returns current cell background colour. | |
wxColour | GetCellDisabledTextColour () const |
Returns current cell text colour when disabled. | |
wxColour | GetCellTextColour () const |
Returns current cell text colour. | |
unsigned int | GetColumnCount () const |
Returns number of columns currently on grid. | |
wxColour | GetEmptySpaceColour () const |
Returns colour of empty space below properties. | |
int | GetFontHeight () const |
Returns height of highest characters of used font. | |
wxPropertyGrid * | GetGrid () |
Returns pointer to itself. | |
wxRect | GetImageRect (wxPGProperty *property, int item) const |
Returns rectangle of custom paint image. | |
wxSize | GetImageSize (wxPGProperty *property=NULL, int item=-1) const |
Returns size of the custom paint image in front of property. | |
wxPGProperty * | GetLastItem (int flags=wxPG_ITERATE_DEFAULT) |
Returns last item which could be iterated using given flags. | |
wxColour | GetLineColour () const |
Returns colour of lines between cells. | |
wxColour | GetMarginColour () const |
Returns background colour of margin. | |
wxVariant | GetUncommittedPropertyValue () |
Returns most up-to-date value of selected property. | |
wxPGProperty * | GetRoot () const |
Returns "root property". | |
int | GetRowHeight () const |
Returns height of a single grid row (in pixels). | |
wxPGProperty * | GetSelectedProperty () const |
Returns currently selected property. | |
wxPGProperty * | GetSelection () const |
Returns currently selected property. | |
wxColour | GetSelectionBackgroundColour () const |
Returns current selection background colour. | |
wxColour | GetSelectionForegroundColour () const |
Returns current selection text colour. | |
wxPGSortCallback | GetSortFunction () const |
Returns the property sort function (default is NULL). | |
int | GetSplitterPosition () const |
Returns current splitter x position. | |
wxTextCtrl * | GetEditorTextCtrl () const |
Returns wxTextCtrl active in currently selected property, if any. | |
int | GetVerticalSpacing () const |
Returns current vertical spacing. | |
bool | IsEditorsValueModified () const |
Returns true if editor's value was marked modified. | |
wxPropertyGridHitTestResult | HitTest (const wxPoint &pt) const |
Returns information about arbitrary position in the grid. | |
bool | IsAnyModified () const |
Returns true if any property has been modified by the user. | |
bool | IsEditorFocused () const |
Returns true if a property editor control has focus. | |
bool | IsFrozen () const |
Returns true if updating is frozen (ie. | |
void | RefreshEditor () |
Refreshes any active editor control. | |
virtual void | RefreshProperty (wxPGProperty *p) |
Redraws given property. | |
void | ResetColours () |
Resets all colours to the original system values. | |
bool | SelectProperty (wxPGPropArg id, bool focus=false) |
Selects a property. | |
void | SetButtonShortcut (int keycode, bool ctrlDown=false, bool altDown=false) |
Changes keyboard shortcut to push the editor button. | |
void | SetCaptionBackgroundColour (const wxColour &col) |
Sets category caption background colour. | |
void | SetCaptionTextColour (const wxColour &col) |
Sets category caption text colour. | |
void | SetCellBackgroundColour (const wxColour &col) |
Sets default cell background colour - applies to property cells. | |
void | SetCellDisabledTextColour (const wxColour &col) |
Sets cell text colour for disabled properties. | |
void | SetCellTextColour (const wxColour &col) |
Sets default cell text colour - applies to property name and value text. | |
void | SetColumnCount (int colCount) |
Set number of columns (2 or more). | |
void | SetCurrentCategory (wxPGPropArg id) |
Sets the 'current' category - Append will add non-category properties under it. | |
void | SetEmptySpaceColour (const wxColour &col) |
Sets colour of empty space below properties. | |
void | SetLineColour (const wxColour &col) |
Sets colour of lines between cells. | |
void | SetMarginColour (const wxColour &col) |
Sets background colour of margin. | |
void | SetSelectionBackgroundColour (const wxColour &col) |
Sets selection background colour - applies to selected property name background. | |
void | SetSelectionTextColour (const wxColour &col) |
Sets selection foreground colour - applies to selected property name text. | |
void | SetSortFunction (wxPGSortCallback sortFunction) |
Sets the property sorting function. | |
void | SetSplitterPosition (int newxpos, int col=0) |
Sets x coordinate of the splitter. | |
void | SetSplitterLeft (bool privateChildrenToo=false) |
Moves splitter as left as possible, while still allowing all labels to be shown in full. | |
void | SetVerticalSpacing (int vspacing) |
Sets vertical spacing. | |
void | ShowPropertyError (wxPGPropArg id, const wxString &msg) |
Shows an brief error message that is related to a property. | |
Static Public Member Functions | |
static void | AutoGetTranslation (bool enable) |
This static function enables or disables automatic use of wxGetTranslation() for following strings: wxEnumProperty list labels, wxFlagsProperty child property labels. | |
static wxPGEditor * | RegisterEditorClass (wxPGEditor *editor, const wxString &name, bool noDefCheck=false) |
Registers a new editor class. |
wxPropertyGrid::wxPropertyGrid | ( | ) |
Two step constructor.
Call Create() when this constructor is called to build up the wxPropertyGrid
wxPropertyGrid::wxPropertyGrid | ( | wxWindow * | parent, | |
wxWindowID | id = wxID_ANY , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxPG_DEFAULT_STYLE , |
|||
const wxChar * | name = wxPropertyGridNameStr | |||
) |
Constructor.
The styles to be used are styles valid for the wxWindow and wxScrolledWindow.
virtual wxPropertyGrid::~wxPropertyGrid | ( | ) | [virtual] |
Destructor.
void wxPropertyGrid::AddActionTrigger | ( | int | action, | |
int | keycode, | |||
int | modifiers = 0 | |||
) |
Adds given key combination to trigger given action.
action | Which action to trigger. See wxPropertyGrid Action Identifiers. | |
keycode | Which keycode triggers the action. | |
modifiers | Which key event modifiers, in addition to keycode, are needed to trigger the action. |
static void wxPropertyGrid::AutoGetTranslation | ( | bool | enable | ) | [static] |
This static function enables or disables automatic use of wxGetTranslation() for following strings: wxEnumProperty list labels, wxFlagsProperty child property labels.
Default is false.
void wxPropertyGrid::CenterSplitter | ( | bool | enable_auto_centering = false |
) |
Centers the splitter.
If argument is true, automatic splitter centering is enabled (only applicable if style wxPG_SPLITTER_AUTO_CENTER was defined).
bool wxPropertyGrid::ChangePropertyValue | ( | wxPGPropArg | id, | |
wxVariant | newValue | |||
) |
Changes value of a property, as if from an editor.
Use this instead of SetPropertyValue() if you need the value to run through validation process, and also send the property change event.
Reimplemented from wxPropertyGridInterface.
virtual void wxPropertyGrid::Clear | ( | ) | [virtual] |
void wxPropertyGrid::ClearActionTriggers | ( | int | action | ) |
Clears action triggers for given action.
action | Which action to trigger. wxPropertyGrid Action Identifiers. |
virtual bool wxPropertyGrid::CommitChangesFromEditor | ( | wxUint32 | flags = 0 |
) | [virtual] |
Forces updating the value of property from the editor control.
Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using ProcessEvent, meaning your event handlers will be called immediately.
bool wxPropertyGrid::Create | ( | wxWindow * | parent, | |
wxWindowID | id = wxID_ANY , |
|||
const wxPoint & | pos = wxDefaultPosition , |
|||
const wxSize & | size = wxDefaultSize , |
|||
long | style = wxPG_DEFAULT_STYLE , |
|||
const wxChar * | name = wxPropertyGridNameStr | |||
) |
Two step creation.
Whenever the control is created without any parameters, use Create to actually create it. Don't access the control's public methods before this is called
void wxPropertyGrid::EditorsValueWasModified | ( | ) |
Call when editor widget's contents is modified.
For example, this is called when changes text in wxTextCtrl (used in wxStringProperty and wxIntProperty).
void wxPropertyGrid::EditorsValueWasNotModified | ( | ) |
Reverse of EditorsValueWasModified().
bool wxPropertyGrid::EnableCategories | ( | bool | enable | ) |
Enables or disables (shows/hides) categories according to parameter enable.
bool wxPropertyGrid::EnsureVisible | ( | wxPGPropArg | id | ) |
Scrolls and/or expands items to ensure that the given item is visible.
wxSize wxPropertyGrid::FitColumns | ( | ) |
Reduces column sizes to minimum possible, while still retaining fully visible grid contents (labels, images).
Note that you can also get calculated column widths by calling GetState->GetColumnWidth() immediately after this function returns.
wxColour wxPropertyGrid::GetCaptionBackgroundColour | ( | ) | const |
Returns current category caption background colour.
wxFont& wxPropertyGrid::GetCaptionFont | ( | ) |
Returns current category caption font.
wxColour wxPropertyGrid::GetCaptionForegroundColour | ( | ) | const |
Returns current category caption text colour.
wxColour wxPropertyGrid::GetCellBackgroundColour | ( | ) | const |
Returns current cell background colour.
wxColour wxPropertyGrid::GetCellDisabledTextColour | ( | ) | const |
Returns current cell text colour when disabled.
wxColour wxPropertyGrid::GetCellTextColour | ( | ) | const |
Returns current cell text colour.
unsigned int wxPropertyGrid::GetColumnCount | ( | ) | const |
Returns number of columns currently on grid.
wxTextCtrl* wxPropertyGrid::GetEditorTextCtrl | ( | ) | const |
Returns wxTextCtrl active in currently selected property, if any.
Takes wxOwnerDrawnComboBox into account.
wxColour wxPropertyGrid::GetEmptySpaceColour | ( | ) | const |
Returns colour of empty space below properties.
int wxPropertyGrid::GetFontHeight | ( | ) | const |
Returns height of highest characters of used font.
wxPropertyGrid* wxPropertyGrid::GetGrid | ( | ) |
Returns pointer to itself.
Dummy function that enables same kind of code to use wxPropertyGrid and wxPropertyGridManager.
wxRect wxPropertyGrid::GetImageRect | ( | wxPGProperty * | property, | |
int | item | |||
) | const |
Returns rectangle of custom paint image.
property | Return image rectangle for this property. | |
item | Which choice of property to use (each choice may have different image). |
wxSize wxPropertyGrid::GetImageSize | ( | wxPGProperty * | property = NULL , |
|
int | item = -1 | |||
) | const |
Returns size of the custom paint image in front of property.
property | Return image rectangle for this property. If this argument is NULL, then preferred size is returned. | |
item | Which choice of property to use (each choice may have different image). |
wxPGProperty* wxPropertyGrid::GetLastItem | ( | int | flags = wxPG_ITERATE_DEFAULT |
) |
Returns last item which could be iterated using given flags.
flags | See wxPropertyGridIterator Flags. |
wxColour wxPropertyGrid::GetLineColour | ( | ) | const |
Returns colour of lines between cells.
wxColour wxPropertyGrid::GetMarginColour | ( | ) | const |
Returns background colour of margin.
wxPanel* wxPropertyGrid::GetPanel | ( | ) | const |
Returns wxWindow that the properties are painted on, and which should be used as the parent for editor controls.
wxPGProperty* wxPropertyGrid::GetRoot | ( | ) | const |
Returns "root property".
It does not have name, etc. and it is not visible. It is only useful for accessing its children.
int wxPropertyGrid::GetRowHeight | ( | ) | const |
Returns height of a single grid row (in pixels).
wxPGProperty* wxPropertyGrid::GetSelectedProperty | ( | ) | const |
Returns currently selected property.
wxPGProperty* wxPropertyGrid::GetSelection | ( | ) | const |
wxColour wxPropertyGrid::GetSelectionBackgroundColour | ( | ) | const |
Returns current selection background colour.
wxColour wxPropertyGrid::GetSelectionForegroundColour | ( | ) | const |
Returns current selection text colour.
wxPGSortCallback wxPropertyGrid::GetSortFunction | ( | ) | const |
int wxPropertyGrid::GetSplitterPosition | ( | ) | const |
Returns current splitter x position.
wxVariant wxPropertyGrid::GetUncommittedPropertyValue | ( | ) |
Returns most up-to-date value of selected property.
This will return value different from GetSelectedProperty()->GetValue() only when text editor is activate and string edited by user represents valid, uncommitted property value.
int wxPropertyGrid::GetVerticalSpacing | ( | ) | const |
Returns current vertical spacing.
wxPropertyGridHitTestResult wxPropertyGrid::HitTest | ( | const wxPoint & | pt | ) | const |
Returns information about arbitrary position in the grid.
pt | Coordinates in the virtual grid space. You may need to use wxScrolledWindow::CalcScrolledPosition() for translating wxPropertyGrid client coordinates into something this member function can use. |
bool wxPropertyGrid::IsAnyModified | ( | ) | const |
Returns true if any property has been modified by the user.
bool wxPropertyGrid::IsEditorFocused | ( | ) | const |
Returns true if a property editor control has focus.
bool wxPropertyGrid::IsEditorsValueModified | ( | ) | const |
Returns true if editor's value was marked modified.
bool wxPropertyGrid::IsFrozen | ( | ) | const |
void wxPropertyGrid::RefreshEditor | ( | ) |
Refreshes any active editor control.
virtual void wxPropertyGrid::RefreshProperty | ( | wxPGProperty * | p | ) | [virtual] |
Redraws given property.
static wxPGEditor* wxPropertyGrid::RegisterEditorClass | ( | wxPGEditor * | editor, | |
const wxString & | name, | |||
bool | noDefCheck = false | |||
) | [static] |
Registers a new editor class.
void wxPropertyGrid::ResetColours | ( | ) |
Resets all colours to the original system values.
bool wxPropertyGrid::SelectProperty | ( | wxPGPropArg | id, | |
bool | focus = false | |||
) |
Selects a property.
Editor widget is automatically created, but not focused unless focus is true. This will generate wxEVT_PG_SELECT event.
id | Property to select (name or pointer). | |
focus | If true, move keyboard focus to the created editor right away. |
void wxPropertyGrid::SetButtonShortcut | ( | int | keycode, | |
bool | ctrlDown = false , |
|||
bool | altDown = false | |||
) |
Changes keyboard shortcut to push the editor button.
void wxPropertyGrid::SetCaptionBackgroundColour | ( | const wxColour & | col | ) |
Sets category caption background colour.
void wxPropertyGrid::SetCaptionTextColour | ( | const wxColour & | col | ) |
Sets category caption text colour.
void wxPropertyGrid::SetCellBackgroundColour | ( | const wxColour & | col | ) |
Sets default cell background colour - applies to property cells.
Note that appearance of editor widgets may not be affected.
void wxPropertyGrid::SetCellDisabledTextColour | ( | const wxColour & | col | ) |
Sets cell text colour for disabled properties.
void wxPropertyGrid::SetCellTextColour | ( | const wxColour & | col | ) |
Sets default cell text colour - applies to property name and value text.
Note that appearance of editor widgets may not be affected.
void wxPropertyGrid::SetColumnCount | ( | int | colCount | ) |
Set number of columns (2 or more).
void wxPropertyGrid::SetCurrentCategory | ( | wxPGPropArg | id | ) |
Sets the 'current' category - Append will add non-category properties under it.
void wxPropertyGrid::SetEmptySpaceColour | ( | const wxColour & | col | ) |
Sets colour of empty space below properties.
void wxPropertyGrid::SetLineColour | ( | const wxColour & | col | ) |
Sets colour of lines between cells.
void wxPropertyGrid::SetMarginColour | ( | const wxColour & | col | ) |
Sets background colour of margin.
void wxPropertyGrid::SetSelectionBackgroundColour | ( | const wxColour & | col | ) |
Sets selection background colour - applies to selected property name background.
void wxPropertyGrid::SetSelectionTextColour | ( | const wxColour & | col | ) |
Sets selection foreground colour - applies to selected property name text.
void wxPropertyGrid::SetSortFunction | ( | wxPGSortCallback | sortFunction | ) |
Sets the property sorting function.
sortFunction | The sorting function to be used. It should return a value greater than 0 if position of p1 is after p2. So, for instance, when comparing property names, you can use following implementation: |
int MyPropertySortFunction(wxPropertyGrid* propGrid, wxPGProperty* p1, wxPGProperty* p2) { return p1->GetBaseName().compare( p2->GetBaseName() ); }
void wxPropertyGrid::SetSplitterLeft | ( | bool | privateChildrenToo = false |
) |
Moves splitter as left as possible, while still allowing all labels to be shown in full.
privateChildrenToo | If false, will still allow private children to be cropped. |
void wxPropertyGrid::SetSplitterPosition | ( | int | newxpos, | |
int | col = 0 | |||
) |
Sets x coordinate of the splitter.
void wxPropertyGrid::SetVerticalSpacing | ( | int | vspacing | ) |
Sets vertical spacing.
Can be 1, 2, or 3 - a value relative to font height. Value of 2 should be default on most platforms.
void wxPropertyGrid::ShowPropertyError | ( | wxPGPropArg | id, | |
const wxString & | msg | |||
) |
Shows an brief error message that is related to a property.
![]() |
[ top ] |