wxPropertyGrid
Public Member Functions | List of all members
wxPGEditor Class Referenceabstract

Base for property editor classes. More...

#include <editors.h>

Inheritance diagram for wxPGEditor:
wxPGCheckBoxEditor wxPGChoiceEditor wxPGTextCtrlEditor wxPGChoiceAndButtonEditor wxPGComboBoxEditor wxPGTextCtrlAndButtonEditor

Public Member Functions

bool ActualGetValueFromControl (wxVariant &variant, wxPGProperty *property, wxWindow *ctrl) const
 
virtual bool CanContainCustomImage () const
 Returns true if control itself can contain the custom image. More...
 
virtual wxPGWindowList CreateControls (wxPropertyGrid *propgrid, wxPGProperty *property, const wxPoint &pos, const wxSize &size) const =0
 Instantiates editor controls. More...
 
virtual void DeleteItem (wxWindow *ctrl, int index) const
 Deletes item from existing control. More...
 
virtual void DrawValue (wxDC &dc, const wxRect &rect, wxPGProperty *property, const wxString &text) const
 Used to get the renderer to draw the value with when the control is hidden. More...
 
virtual wxPG_CONST_WXCHAR_PTR GetName () const =0
 Returns pointer to the name of the editor. More...
 
virtual bool GetValueFromControl (wxVariant &variant, wxPGProperty *property, wxWindow *ctrl) const WX_PG_NOT_PURE_IN_WXPYTHON
 Returns value from control, via parameter 'variant'. More...
 
virtual int InsertItem (wxWindow *ctrl, const wxString &label, int index) const
 Inserts item to existing control. More...
 
virtual bool OnEvent (wxPropertyGrid *propgrid, wxPGProperty *property, wxWindow *wnd_primary, wxEvent &event) const =0
 Handles events. More...
 
virtual void OnFocus (wxPGProperty *property, wxWindow *wnd) const
 Extra processing when control gains focus. More...
 
virtual void SetControlIntValue (wxPGProperty *property, wxWindow *ctrl, int value) const
 Sets control's value specifically from int (applies to choice etc.). More...
 
virtual void SetControlStringValue (wxPGProperty *property, wxWindow *ctrl, const wxString &txt) const
 Sets control's value specifically from string. More...
 
virtual void SetValueToUnspecified (wxPGProperty *property, wxWindow *ctrl) const =0
 Sets value in control to unspecified. More...
 
virtual void UpdateControl (wxPGProperty *property, wxWindow *ctrl) const =0
 Loads value from property to the control. More...
 
 wxPGEditor ()
 Constructor. More...
 
virtual ~wxPGEditor ()
 Destructor. More...
 

Detailed Description

Base for property editor classes.

