Implementations of wxPGProperty::ChildChanged() must now return changed value of the whole property instead of writing it back to 'thisValue' argument. This change was done primarily for better compatibility with wxPython bindings, but should also be slightly more cleaner behavior API-wise. Breaks backwards compatibility, but not silently.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60936 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -183,8 +183,9 @@ public:
|
||||
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
||||
wxWindow* primary, wxEvent& event );
|
||||
virtual void ChildChanged( wxVariant& thisValue,
|
||||
int childIndex, wxVariant& childValue ) const;
|
||||
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
virtual void RefreshChildren();
|
||||
|
||||
protected:
|
||||
|
@@ -1274,17 +1274,21 @@ public:
|
||||
wxEvent& event );
|
||||
|
||||
/**
|
||||
Called after value of a child property has been altered.
|
||||
Called after value of a child property has been altered. Must return
|
||||
new value of the whole property (after any alterations warrented by
|
||||
child's new value).
|
||||
|
||||
Note that this function is usually called at the time that value of
|
||||
this property, or given child property, is still pending for change.
|
||||
this property, or given child property, is still pending for change,
|
||||
and as such, result of GetValue() or m_value should not be relied
|
||||
on.
|
||||
|
||||
Sample pseudo-code implementation:
|
||||
|
||||
@code
|
||||
void MyProperty::ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const
|
||||
wxVariant MyProperty::ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const
|
||||
{
|
||||
// Acquire reference to actual type of data stored in variant
|
||||
// (TFromVariant only exists if wxPropertyGrid's wxVariant-macros
|
||||
@@ -1302,19 +1306,28 @@ public:
|
||||
break;
|
||||
...
|
||||
}
|
||||
|
||||
// Return altered data
|
||||
return data;
|
||||
}
|
||||
@endcode
|
||||
|
||||
@param thisValue
|
||||
Value of this property, that should be altered.
|
||||
Value of this property. Changed value should be returned (in
|
||||
previous versions of wxPropertyGrid it was only necessary to
|
||||
write value back to this argument).
|
||||
@param childIndex
|
||||
Index of child changed (you can use Item(childIndex) to get).
|
||||
Index of child changed (you can use Item(childIndex) to get
|
||||
child property).
|
||||
@param childValue
|
||||
Value of the child property.
|
||||
(Pending) value of the child property.
|
||||
|
||||
@return
|
||||
Modified value of the whole property.
|
||||
*/
|
||||
virtual void ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
|
||||
/** Returns pointer to an instance of used editor.
|
||||
*/
|
||||
|
@@ -534,9 +534,9 @@ public:
|
||||
virtual bool StringToValue( wxVariant& variant,
|
||||
const wxString& text,
|
||||
int flags ) const;
|
||||
virtual void ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
virtual void RefreshChildren();
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
|
Reference in New Issue
Block a user