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

@@ -1033,7 +1033,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.
@@ -1081,22 +1081,24 @@ public:
int number,
int argFlags = 0 ) const;
#endif // !defined(SWIG) || defined(CREATE_VCW)
/**
Converts property value into a text representation.
public:
/** Returns text representation of property's value.
@param value
Value to be converted.
@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 composite property string value.
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.
Default behavior is to do nothing.
@@ -1279,7 +1281,7 @@ public:
colour) pen for drawing framing rectangle. It can be changed as
well.
@see GetValueAsString()
@see ValueToString()
*/
virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect,
@@ -1387,8 +1389,14 @@ public:
else ClearFlag( wxPG_PROP_USES_COMMON_VALUE );
}
/** Composes text from values of child properties. */
void GenerateComposedValue( wxString& text, int argFlags = 0 ) const;
/**
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 = wxPG_VALUE_IS_CURRENT,
const wxVariantList* valueOverrides = NULL,
wxPGHashMapS2S* childResults = NULL ) const;
/** Returns property's label. */
const wxString& GetLabel() const { return m_label; }
@@ -1435,11 +1443,31 @@ public:
}
#endif
/** 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.
*/
wxString GetValueString( int argFlags = 0 ) const;
virtual wxString GetValueAsString( int argFlags = 0 ) const;
/** Synonymous to GetValueAsString().
@deprecated Use GetValueAsString() instead.
@see GetValueAsString()
*/
wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const );
void UpdateControl( wxWindow* primary );
@@ -1460,7 +1488,7 @@ public:
wxString GetDisplayedString() const
{
return GetValueString(0);
return GetValueAsString(0);
}
/** Returns property grid where property lies. */
@@ -2183,7 +2211,7 @@ public:
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
protected:
virtual wxString GetValueAsString( int argFlags ) const;
virtual wxString ValueToString( wxVariant& value, int argFlags ) const;
void SetTextColIndex( unsigned int colInd )
{ m_capFgColIndex = (wxByte) colInd; }