Added virtual wxPGProperty::ValueToString(). In derived property classes, now it must be implemented instead of GetValueAsString (assertion failure is raised at run-time if you fail to do so). This change is needed to properly support wxEVT_PG_CHANGING for nested composite string properties. wxPGProperty::GenerateComposedValue() partially updated to support this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-10-16 17:19:50 +00:00
parent f7ca1dd416
commit 1425eca550
12 changed files with 388 additions and 167 deletions

View File

@@ -421,9 +421,10 @@
return wxPGEditor_TextCtrl;
}
virtual wxString GetValueAsString( int argFlags ) const
virtual wxString ValueToString( wxVariant& value,
int argFlags ) const
{
// TODO: Return property value in string format
// TODO: Convert given property value to a string
}
virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags )
@@ -542,7 +543,7 @@ public:
If wxPG_FULL_VALUE is set, returns complete, storable value instead
of displayable one (they may be different).
If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of
composite property string value (as generated by GetValueAsString()
composite property string value (as generated by ValueToString()
called with this same flag).
@return Returns @true if resulting wxVariant value was different.
@@ -587,19 +588,23 @@ public:
virtual bool IntToValue( wxVariant& value, int number, int argFlags = 0 ) const;
/**
Returns text representation of property's value.
Converts property value into a text representation.
@param value
Value to be converted.
@param argFlags
If wxPG_FULL_VALUE is set, returns complete, storable string value instead of displayable.
If wxPG_EDITABLE_VALUE is set, returns string value that must be editable in textctrl.
If wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to display
as a part of composite property string value.
If 0 (default value), then displayed string is returned.
If wxPG_FULL_VALUE is set, returns complete, storable string value
instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
string value that must be editable in textctrl. If
wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
display as a part of string property's composite text
representation.
@remarks
Default implementation returns string composed from text representations of
child properties.
@remarks Default implementation calls GenerateComposedValue().
*/
virtual wxString GetValueAsString( int argFlags = 0 ) const;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
/**
Converts string to a value, and if successful, calls SetValue() on it.
@@ -785,7 +790,7 @@ public:
- 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 GetValueAsString()
@see ValueToString()
*/
virtual void OnCustomPaint( wxDC& dc, const wxRect& rect, wxPGPaintData& paintdata );
@@ -923,7 +928,10 @@ public:
/** Deletes all child properties. */
void Empty();
/** Composes text from values of child properties. */
/**
Composes text from values of child properties. You usually do not have
to care about arguments other than 'text'.
*/
void GenerateComposedValue( wxString& text, int argFlags = 0 ) const;
/**
@@ -1099,14 +1107,31 @@ public:
*/
wxBitmap* GetValueImage() const;
/**
To acquire property's value as string, you should use this
function (instead of GetValueAsString()), as it may produce
more accurate value in future versions.
/** Returns text representation of property's value.
@param argFlags
If 0 (default value), then displayed string is returned.
If wxPG_FULL_VALUE is set, returns complete, storable string value
instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
string value that must be editable in textctrl. If
wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
display as a part of string property's composite text
representation.
@remarks In older versions, this function used to be overridden to convert
property's value into a string representation. This function is
now handled by ValueToString(), and overriding this function now
will result in run-time assertion failure.
*/
virtual wxString GetValueAsString( int argFlags = 0 ) const;
/** Synonymous to GetValueAsString().
@deprecated Use GetValueAsString() instead.
@see GetValueAsString()
*/
wxString GetValueString( int argFlags = 0 ) const;
wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const );
/**
Returns value type used by this property.