Remarks
  • Event handling: wxPGEditor::CreateControls should Connect all necessary events to the wxPropertyGrid::OnCustomEditorEvent. For Example:
    // Relays wxEVT_COMMAND_TEXT_UPDATED events of primary editor
    // control to the OnEvent.
    // NOTE: This event in particular is actually automatically conveyed, but
    // it is just used as an example.
    propgrid->Connect( wxPG_SUBID1, wxEVT_COMMAND_TEXT_UPDATED,
    (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
    OnCustomEditorEvent will then forward events, first to wxPGEditor::OnEvent and then to wxPGProperty::OnEvent.
  • You need to call macro wxPGRegisterEditorClass(EditorName) before using a custom editor class.
  • See propgrid.cpp for how builtin editors works (starting from wxPGTextCtrlEditor).

Constructor & Destructor Documentation

◆ wxPGEditor()

wxPGEditor::wxPGEditor ( )

Constructor.

◆ ~wxPGEditor()

virtual wxPGEditor::~wxPGEditor ( )
virtual

Destructor.

Member Function Documentation

◆ CanContainCustomImage()

virtual bool wxPGEditor::CanContainCustomImage ( ) const
virtual

Returns true if control itself can contain the custom image.

Default is to return false.

Reimplemented in wxPGChoiceEditor.

◆ CreateControls()

virtual wxPGWindowList wxPGEditor::CreateControls ( wxPropertyGrid propgrid,
wxPGProperty property,
const wxPoint &  pos,
const wxSize &  size 
) const
pure virtual

Instantiates editor controls.

Remarks
  • Primary control shall use id wxPG_SUBID1, and secondary (button) control shall use wxPG_SUBID2.
Parameters
propgridwxPropertyGrid to which the property belongs (use as parent for control).
propertyProperty for which this method is called.
posPosition, inside wxPropertyGrid, to create control(s) to.
sizeInitial size for control(s).

Implemented in wxPGCheckBoxEditor, wxPGTextCtrlAndButtonEditor, wxPGChoiceAndButtonEditor, wxPGComboBoxEditor, wxPGChoiceEditor, and wxPGTextCtrlEditor.

◆ DeleteItem()

virtual void wxPGEditor::DeleteItem ( wxWindow *  ctrl,
int  index 
) const
virtual

Deletes item from existing control.

Default implementation does nothing.

Reimplemented in wxPGChoiceEditor.

◆ DrawValue()

virtual void wxPGEditor::DrawValue ( wxDC &  dc,
const wxRect &  rect,
wxPGProperty property,
const wxString &  text 
) const
virtual

Used to get the renderer to draw the value with when the control is hidden.

Default implementation returns g_wxPGDefaultRenderer.Draws value for given property.

Reimplemented in wxPGCheckBoxEditor.

◆ GetName()

virtual wxPG_CONST_WXCHAR_PTR wxPGEditor::GetName ( ) const
pure virtual

Returns pointer to the name of the editor.

For example, wxPG_EDITOR(TextCtrl) has name "TextCtrl". This method is autogenerated for custom editors.

◆ GetValueFromControl()

virtual bool wxPGEditor::GetValueFromControl ( wxVariant &  variant,
wxPGProperty property,
wxWindow *  ctrl 
) const
virtual

Returns value from control, via parameter 'variant'.

Usually ends up calling property's StringToValue or IntToValue. Returns true if value was different.

Reimplemented in wxPGCheckBoxEditor, wxPGComboBoxEditor, wxPGChoiceEditor, and wxPGTextCtrlEditor.

◆ InsertItem()

virtual int wxPGEditor::InsertItem ( wxWindow *  ctrl,
const wxString &  label,
int  index 
) const
virtual

Inserts item to existing control.

Index -1 means appending. Default implementation does nothing. Returns index of item added.

Reimplemented in wxPGChoiceEditor.

◆ OnEvent()

virtual bool wxPGEditor::OnEvent ( wxPropertyGrid propgrid,
wxPGProperty property,
wxWindow *  wnd_primary,
wxEvent &  event 
) const
pure virtual

Handles events.

Returns true if value in control was modified (see wxPGProperty::OnEvent for more information).

Implemented in wxPGCheckBoxEditor, wxPGComboBoxEditor, wxPGChoiceEditor, and wxPGTextCtrlEditor.

◆ OnFocus()

virtual void wxPGEditor::OnFocus ( wxPGProperty property,
wxWindow *  wnd 
) const
virtual

Extra processing when control gains focus.

For example, wxTextCtrl based controls should select all text.

Reimplemented in wxPGComboBoxEditor, and wxPGTextCtrlEditor.

◆ SetControlIntValue()

virtual void wxPGEditor::SetControlIntValue ( wxPGProperty property,
wxWindow *  ctrl,
int  value 
) const
virtual

Sets control's value specifically from int (applies to choice etc.).

Reimplemented in wxPGCheckBoxEditor, and wxPGChoiceEditor.

◆ SetControlStringValue()

virtual void wxPGEditor::SetControlStringValue ( wxPGProperty property,
wxWindow *  ctrl,
const wxString &  txt 
) const
virtual

Sets control's value specifically from string.

Reimplemented in wxPGChoiceEditor, and wxPGTextCtrlEditor.

◆ SetValueToUnspecified()

virtual void wxPGEditor::SetValueToUnspecified ( wxPGProperty property,
wxWindow *  ctrl 
) const
pure virtual

Sets value in control to unspecified.

Implemented in wxPGCheckBoxEditor, wxPGChoiceEditor, and wxPGTextCtrlEditor.

◆ UpdateControl()

virtual void wxPGEditor::UpdateControl ( wxPGProperty property,
wxWindow *  ctrl 
) const
pure virtual

Loads value from property to the control.

Implemented in wxPGCheckBoxEditor, wxPGComboBoxEditor, wxPGChoiceEditor, and wxPGTextCtrlEditor.


The documentation for this class was generated from the following file: