+ // Copy childValue into data.
+ switch ( childIndex )
+ {
+ case 0:
+ data.SetSubProp1( childvalue.GetLong() );
+ break;
+ case 1:
+ data.SetSubProp2( childvalue.GetString() );
+ break;
+ ...
+ }
+ }
+ @endcode
+
+ @param thisValue
+ Value of this property, that should be altered.
+ @param childIndex
+ Index of child changed (you can use Item(childIndex) to get).
+ @param childValue
+ Value of the child property.
+ */
+ virtual void ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
+
+ /** Returns pointer to an instance of used editor.
+ */
+ virtual const wxPGEditor* DoGetEditorClass() const;
+
+ /** Returns pointer to the wxValidator that should be used
+ with the editor of this property (NULL for no validator).
+ Setting validator explicitly via SetPropertyValidator
+ will override this.
+
+ In most situations, code like this should work well
+ (macros are used to maintain one actual validator instance,
+ so on the second call the function exits within the first
+ macro):
+
+ @code
+
+ wxValidator* wxMyPropertyClass::DoGetValidator () const
+ {
+ WX_PG_DOGETVALIDATOR_ENTRY()
+
+ wxMyValidator* validator = new wxMyValidator(...);
+
+ ... prepare validator...
+
+ WX_PG_DOGETVALIDATOR_EXIT(validator)
+ }
+
+ @endcode
+
+ @remarks
+ You can get common filename validator by returning
+ wxFileProperty::GetClassValidator(). wxDirProperty,
+ for example, uses it.
+ */
+ virtual wxValidator* DoGetValidator () const;
+
+ /**
+ Override to paint an image in front of the property value text or
+ drop-down list item (but only if wxPGProperty::OnMeasureImage is
+ overridden as well).
+
+ If property's OnMeasureImage() returns size that has height != 0 but
+ less than row height ( < 0 has special meanings), wxPropertyGrid calls
+ this method to draw a custom image in a limited area in front of the
+ editor control or value text/graphics, and if control has drop-down
+ list, then the image is drawn there as well (even in the case
+ OnMeasureImage() returned higher height than row height).
+
+ NOTE: Following applies when OnMeasureImage() returns a "flexible"
+ height ( using wxPG_FLEXIBLE_SIZE(W,H) macro), which implies variable
+ height items: If rect.x is < 0, then this is a measure item call, which
+ means that dc is invalid and only thing that should be done is to set
+ paintdata.m_drawnHeight to the height of the image of item at index
+ paintdata.m_choiceItem. This call may be done even as often as once
+ every drop-down popup show.
+
+ @param dc
+ wxDC to paint on.
+ @param rect
+ Box reserved for custom graphics. Includes surrounding rectangle,
+ if any. If x is < 0, then this is a measure item call (see above).
+ @param paintdata
+ wxPGPaintData structure with much useful data.
+
+ @remarks
+ - You can actually exceed rect width, but if you do so then
+ paintdata.m_drawnWidth must be set to the full width drawn in
+ pixels.
+ - Due to technical reasons, rect's height will be default even if
+ custom height was reported during measure call.
+ - Brush is guaranteed to be default background colour. It has been
+ already used to clear the background of area being painted. It
+ can be modified.
+ - Pen is guaranteed to be 1-wide 'black' (or whatever is the proper
+ colour) pen for drawing framing rectangle. It can be changed as
+ well.
+
+ @see ValueToString()
+ */
+ virtual void OnCustomPaint( wxDC& dc,
+ const wxRect& rect,
+ wxPGPaintData& paintdata );
+
+ /**
+ Returns used wxPGCellRenderer instance for given property column
+ (label=0, value=1).
+
+ Default implementation returns editor's renderer for all columns.
+ */
+ virtual wxPGCellRenderer* GetCellRenderer( int column ) const;
+
+ /** Returns which choice is currently selected. Only applies to properties
+ which have choices.
+
+ Needs to reimplemented in derived class if property value does not
+ map directly to a choice. Integer as index, bool, and string usually do.
+ */
+ virtual int GetChoiceSelection() const;
+
+ /**
+ Refresh values of child properties.
+
+ Automatically called after value is set.
+ */
+ virtual void RefreshChildren();
+
+ /** Special handling for attributes of this property.
+
+ If returns false, then the attribute will be automatically stored in
+ m_attributes.
+
+ Default implementation simply returns false.
+ */
+ virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
+
+ /** Returns value of an attribute.
+
+ Override if custom handling of attributes is needed.
+
+ Default implementation simply return NULL variant.
+ */
+ virtual wxVariant DoGetAttribute( const wxString& name ) const;
+
+ /** Returns instance of a new wxPGEditorDialogAdapter instance, which is
+ used when user presses the (optional) button next to the editor control;
+
+ Default implementation returns NULL (ie. no action is generated when
+ button is pressed).
+ */
+ virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
+
+ /**
+ Called whenever validation has failed with given pending value.
+
+ @remarks If you implement this in your custom property class, please
+ remember to call the baser implementation as well, since they
+ may use it to revert property into pre-change state.
+ */
+ virtual void OnValidationFailure( wxVariant& pendingValue );
+
+ /** Append a new choice to property's list of choices.
+ */
+ int AddChoice( const wxString& label, int value = wxPG_INVALID_VALUE )
+ {
+ return InsertChoice(label, wxNOT_FOUND, value);