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:
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
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.
*/
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 );
virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* wnd_primary, wxEvent& event );
/**
- Called after value of a child property has been altered. Note that this function is
- usually called at the time that value of this property, or given child property, is
- still pending for change.
+ 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,
+ 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 were used to create
- // the variant class).
+ // (TFromVariant only exists if wxPropertyGrid's wxVariant-macros
+ // were used to create the variant class).
T& data = TFromVariant(thisValue);
// Copy childValue into data.
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.
Item(2)->SetValue( vector.z );
}
-void wxVectorProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxVectorProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxVector3f vector;
vector << thisValue;
case 1: vector.y = childValue.GetDouble(); break;
case 2: vector.z = childValue.GetDouble(); break;
}
- thisValue << vector;
+ wxVariant newVariant;
+ newVariant << vector;
+ return newVariant;
}
Item(2)->SetValue( WXVARIANT(triangle.c) );
}
-void wxTriangleProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxTriangleProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxTriangle triangle;
triangle << thisValue;
case 1: triangle.b = vector; break;
case 2: triangle.c = vector; break;
}
- thisValue << triangle;
+ wxVariant newVariant;
+ newVariant << triangle;
+ return newVariant;
}
const wxVector3f& value = wxVector3f() );
virtual ~wxVectorProperty();
- virtual void ChildChanged( wxVariant& thisValue,
- int childIndex, wxVariant& childValue ) const;
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
virtual void RefreshChildren();
protected:
const wxTriangle& value = wxTriangle() );
virtual ~wxTriangleProperty();
- virtual void ChildChanged( wxVariant& thisValue,
- int childIndex, wxVariant& childValue ) const;
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
virtual void RefreshChildren();
protected:
Item(6)->SetValue( variant );
}
-void wxFontDataProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxFontDataProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxFontData fontData;
fontData << thisValue;
fontData.SetChosenFont(font);
}
- thisValue << fontData;
+ wxVariant newVariant;
+ newVariant << fontData;
+ return newVariant;
}
// -----------------------------------------------------------------------
Item(1)->SetValue( (long)size.y );
}
-void wxSizeProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxSizeProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxSize& size = wxSizeRefFromVariant(thisValue);
int val = wxPGVariantToInt(childValue);
case 0: size.x = val; break;
case 1: size.y = val; break;
}
+ wxVariant newVariant;
+ newVariant << size;
+ return newVariant;
}
// -----------------------------------------------------------------------
Item(1)->SetValue( (long)point.y );
}
-void wxPointProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxPointProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
wxPoint& point = wxPointRefFromVariant(thisValue);
int val = wxPGVariantToInt(childValue);
case 0: point.x = val; break;
case 1: point.y = val; break;
}
+ wxVariant newVariant;
+ newVariant << point;
+ return newVariant;
}
// in base class to function properly.
virtual wxVariant DoGetValue() 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 OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event );
const wxSize& value = wxSize() );
virtual ~wxSizeProperty();
- virtual void ChildChanged( wxVariant& thisValue,
- int childIndex, wxVariant& childValue ) const;
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
virtual void RefreshChildren();
protected:
const wxPoint& value = wxPoint() );
virtual ~wxPointProperty();
- virtual void ChildChanged( wxVariant& thisValue,
- int childIndex, wxVariant& childValue ) const;
+ virtual wxVariant ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const;
virtual void RefreshChildren();
protected:
Item(5)->SetValue( font.GetUnderlined() );
}
-void wxFontProperty::ChildChanged( wxVariant& thisValue, int ind, wxVariant& childValue ) const
+wxVariant wxFontProperty::ChildChanged( wxVariant& thisValue,
+ int ind,
+ wxVariant& childValue ) const
{
wxFont font;
font << thisValue;
font.SetUnderlined( childValue.GetBool() );
}
- thisValue << font;
+ wxVariant newVariant;
+ newVariant << font;
+ return newVariant;
}
/*
}
if ( allChildrenSpecified )
- ChildChanged(*value, i, childValue);
+ {
+ *value = ChildChanged(*value, i, childValue);
+ }
+
n++;
if ( n == (unsigned int)list.GetCount() )
break;
}
}
-void wxPGProperty::ChildChanged( wxVariant& WXUNUSED(thisValue),
- int WXUNUSED(childIndex),
- wxVariant& WXUNUSED(childValue) ) const
+wxVariant wxPGProperty::ChildChanged( wxVariant& WXUNUSED(thisValue),
+ int WXUNUSED(childIndex),
+ wxVariant& WXUNUSED(childValue) ) const
{
+ return wxNullVariant;
}
bool wxPGProperty::AreAllChildrenSpecified( wxVariant* pendingList ) const
m_oldValue = flags;
}
-void wxFlagsProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
+wxVariant wxFlagsProperty::ChildChanged( wxVariant& thisValue,
+ int childIndex,
+ wxVariant& childValue ) const
{
long oldValue = thisValue.GetLong();
long val = childValue.GetLong();
unsigned long vi = m_choices.GetValue(childIndex);
+
if ( val )
- thisValue = (long)(oldValue | vi);
- else
- thisValue = (long)(oldValue & ~(vi));
+ return (long) (oldValue | vi);
+
+ return (long) (oldValue & ~(vi));
}
bool wxFlagsProperty::DoSetAttribute( const wxString& name, wxVariant& value )