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:
@@ -180,7 +180,7 @@ public:
|
|||||||
const wxFont& value = wxFont());
|
const wxFont& value = wxFont());
|
||||||
virtual ~wxFontProperty();
|
virtual ~wxFontProperty();
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
||||||
wxWindow* primary, wxEvent& event );
|
wxWindow* primary, wxEvent& event );
|
||||||
virtual void ChildChanged( wxVariant& thisValue,
|
virtual void ChildChanged( wxVariant& thisValue,
|
||||||
@@ -231,7 +231,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual int GetCustomColourIndex() const;
|
virtual int GetCustomColourIndex() const;
|
||||||
|
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -292,7 +292,7 @@ public:
|
|||||||
virtual ~wxColourProperty();
|
virtual ~wxColourProperty();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxString GetValueAsString( int argFlags ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual wxColour GetColour( int index ) const;
|
virtual wxColour GetColour( int index ) const;
|
||||||
virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
|
virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ public:
|
|||||||
virtual ~wxMultiChoiceProperty();
|
virtual ~wxMultiChoiceProperty();
|
||||||
|
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int flags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue(wxVariant& variant,
|
virtual bool StringToValue(wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0) const;
|
int argFlags = 0) const;
|
||||||
@@ -406,7 +406,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void GenerateValueAsString();
|
void GenerateValueAsString( wxString* target ) const;
|
||||||
|
|
||||||
// Returns translation of values into string indices.
|
// Returns translation of values into string indices.
|
||||||
wxArrayInt GetValueAsIndices() const;
|
wxArrayInt GetValueAsIndices() const;
|
||||||
@@ -442,7 +442,7 @@ public:
|
|||||||
const wxDateTime& value = wxDateTime() );
|
const wxDateTime& value = wxDateTime() );
|
||||||
virtual ~wxDateProperty();
|
virtual ~wxDateProperty();
|
||||||
|
|
||||||
virtual wxString GetValueAsString( int flags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue(wxVariant& variant,
|
virtual bool StringToValue(wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0) const;
|
int argFlags = 0) const;
|
||||||
|
@@ -1033,7 +1033,7 @@ public:
|
|||||||
If wxPG_FULL_VALUE is set, returns complete, storable value instead
|
If wxPG_FULL_VALUE is set, returns complete, storable value instead
|
||||||
of displayable one (they may be different).
|
of displayable one (they may be different).
|
||||||
If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of
|
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).
|
called with this same flag).
|
||||||
|
|
||||||
@return Returns @true if resulting wxVariant value was different.
|
@return Returns @true if resulting wxVariant value was different.
|
||||||
@@ -1081,22 +1081,24 @@ public:
|
|||||||
int number,
|
int number,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
#endif // !defined(SWIG) || defined(CREATE_VCW)
|
#endif // !defined(SWIG) || defined(CREATE_VCW)
|
||||||
|
/**
|
||||||
|
Converts property value into a text representation.
|
||||||
|
|
||||||
public:
|
@param value
|
||||||
/** Returns text representation of property's value.
|
Value to be converted.
|
||||||
|
|
||||||
@param argFlags
|
@param argFlags
|
||||||
|
If 0 (default value), then displayed string is returned.
|
||||||
If wxPG_FULL_VALUE is set, returns complete, storable string value
|
If wxPG_FULL_VALUE is set, returns complete, storable string value
|
||||||
instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
|
instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
|
||||||
string value that must be editable in textctrl. If
|
string value that must be editable in textctrl. If
|
||||||
wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to
|
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
|
@remarks Default implementation calls GenerateComposedValue().
|
||||||
Default implementation returns string composed from text
|
|
||||||
representations of child properties.
|
|
||||||
*/
|
*/
|
||||||
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.
|
/** Converts string to a value, and if successful, calls SetValue() on it.
|
||||||
Default behavior is to do nothing.
|
Default behavior is to do nothing.
|
||||||
@@ -1279,7 +1281,7 @@ public:
|
|||||||
colour) pen for drawing framing rectangle. It can be changed as
|
colour) pen for drawing framing rectangle. It can be changed as
|
||||||
well.
|
well.
|
||||||
|
|
||||||
@see GetValueAsString()
|
@see ValueToString()
|
||||||
*/
|
*/
|
||||||
virtual void OnCustomPaint( wxDC& dc,
|
virtual void OnCustomPaint( wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
@@ -1387,8 +1389,14 @@ public:
|
|||||||
else ClearFlag( wxPG_PROP_USES_COMMON_VALUE );
|
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. */
|
/** Returns property's label. */
|
||||||
const wxString& GetLabel() const { return m_label; }
|
const wxString& GetLabel() const { return m_label; }
|
||||||
@@ -1435,11 +1443,31 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** To acquire property's value as string, you should use this
|
/** Returns text representation of property's value.
|
||||||
function (instead of GetValueAsString()), as it may produce
|
|
||||||
more accurate value in future versions.
|
@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 );
|
void UpdateControl( wxWindow* primary );
|
||||||
|
|
||||||
@@ -1460,7 +1488,7 @@ public:
|
|||||||
|
|
||||||
wxString GetDisplayedString() const
|
wxString GetDisplayedString() const
|
||||||
{
|
{
|
||||||
return GetValueString(0);
|
return GetValueAsString(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns property grid where property lies. */
|
/** Returns property grid where property lies. */
|
||||||
@@ -2183,7 +2211,7 @@ public:
|
|||||||
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
|
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxString GetValueAsString( int argFlags ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags ) const;
|
||||||
|
|
||||||
void SetTextColIndex( unsigned int colInd )
|
void SetTextColIndex( unsigned int colInd )
|
||||||
{ m_capFgColIndex = (wxByte) colInd; }
|
{ m_capFgColIndex = (wxByte) colInd; }
|
||||||
|
@@ -229,6 +229,12 @@
|
|||||||
// (for tree buttons)
|
// (for tree buttons)
|
||||||
//#undef wxPG_ICON_WIDTH
|
//#undef wxPG_ICON_WIDTH
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2_6 || WXWIN_COMPATIBILITY_2_8
|
||||||
|
#define wxPG_COMPATIBILITY_1_4 1
|
||||||
|
#else
|
||||||
|
#define wxPG_COMPATIBILITY_1_4 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// Need to force disable tooltips?
|
// Need to force disable tooltips?
|
||||||
#if !wxUSE_TOOLTIPS
|
#if !wxUSE_TOOLTIPS
|
||||||
#undef wxPG_SUPPORT_TOOLTIPS
|
#undef wxPG_SUPPORT_TOOLTIPS
|
||||||
@@ -332,6 +338,9 @@ WX_DECLARE_STRING_HASH_MAP_WITH_DECL(void*,
|
|||||||
wxPGHashMapS2P,
|
wxPGHashMapS2P,
|
||||||
class WXDLLIMPEXP_PROPGRID);
|
class WXDLLIMPEXP_PROPGRID);
|
||||||
|
|
||||||
|
WX_DECLARE_STRING_HASH_MAP_WITH_DECL(wxString,
|
||||||
|
wxPGHashMapS2S,
|
||||||
|
class WXDLLIMPEXP_PROPGRID);
|
||||||
|
|
||||||
WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
|
WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL(void*,
|
||||||
wxPGHashMapP2P,
|
wxPGHashMapP2P,
|
||||||
@@ -392,7 +401,11 @@ enum wxPG_MISC_ARG_FLAGS
|
|||||||
|
|
||||||
// Means property for which final string value is for can not really be
|
// Means property for which final string value is for can not really be
|
||||||
// edited.
|
// edited.
|
||||||
wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020
|
wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020,
|
||||||
|
|
||||||
|
// ValueToString() called from GetValueAsString()
|
||||||
|
// (guarantees that input wxVariant value is current own value)
|
||||||
|
wxPG_VALUE_IS_CURRENT = 0x00000040
|
||||||
};
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
@@ -106,7 +106,7 @@ public:
|
|||||||
const wxString& value = wxEmptyString );
|
const wxString& value = wxEmptyString );
|
||||||
virtual ~wxStringProperty();
|
virtual ~wxStringProperty();
|
||||||
|
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
wxIntProperty( const wxString& label,
|
wxIntProperty( const wxString& label,
|
||||||
const wxString& name,
|
const wxString& name,
|
||||||
const wxLongLong& value );
|
const wxLongLong& value );
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -250,7 +250,7 @@ public:
|
|||||||
wxUIntProperty( const wxString& label,
|
wxUIntProperty( const wxString& label,
|
||||||
const wxString& name,
|
const wxString& name,
|
||||||
const wxULongLong& value );
|
const wxULongLong& value );
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -287,7 +287,7 @@ public:
|
|||||||
double value = 0.0 );
|
double value = 0.0 );
|
||||||
virtual ~wxFloatProperty();
|
virtual ~wxFloatProperty();
|
||||||
|
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -330,7 +330,7 @@ public:
|
|||||||
bool value = false );
|
bool value = false );
|
||||||
virtual ~wxBoolProperty();
|
virtual ~wxBoolProperty();
|
||||||
|
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -360,7 +360,7 @@ public:
|
|||||||
const wxString& name = wxPG_LABEL );
|
const wxString& name = wxPG_LABEL );
|
||||||
|
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int argFlags ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -553,7 +553,7 @@ public:
|
|||||||
virtual ~wxFlagsProperty ();
|
virtual ~wxFlagsProperty ();
|
||||||
|
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int argFlags ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int flags ) const;
|
int flags ) const;
|
||||||
@@ -631,7 +631,7 @@ public:
|
|||||||
virtual ~wxFileProperty ();
|
virtual ~wxFileProperty ();
|
||||||
|
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int argFlags ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -641,12 +641,16 @@ public:
|
|||||||
static wxValidator* GetClassValidator();
|
static wxValidator* GetClassValidator();
|
||||||
virtual wxValidator* DoGetValidator() const;
|
virtual wxValidator* DoGetValidator() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns filename to file represented by current value.
|
||||||
|
*/
|
||||||
|
wxFileName GetFileName() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_wildcard;
|
wxString m_wildcard;
|
||||||
wxString m_basePath; // If set, then show path relative to it
|
wxString m_basePath; // If set, then show path relative to it
|
||||||
wxString m_initialPath; // If set, start the file dialog here
|
wxString m_initialPath; // If set, start the file dialog here
|
||||||
wxString m_dlgTitle; // If set, used as title for file dialog
|
wxString m_dlgTitle; // If set, used as title for file dialog
|
||||||
wxFileName m_filename; // used as primary storage
|
|
||||||
int m_indFilter; // index to the selected filter
|
int m_indFilter; // index to the selected filter
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -682,7 +686,7 @@ public:
|
|||||||
const wxString& value = wxEmptyString );
|
const wxString& value = wxEmptyString );
|
||||||
virtual ~wxLongStringProperty();
|
virtual ~wxLongStringProperty();
|
||||||
|
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
@@ -761,7 +765,7 @@ public:
|
|||||||
virtual ~wxArrayStringProperty();
|
virtual ~wxArrayStringProperty();
|
||||||
|
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
|
@@ -421,9 +421,10 @@
|
|||||||
return wxPGEditor_TextCtrl;
|
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 )
|
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
|
If wxPG_FULL_VALUE is set, returns complete, storable value instead
|
||||||
of displayable one (they may be different).
|
of displayable one (they may be different).
|
||||||
If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of
|
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).
|
called with this same flag).
|
||||||
|
|
||||||
@return Returns @true if resulting wxVariant value was different.
|
@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;
|
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
|
@param argFlags
|
||||||
If wxPG_FULL_VALUE is set, returns complete, storable string value instead of displayable.
|
If 0 (default value), then displayed string is returned.
|
||||||
If wxPG_EDITABLE_VALUE is set, returns string value that must be editable in textctrl.
|
If wxPG_FULL_VALUE is set, returns complete, storable string value
|
||||||
If wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to display
|
instead of displayable. If wxPG_EDITABLE_VALUE is set, returns
|
||||||
as a part of composite property string value.
|
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
|
@remarks Default implementation calls GenerateComposedValue().
|
||||||
Default implementation returns string composed from text representations of
|
|
||||||
child properties.
|
|
||||||
*/
|
*/
|
||||||
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.
|
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
|
- 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.
|
drawing framing rectangle. It can be changed as well.
|
||||||
|
|
||||||
@see GetValueAsString()
|
@see ValueToString()
|
||||||
*/
|
*/
|
||||||
virtual void OnCustomPaint( wxDC& dc, const wxRect& rect, wxPGPaintData& paintdata );
|
virtual void OnCustomPaint( wxDC& dc, const wxRect& rect, wxPGPaintData& paintdata );
|
||||||
|
|
||||||
@@ -923,7 +928,10 @@ public:
|
|||||||
/** Deletes all child properties. */
|
/** Deletes all child properties. */
|
||||||
void Empty();
|
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;
|
void GenerateComposedValue( wxString& text, int argFlags = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1099,14 +1107,31 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxBitmap* GetValueImage() const;
|
wxBitmap* GetValueImage() const;
|
||||||
|
|
||||||
/**
|
/** Returns text representation of property's value.
|
||||||
To acquire property's value as string, you should use this
|
|
||||||
function (instead of GetValueAsString()), as it may produce
|
@param argFlags
|
||||||
more accurate value in future versions.
|
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()
|
@see GetValueAsString()
|
||||||
*/
|
*/
|
||||||
wxString GetValueString( int argFlags = 0 ) const;
|
wxDEPRECATED( wxString GetValueString( int argFlags = 0 ) const );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns value type used by this property.
|
Returns value type used by this property.
|
||||||
|
@@ -287,6 +287,7 @@ void wxAdvImageFileProperty::OnSetValue()
|
|||||||
|
|
||||||
if ( imagename.length() )
|
if ( imagename.length() )
|
||||||
{
|
{
|
||||||
|
wxFileName filename = GetFileName();
|
||||||
size_t prevCount = g_myImageArray.GetCount();
|
size_t prevCount = g_myImageArray.GetCount();
|
||||||
int index = ms_choices.Index(imagename);
|
int index = ms_choices.Index(imagename);
|
||||||
|
|
||||||
@@ -294,7 +295,7 @@ void wxAdvImageFileProperty::OnSetValue()
|
|||||||
if ( index == wxNOT_FOUND )
|
if ( index == wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
ms_choices.Add( imagename );
|
ms_choices.Add( imagename );
|
||||||
g_myImageArray.Add( new wxMyImageInfo( m_filename.GetFullPath() ) );
|
g_myImageArray.Add( new wxMyImageInfo( filename.GetFullPath() ) );
|
||||||
|
|
||||||
index = g_myImageArray.GetCount() - 1;
|
index = g_myImageArray.GetCount() - 1;
|
||||||
}
|
}
|
||||||
@@ -303,8 +304,8 @@ void wxAdvImageFileProperty::OnSetValue()
|
|||||||
if ( !g_myImageArray[index].m_pThumbnail2 )
|
if ( !g_myImageArray[index].m_pThumbnail2 )
|
||||||
{
|
{
|
||||||
// Load if file exists.
|
// Load if file exists.
|
||||||
if ( m_filename.FileExists() )
|
if ( filename.FileExists() )
|
||||||
m_pImage = new wxImage( m_filename.GetFullPath() );
|
m_pImage = new wxImage( filename.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_index = index;
|
m_index = index;
|
||||||
@@ -365,9 +366,10 @@ void wxAdvImageFileProperty::LoadThumbnails( size_t index )
|
|||||||
|
|
||||||
if ( !mii.m_pThumbnail2 )
|
if ( !mii.m_pThumbnail2 )
|
||||||
{
|
{
|
||||||
|
wxFileName filename = GetFileName();
|
||||||
|
|
||||||
if ( !m_pImage || !m_pImage->Ok() ||
|
if ( !m_pImage || !m_pImage->Ok() ||
|
||||||
m_filename != mii.m_path
|
filename != mii.m_path
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( m_pImage )
|
if ( m_pImage )
|
||||||
|
@@ -513,16 +513,29 @@ wxArrayDoubleProperty::~wxArrayDoubleProperty () { }
|
|||||||
|
|
||||||
void wxArrayDoubleProperty::OnSetValue()
|
void wxArrayDoubleProperty::OnSetValue()
|
||||||
{
|
{
|
||||||
|
// Generate cached display string, to optimize grid drawing
|
||||||
GenerateValueAsString( m_display, m_precision, true );
|
GenerateValueAsString( m_display, m_precision, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxArrayDoubleProperty::GetValueAsString( int arg_flags ) const
|
wxString wxArrayDoubleProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
if ( !(arg_flags & wxPG_FULL_VALUE ))
|
|
||||||
return m_display;
|
|
||||||
|
|
||||||
wxString s;
|
wxString s;
|
||||||
|
|
||||||
|
if ( argFlags & wxPG_FULL_VALUE )
|
||||||
|
{
|
||||||
GenerateValueAsString(s,-1,false);
|
GenerateValueAsString(s,-1,false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Display cached string only if value truly matches m_value
|
||||||
|
if ( value.GetData() == m_value.GetData() )
|
||||||
|
return m_display;
|
||||||
|
else
|
||||||
|
GenerateValueAsString( s, m_precision, true );
|
||||||
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,7 +113,7 @@ public:
|
|||||||
virtual ~wxArrayDoubleProperty ();
|
virtual ~wxArrayDoubleProperty ();
|
||||||
|
|
||||||
virtual void OnSetValue();
|
virtual void OnSetValue();
|
||||||
virtual wxString GetValueAsString( int argFlags = 0 ) const;
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const;
|
||||||
virtual bool StringToValue( wxVariant& variant,
|
virtual bool StringToValue( wxVariant& variant,
|
||||||
const wxString& text,
|
const wxString& text,
|
||||||
int argFlags = 0 ) const;
|
int argFlags = 0 ) const;
|
||||||
|
@@ -522,9 +522,10 @@ void wxFontProperty::OnSetValue()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFontProperty::GetValueAsString( int argFlags ) const
|
wxString wxFontProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
return wxPGProperty::GetValueAsString(argFlags);
|
return wxPGProperty::ValueToString(value, argFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFontProperty::OnEvent( wxPropertyGrid* propgrid, wxWindow* WXUNUSED(primary),
|
bool wxFontProperty::OnEvent( wxPropertyGrid* propgrid, wxWindow* WXUNUSED(primary),
|
||||||
@@ -999,24 +1000,12 @@ wxString wxSystemColourProperty::ColourToString( const wxColour& col, int index
|
|||||||
return m_choices.GetLabel(index);
|
return m_choices.GetLabel(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxSystemColourProperty::GetValueAsString( int argFlags ) const
|
wxString wxSystemColourProperty::ValueToString( wxVariant& value,
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
wxColourPropertyValue val = GetVal();
|
wxColourPropertyValue val = GetVal(&value);
|
||||||
|
|
||||||
int ind = GetIndex();
|
return ColourToString(val.m_colour, m_choices.Index(val.m_type));
|
||||||
|
|
||||||
// Always show custom colour for textctrl-editor
|
|
||||||
if ( val.m_type == wxPG_COLOUR_CUSTOM ||
|
|
||||||
ind == GetCustomColourIndex() ||
|
|
||||||
(argFlags & wxPG_PROPERTY_SPECIFIC) )
|
|
||||||
{
|
|
||||||
return ColourToString(val.m_colour, wxNOT_FOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ind == -1 )
|
|
||||||
return wxEmptyString;
|
|
||||||
|
|
||||||
return ColourToString(val.m_colour, ind);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1392,7 +1381,8 @@ void wxColourProperty::Init( wxColour colour )
|
|||||||
SetIndex( ind );
|
SetIndex( ind );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxColourProperty::GetValueAsString( int argFlags ) const
|
wxString wxColourProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
const wxPGEditor* editor = GetEditorClass();
|
const wxPGEditor* editor = GetEditorClass();
|
||||||
if ( editor != wxPGEditor_Choice &&
|
if ( editor != wxPGEditor_Choice &&
|
||||||
@@ -1400,7 +1390,7 @@ wxString wxColourProperty::GetValueAsString( int argFlags ) const
|
|||||||
editor != wxPGEditor_ComboBox )
|
editor != wxPGEditor_ComboBox )
|
||||||
argFlags |= wxPG_PROPERTY_SPECIFIC;
|
argFlags |= wxPG_PROPERTY_SPECIFIC;
|
||||||
|
|
||||||
return wxSystemColourProperty::GetValueAsString(argFlags);
|
return wxSystemColourProperty::ValueToString(value, argFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour wxColourProperty::GetColour( int index ) const
|
wxColour wxColourProperty::GetColour( int index ) const
|
||||||
@@ -1651,10 +1641,12 @@ void wxImageFileProperty::OnSetValue()
|
|||||||
m_pBitmap = NULL;
|
m_pBitmap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxFileName filename = GetFileName();
|
||||||
|
|
||||||
// Create the image thumbnail
|
// Create the image thumbnail
|
||||||
if ( m_filename.FileExists() )
|
if ( filename.FileExists() )
|
||||||
{
|
{
|
||||||
m_pImage = new wxImage( m_filename.GetFullPath() );
|
m_pImage = new wxImage( filename.GetFullPath() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1739,22 +1731,29 @@ wxMultiChoiceProperty::~wxMultiChoiceProperty()
|
|||||||
|
|
||||||
void wxMultiChoiceProperty::OnSetValue()
|
void wxMultiChoiceProperty::OnSetValue()
|
||||||
{
|
{
|
||||||
GenerateValueAsString();
|
GenerateValueAsString(&m_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMultiChoiceProperty::GetValueAsString( int ) const
|
wxString wxMultiChoiceProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
|
// If possible, use cached string
|
||||||
|
if ( argFlags & wxPG_VALUE_IS_CURRENT )
|
||||||
return m_display;
|
return m_display;
|
||||||
|
|
||||||
|
wxString s;
|
||||||
|
GenerateValueAsString(&s);
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMultiChoiceProperty::GenerateValueAsString()
|
void wxMultiChoiceProperty::GenerateValueAsString( wxString* target ) const
|
||||||
{
|
{
|
||||||
wxArrayString strings;
|
wxArrayString strings;
|
||||||
|
|
||||||
if ( m_value.GetType() == wxPG_VARIANT_TYPE_ARRSTRING )
|
if ( m_value.GetType() == wxPG_VARIANT_TYPE_ARRSTRING )
|
||||||
strings = m_value.GetArrayString();
|
strings = m_value.GetArrayString();
|
||||||
|
|
||||||
wxString& tempStr = m_display;
|
wxString& tempStr = *target;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int itemCount = strings.size();
|
unsigned int itemCount = strings.size();
|
||||||
|
|
||||||
@@ -1951,11 +1950,12 @@ bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxDateProperty::GetValueAsString( int argFlags ) const
|
wxString wxDateProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
const wxChar* format = (const wxChar*) NULL;
|
const wxChar* format = (const wxChar*) NULL;
|
||||||
|
|
||||||
wxDateTime dateTime = m_value.GetDateTime();
|
wxDateTime dateTime = value.GetDateTime();
|
||||||
|
|
||||||
if ( !dateTime.IsValid() )
|
if ( !dateTime.IsValid() )
|
||||||
return wxT("Invalid");
|
return wxT("Invalid");
|
||||||
|
@@ -236,7 +236,8 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
|
|||||||
return (wxWindow*) NULL;
|
return (wxWindow*) NULL;
|
||||||
|
|
||||||
if ( !property->IsValueUnspecified() )
|
if ( !property->IsValueUnspecified() )
|
||||||
text = property->GetValueString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
|
text = property->GetValueAsString(property->HasFlag(wxPG_PROP_READONLY) ?
|
||||||
|
0 : wxPG_EDITABLE_VALUE);
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if ( (property->GetFlags() & wxPG_PROP_PASSWORD) &&
|
if ( (property->GetFlags() & wxPG_PROP_PASSWORD) &&
|
||||||
@@ -620,7 +621,7 @@ void wxPropertyGrid::OnComboItemPaint( wxPGCustomComboControl* pCc,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !p->IsValueUnspecified() )
|
if ( !p->IsValueUnspecified() )
|
||||||
text = p->GetValueString(0);
|
text = p->GetValueAsString(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1020,7 +1021,7 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(ComboBox,
|
|||||||
void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
|
void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const
|
||||||
{
|
{
|
||||||
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
|
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
|
||||||
cb->SetValue(property->GetValueString(wxPG_EDITABLE_VALUE));
|
cb->SetValue(property->GetValueAsString(wxPG_EDITABLE_VALUE));
|
||||||
|
|
||||||
// TODO: If string matches any selection, then select that.
|
// TODO: If string matches any selection, then select that.
|
||||||
}
|
}
|
||||||
@@ -1801,7 +1802,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrlAndButton( const wxPoint& pos,
|
|||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
if ( !property->IsValueUnspecified() )
|
if ( !property->IsValueUnspecified() )
|
||||||
text = property->GetValueString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
|
text = property->GetValueAsString(property->HasFlag(wxPG_PROP_READONLY)?0:wxPG_EDITABLE_VALUE);
|
||||||
|
|
||||||
return GenerateEditorTextCtrl(pos,sz,text,but,property->m_maxLen);
|
return GenerateEditorTextCtrl(pos,sz,text,but,property->m_maxLen);
|
||||||
}
|
}
|
||||||
|
@@ -43,6 +43,12 @@
|
|||||||
|
|
||||||
#define PWC_CHILD_SUMMARY_CHAR_LIMIT 64 // Character limit of summary field when not editing
|
#define PWC_CHILD_SUMMARY_CHAR_LIMIT 64 // Character limit of summary field when not editing
|
||||||
|
|
||||||
|
#if wxPG_COMPATIBILITY_1_4
|
||||||
|
|
||||||
|
// Used to establish backwards compatiblity
|
||||||
|
const char* g_invalidStringContent = "@__TOTALLY_INVALID_STRING__@";
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -220,7 +226,7 @@ void wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
|
|||||||
if ( column == 0 )
|
if ( column == 0 )
|
||||||
text = property->GetLabel();
|
text = property->GetLabel();
|
||||||
else if ( column == 1 )
|
else if ( column == 1 )
|
||||||
text = property->GetValueString();
|
text = property->GetValueAsString();
|
||||||
else
|
else
|
||||||
text = wxEmptyString;
|
text = wxEmptyString;
|
||||||
}
|
}
|
||||||
@@ -274,7 +280,7 @@ void wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
|
|||||||
imageOffset = paintdata.m_drawnWidth;
|
imageOffset = paintdata.m_drawnWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = property->GetValueString();
|
text = property->GetValueAsString();
|
||||||
|
|
||||||
// Add units string?
|
// Add units string?
|
||||||
if ( propertyGrid->GetColumnCount() <= 2 )
|
if ( propertyGrid->GetColumnCount() <= 2 )
|
||||||
@@ -423,6 +429,13 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState,
|
|||||||
|
|
||||||
m_parentState = pageState;
|
m_parentState = pageState;
|
||||||
|
|
||||||
|
#if wxPG_COMPATIBILITY_1_4
|
||||||
|
// Make sure deprecated virtual functions are not implemented
|
||||||
|
wxString s = GetValueAsString( 0xFFFF );
|
||||||
|
wxASSERT_MSG( s == g_invalidStringContent,
|
||||||
|
"Implement ValueToString() instead of GetValueAsString()" );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( !parentIsRoot )
|
if ( !parentIsRoot )
|
||||||
{
|
{
|
||||||
m_bgColIndex = parent->m_bgColIndex;
|
m_bgColIndex = parent->m_bgColIndex;
|
||||||
@@ -651,7 +664,10 @@ wxString wxPGProperty::GetColumnText( unsigned int col ) const
|
|||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPGProperty::GenerateComposedValue( wxString& text, int argFlags ) const
|
void wxPGProperty::GenerateComposedValue( wxString& text,
|
||||||
|
int argFlags,
|
||||||
|
const wxVariantList* valueOverrides,
|
||||||
|
wxPGHashMapS2S* childResults ) const
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int iMax = m_children.size();
|
int iMax = m_children.size();
|
||||||
@@ -671,11 +687,64 @@ void wxPGProperty::GenerateComposedValue( wxString& text, int argFlags ) const
|
|||||||
|
|
||||||
wxPGProperty* curChild = m_children[0];
|
wxPGProperty* curChild = m_children[0];
|
||||||
|
|
||||||
|
bool overridesLeft = false;
|
||||||
|
wxVariant overrideValue;
|
||||||
|
wxVariantList::const_iterator node;
|
||||||
|
|
||||||
|
if ( valueOverrides )
|
||||||
|
{
|
||||||
|
node = valueOverrides->begin();
|
||||||
|
if ( node != valueOverrides->end() )
|
||||||
|
{
|
||||||
|
overrideValue = *node;
|
||||||
|
overridesLeft = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for ( i = 0; i < iMax; i++ )
|
for ( i = 0; i < iMax; i++ )
|
||||||
{
|
{
|
||||||
|
wxVariant childValue;
|
||||||
|
|
||||||
|
wxString childLabel = curChild->GetLabel();
|
||||||
|
|
||||||
|
// Check for value override
|
||||||
|
if ( overridesLeft && overrideValue.GetName() == childLabel )
|
||||||
|
{
|
||||||
|
if ( !overrideValue.IsNull() )
|
||||||
|
childValue = overrideValue;
|
||||||
|
else
|
||||||
|
childValue = curChild->GetValue();
|
||||||
|
node++;
|
||||||
|
if ( node != valueOverrides->end() )
|
||||||
|
overrideValue = *node;
|
||||||
|
else
|
||||||
|
overridesLeft = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
childValue = curChild->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
wxString s;
|
wxString s;
|
||||||
if ( !curChild->IsValueUnspecified() )
|
if ( !childValue.IsNull() )
|
||||||
s = curChild->GetValueString(argFlags|wxPG_COMPOSITE_FRAGMENT);
|
{
|
||||||
|
if ( overridesLeft &&
|
||||||
|
curChild->HasFlag(wxPG_PROP_COMPOSED_VALUE) &&
|
||||||
|
childValue.GetType() == wxPG_VARIANT_TYPE_LIST )
|
||||||
|
{
|
||||||
|
wxVariantList& childList = childValue.GetList();
|
||||||
|
GenerateComposedValue(s, argFlags|wxPG_COMPOSITE_FRAGMENT,
|
||||||
|
&childList, childResults);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s = curChild->ValueToString(childValue,
|
||||||
|
argFlags|wxPG_COMPOSITE_FRAGMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( childResults && curChild->GetChildCount() )
|
||||||
|
(*childResults)[curChild->GetName()] = s;
|
||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
if ( (argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT) && !s.length() )
|
if ( (argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT) && !s.length() )
|
||||||
@@ -714,24 +783,45 @@ void wxPGProperty::GenerateComposedValue( wxString& text, int argFlags ) const
|
|||||||
text += wxS("; ...");
|
text += wxS("; ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxPGProperty::GetValueAsString( int argFlags ) const
|
wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value),
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( GetChildCount() > 0,
|
wxCHECK_MSG( GetChildCount() > 0,
|
||||||
wxString(),
|
wxString(),
|
||||||
wxT("If user property does not have any children, it must override GetValueAsString") );
|
"If user property does not have any children, it must "
|
||||||
|
"override GetValueAsString" );
|
||||||
|
|
||||||
|
// FIXME: Currently code below only works if value is actually m_value
|
||||||
|
wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT,
|
||||||
|
"Sorry, currently default wxPGProperty::ValueToString() "
|
||||||
|
"implementation only works if value is m_value." );
|
||||||
|
|
||||||
wxString text;
|
wxString text;
|
||||||
GenerateComposedValue(text, argFlags);
|
GenerateComposedValue(text, argFlags);
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxPGProperty::GetValueString( int argFlags ) const
|
wxString wxPGProperty::GetValueAsString( int argFlags ) const
|
||||||
{
|
{
|
||||||
|
#if wxPG_COMPATIBILITY_1_4
|
||||||
|
// This is backwards compatibility test
|
||||||
|
// That is, to make sure this function is not overridden
|
||||||
|
// (instead, ValueToString() should be).
|
||||||
|
if ( argFlags == 0xFFFF )
|
||||||
|
{
|
||||||
|
// Do not override! (for backwards compliancy)
|
||||||
|
return g_invalidStringContent;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( IsValueUnspecified() )
|
if ( IsValueUnspecified() )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
if ( m_commonValue == -1 )
|
if ( m_commonValue == -1 )
|
||||||
return GetValueAsString(argFlags);
|
{
|
||||||
|
wxVariant value(GetValue());
|
||||||
|
return ValueToString(value, argFlags|wxPG_VALUE_IS_CURRENT);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Return common value's string representation
|
// Return common value's string representation
|
||||||
@@ -752,6 +842,11 @@ wxString wxPGProperty::GetValueString( int argFlags ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxString wxPGProperty::GetValueString( int argFlags ) const
|
||||||
|
{
|
||||||
|
return GetValueAsString(argFlags);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxPGProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const
|
bool wxPGProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
variant = (long)number;
|
variant = (long)number;
|
||||||
@@ -2020,7 +2115,7 @@ wxPGProperty* wxPGProperty::UpdateParentValues()
|
|||||||
!parent->IsCategory() && !parent->IsRoot() )
|
!parent->IsCategory() && !parent->IsRoot() )
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
parent->GenerateComposedValue(s, 0);
|
parent->GenerateComposedValue(s);
|
||||||
parent->m_value = s;
|
parent->m_value = s;
|
||||||
return parent->UpdateParentValues();
|
return parent->UpdateParentValues();
|
||||||
}
|
}
|
||||||
@@ -2134,7 +2229,8 @@ wxPropertyCategory::~wxPropertyCategory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString wxPropertyCategory::GetValueAsString( int ) const
|
wxString wxPropertyCategory::ValueToString( wxVariant& WXUNUSED(value),
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
@@ -79,22 +79,30 @@ void wxStringProperty::OnSetValue()
|
|||||||
if ( HasFlag(wxPG_PROP_COMPOSED_VALUE) )
|
if ( HasFlag(wxPG_PROP_COMPOSED_VALUE) )
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
GenerateComposedValue(s, 0);
|
GenerateComposedValue(s);
|
||||||
m_value = s;
|
m_value = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxStringProperty::~wxStringProperty() { }
|
wxStringProperty::~wxStringProperty() { }
|
||||||
|
|
||||||
wxString wxStringProperty::GetValueAsString( int argFlags ) const
|
wxString wxStringProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
wxString s = m_value.GetString();
|
wxString s = value.GetString();
|
||||||
|
|
||||||
if ( GetChildCount() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
|
if ( GetChildCount() && HasFlag(wxPG_PROP_COMPOSED_VALUE) )
|
||||||
{
|
{
|
||||||
// Value stored in m_value is non-editable, non-full value
|
// Value stored in m_value is non-editable, non-full value
|
||||||
if ( (argFlags & wxPG_FULL_VALUE) || (argFlags & wxPG_EDITABLE_VALUE) )
|
if ( (argFlags & wxPG_FULL_VALUE) || (argFlags & wxPG_EDITABLE_VALUE) )
|
||||||
|
{
|
||||||
|
// Calling this under incorrect conditions will fail
|
||||||
|
wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT,
|
||||||
|
"Sorry, currently default wxPGProperty::ValueToString() "
|
||||||
|
"implementation only works if value is m_value." );
|
||||||
|
|
||||||
GenerateComposedValue(s, argFlags);
|
GenerateComposedValue(s, argFlags);
|
||||||
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@@ -154,16 +162,17 @@ wxIntProperty::wxIntProperty( const wxString& label, const wxString& name,
|
|||||||
|
|
||||||
wxIntProperty::~wxIntProperty() { }
|
wxIntProperty::~wxIntProperty() { }
|
||||||
|
|
||||||
wxString wxIntProperty::GetValueAsString( int ) const
|
wxString wxIntProperty::ValueToString( wxVariant& value,
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
if ( m_value.GetType() == wxPG_VARIANT_TYPE_LONG )
|
if ( value.GetType() == wxPG_VARIANT_TYPE_LONG )
|
||||||
{
|
{
|
||||||
return wxString::Format(wxS("%li"),m_value.GetLong());
|
return wxString::Format(wxS("%li"),value.GetLong());
|
||||||
}
|
}
|
||||||
else if ( m_value.GetType() == wxLongLong_VariantType )
|
else if ( value.GetType() == wxLongLong_VariantType )
|
||||||
{
|
{
|
||||||
wxLongLong ll;
|
wxLongLong ll;
|
||||||
ll << m_value;
|
ll << value;
|
||||||
return ll.ToString();
|
return ll.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,19 +397,20 @@ wxUIntProperty::wxUIntProperty( const wxString& label, const wxString& name,
|
|||||||
|
|
||||||
wxUIntProperty::~wxUIntProperty() { }
|
wxUIntProperty::~wxUIntProperty() { }
|
||||||
|
|
||||||
wxString wxUIntProperty::GetValueAsString( int ) const
|
wxString wxUIntProperty::ValueToString( wxVariant& value,
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
size_t index = m_base + m_prefix;
|
size_t index = m_base + m_prefix;
|
||||||
if ( index >= wxPG_UINT_TEMPLATE_MAX )
|
if ( index >= wxPG_UINT_TEMPLATE_MAX )
|
||||||
index = wxPG_BASE_DEC;
|
index = wxPG_BASE_DEC;
|
||||||
|
|
||||||
if ( m_value.GetType() == wxPG_VARIANT_TYPE_LONG )
|
if ( value.GetType() == wxPG_VARIANT_TYPE_LONG )
|
||||||
{
|
{
|
||||||
return wxString::Format(gs_uintTemplates32[index], (unsigned long)m_value.GetLong());
|
return wxString::Format(gs_uintTemplates32[index], (unsigned long)value.GetLong());
|
||||||
}
|
}
|
||||||
|
|
||||||
wxULongLong ull;
|
wxULongLong ull;
|
||||||
ull << m_value;
|
ull << value;
|
||||||
|
|
||||||
return wxString::Format(gs_uintTemplates64[index], ull.GetValue());
|
return wxString::Format(gs_uintTemplates64[index], ull.GetValue());
|
||||||
}
|
}
|
||||||
@@ -612,13 +622,14 @@ void wxPropertyGrid::DoubleToString(wxString& target,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFloatProperty::GetValueAsString( int argFlags ) const
|
wxString wxFloatProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
if ( !m_value.IsNull() )
|
if ( !value.IsNull() )
|
||||||
{
|
{
|
||||||
wxPropertyGrid::DoubleToString(text,
|
wxPropertyGrid::DoubleToString(text,
|
||||||
m_value,
|
value,
|
||||||
m_precision,
|
m_precision,
|
||||||
!(argFlags & wxPG_FULL_VALUE),
|
!(argFlags & wxPG_FULL_VALUE),
|
||||||
(wxString*) NULL);
|
(wxString*) NULL);
|
||||||
@@ -766,15 +777,16 @@ wxBoolProperty::wxBoolProperty( const wxString& label, const wxString& name, boo
|
|||||||
|
|
||||||
wxBoolProperty::~wxBoolProperty() { }
|
wxBoolProperty::~wxBoolProperty() { }
|
||||||
|
|
||||||
wxString wxBoolProperty::GetValueAsString( int argFlags ) const
|
wxString wxBoolProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
{
|
{
|
||||||
bool value = m_value.GetBool();
|
bool boolValue = value.GetBool();
|
||||||
|
|
||||||
// As a fragment of composite string value,
|
// As a fragment of composite string value,
|
||||||
// make it a little more readable.
|
// make it a little more readable.
|
||||||
if ( argFlags & wxPG_COMPOSITE_FRAGMENT )
|
if ( argFlags & wxPG_COMPOSITE_FRAGMENT )
|
||||||
{
|
{
|
||||||
if ( value )
|
if ( boolValue )
|
||||||
{
|
{
|
||||||
return m_label;
|
return m_label;
|
||||||
}
|
}
|
||||||
@@ -795,12 +807,12 @@ wxString wxBoolProperty::GetValueAsString( int argFlags ) const
|
|||||||
|
|
||||||
if ( !(argFlags & wxPG_FULL_VALUE) )
|
if ( !(argFlags & wxPG_FULL_VALUE) )
|
||||||
{
|
{
|
||||||
return wxPGGlobalVars->m_boolChoices[value?1:0].GetText();
|
return wxPGGlobalVars->m_boolChoices[boolValue?1:0].GetText();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
if (value) text = wxS("true");
|
if ( boolValue ) text = wxS("true");
|
||||||
else text = wxS("false");
|
else text = wxS("false");
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
@@ -915,20 +927,17 @@ bool wxBaseEnumProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& WX
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxBaseEnumProperty::GetValueAsString( int ) const
|
wxString wxBaseEnumProperty::ValueToString( wxVariant& value,
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
if ( m_value.GetType() == wxPG_VARIANT_TYPE_STRING )
|
if ( value.GetType() == wxPG_VARIANT_TYPE_STRING )
|
||||||
return m_value.GetString();
|
return value.GetString();
|
||||||
|
|
||||||
if ( m_index >= 0 )
|
int index = m_choices.Index(value.GetLong());
|
||||||
{
|
if ( index < 0 )
|
||||||
int unusedVal;
|
|
||||||
const wxString* pstr = GetEntry( m_index, &unusedVal );
|
|
||||||
|
|
||||||
if ( pstr )
|
|
||||||
return *pstr;
|
|
||||||
}
|
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
|
return m_choices.GetLabel(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBaseEnumProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
|
bool wxBaseEnumProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
|
||||||
@@ -1407,14 +1416,15 @@ void wxFlagsProperty::OnSetValue()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFlagsProperty::GetValueAsString( int ) const
|
wxString wxFlagsProperty::ValueToString( wxVariant& value,
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
if ( !m_choices.IsOk() )
|
if ( !m_choices.IsOk() )
|
||||||
return text;
|
return text;
|
||||||
|
|
||||||
long flags = m_value;
|
long flags = value;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
const wxPGChoices& choices = m_choices;
|
const wxPGChoices& choices = m_choices;
|
||||||
|
|
||||||
@@ -1602,7 +1612,8 @@ bool wxPGFileDialogAdapter::DoShowDialog( wxPropertyGrid* propGrid, wxPGProperty
|
|||||||
if ( property->IsKindOf(CLASSINFO(wxFileProperty)) )
|
if ( property->IsKindOf(CLASSINFO(wxFileProperty)) )
|
||||||
{
|
{
|
||||||
fileProp = ((wxFileProperty*)property);
|
fileProp = ((wxFileProperty*)property);
|
||||||
path = fileProp->m_filename.GetPath();
|
wxFileName filename = fileProp->GetValue().GetString();
|
||||||
|
path = filename.GetPath();
|
||||||
indFilter = fileProp->m_indFilter;
|
indFilter = fileProp->m_indFilter;
|
||||||
|
|
||||||
if ( !path.length() && fileProp->m_basePath.length() )
|
if ( !path.length() && fileProp->m_basePath.length() )
|
||||||
@@ -1688,18 +1699,17 @@ void wxFileProperty::OnSetValue()
|
|||||||
{
|
{
|
||||||
const wxString& fnstr = m_value.GetString();
|
const wxString& fnstr = m_value.GetString();
|
||||||
|
|
||||||
m_filename = fnstr;
|
wxFileName filename = fnstr;
|
||||||
|
|
||||||
if ( !m_filename.HasName() )
|
if ( !filename.HasName() )
|
||||||
{
|
{
|
||||||
m_value = wxPGVariant_EmptyString;
|
m_value = wxPGVariant_EmptyString;
|
||||||
m_filename.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find index for extension.
|
// Find index for extension.
|
||||||
if ( m_indFilter < 0 && fnstr.length() )
|
if ( m_indFilter < 0 && fnstr.length() )
|
||||||
{
|
{
|
||||||
wxString ext = m_filename.GetExt();
|
wxString ext = filename.GetExt();
|
||||||
int curind = 0;
|
int curind = 0;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
size_t len = m_wildcard.length();
|
size_t len = m_wildcard.length();
|
||||||
@@ -1736,29 +1746,44 @@ void wxFileProperty::OnSetValue()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFileProperty::GetValueAsString( int argFlags ) const
|
wxFileName wxFileProperty::GetFileName() const
|
||||||
{
|
{
|
||||||
// Always return empty string when name component is empty
|
wxFileName filename;
|
||||||
wxString fullName = m_filename.GetFullName();
|
|
||||||
|
if ( !m_value.IsNull() )
|
||||||
|
filename = m_value.GetString();
|
||||||
|
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxFileProperty::ValueToString( wxVariant& value,
|
||||||
|
int argFlags ) const
|
||||||
|
{
|
||||||
|
wxFileName filename = value.GetString();
|
||||||
|
|
||||||
|
if ( !filename.HasName() )
|
||||||
|
return wxEmptyString;
|
||||||
|
|
||||||
|
wxString fullName = filename.GetFullName();
|
||||||
if ( !fullName.length() )
|
if ( !fullName.length() )
|
||||||
return fullName;
|
return wxEmptyString;
|
||||||
|
|
||||||
if ( argFlags & wxPG_FULL_VALUE )
|
if ( argFlags & wxPG_FULL_VALUE )
|
||||||
{
|
{
|
||||||
return m_filename.GetFullPath();
|
return filename.GetFullPath();
|
||||||
}
|
}
|
||||||
else if ( m_flags & wxPG_PROP_SHOW_FULL_FILENAME )
|
else if ( m_flags & wxPG_PROP_SHOW_FULL_FILENAME )
|
||||||
{
|
{
|
||||||
if ( m_basePath.Length() )
|
if ( m_basePath.Length() )
|
||||||
{
|
{
|
||||||
wxFileName fn2(m_filename);
|
wxFileName fn2(filename);
|
||||||
fn2.MakeRelativeTo(m_basePath);
|
fn2.MakeRelativeTo(m_basePath);
|
||||||
return fn2.GetFullPath();
|
return fn2.GetFullPath();
|
||||||
}
|
}
|
||||||
return m_filename.GetFullPath();
|
return filename.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_filename.GetFullName();
|
return filename.GetFullName();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPGEditorDialogAdapter* wxFileProperty::GetEditorDialog() const
|
wxPGEditorDialogAdapter* wxFileProperty::GetEditorDialog() const
|
||||||
@@ -1768,9 +1793,11 @@ wxPGEditorDialogAdapter* wxFileProperty::GetEditorDialog() const
|
|||||||
|
|
||||||
bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
|
bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const
|
||||||
{
|
{
|
||||||
|
wxFileName filename = variant.GetString();
|
||||||
|
|
||||||
if ( (m_flags & wxPG_PROP_SHOW_FULL_FILENAME) || (argFlags & wxPG_FULL_VALUE) )
|
if ( (m_flags & wxPG_PROP_SHOW_FULL_FILENAME) || (argFlags & wxPG_FULL_VALUE) )
|
||||||
{
|
{
|
||||||
if ( m_filename != text )
|
if ( filename != text )
|
||||||
{
|
{
|
||||||
variant = text;
|
variant = text;
|
||||||
return true;
|
return true;
|
||||||
@@ -1778,9 +1805,9 @@ bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, in
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_filename.GetFullName() != text )
|
if ( filename.GetFullName() != text )
|
||||||
{
|
{
|
||||||
wxFileName fn = m_filename;
|
wxFileName fn = filename;
|
||||||
fn.SetFullName(text);
|
fn.SetFullName(text);
|
||||||
variant = fn.GetFullPath();
|
variant = fn.GetFullPath();
|
||||||
return true;
|
return true;
|
||||||
@@ -1873,9 +1900,10 @@ wxLongStringProperty::wxLongStringProperty( const wxString& label, const wxStrin
|
|||||||
|
|
||||||
wxLongStringProperty::~wxLongStringProperty() {}
|
wxLongStringProperty::~wxLongStringProperty() {}
|
||||||
|
|
||||||
wxString wxLongStringProperty::GetValueAsString( int ) const
|
wxString wxLongStringProperty::ValueToString( wxVariant& value,
|
||||||
|
int WXUNUSED(argFlags) ) const
|
||||||
{
|
{
|
||||||
return m_value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxLongStringProperty::OnEvent( wxPropertyGrid* propGrid, wxWindow* WXUNUSED(primary),
|
bool wxLongStringProperty::OnEvent( wxPropertyGrid* propGrid, wxWindow* WXUNUSED(primary),
|
||||||
@@ -2396,11 +2424,25 @@ void wxArrayStringProperty::OnSetValue()
|
|||||||
GenerateValueAsString();
|
GenerateValueAsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxArrayStringProperty::GetValueAsString( int WXUNUSED(argFlags) ) const
|
#define ARRSTRPROP_ARRAY_TO_STRING(STRING,ARRAY) \
|
||||||
|
wxPropertyGrid::ArrayStringToString(STRING,ARRAY,wxS('"'),wxS('"'),1)
|
||||||
|
|
||||||
|
wxString wxArrayStringProperty::ValueToString( wxVariant& WXUNUSED(value),
|
||||||
|
int argFlags ) const
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// If this is called from GetValueAsString(), return cached string
|
||||||
|
if ( argFlags & wxPG_VALUE_IS_CURRENT )
|
||||||
{
|
{
|
||||||
return m_display;
|
return m_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxArrayString arr = m_value.GetArrayString();
|
||||||
|
wxString s;
|
||||||
|
ARRSTRPROP_ARRAY_TO_STRING(s, arr);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
// Converts wxArrayString to a string separated by delimeters and spaces.
|
// Converts wxArrayString to a string separated by delimeters and spaces.
|
||||||
// preDelim is useful for "str1" "str2" style. Set flags to 1 to do slash
|
// preDelim is useful for "str1" "str2" style. Set flags to 1 to do slash
|
||||||
// conversion.
|
// conversion.
|
||||||
@@ -2461,13 +2503,10 @@ void wxPropertyGrid::ArrayStringToString( wxString& dst, const wxArrayString& sr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ARRSTRPROP_ARRAY_TO_STRING(STRING,ARRAY) \
|
|
||||||
wxPropertyGrid::ArrayStringToString(STRING,ARRAY,wxS('"'),wxS('"'),1);
|
|
||||||
|
|
||||||
void wxArrayStringProperty::GenerateValueAsString()
|
void wxArrayStringProperty::GenerateValueAsString()
|
||||||
{
|
{
|
||||||
wxArrayString arr = m_value.GetArrayString();
|
wxArrayString arr = m_value.GetArrayString();
|
||||||
ARRSTRPROP_ARRAY_TO_STRING(m_display, arr)
|
ARRSTRPROP_ARRAY_TO_STRING(m_display, arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default implementation doesn't do anything.
|
// Default implementation doesn't do anything.
|
||||||
@@ -2525,7 +2564,7 @@ bool wxArrayStringProperty::OnButtonClick( wxPropertyGrid* propGrid,
|
|||||||
{
|
{
|
||||||
wxArrayString actualValue = value.GetArrayString();
|
wxArrayString actualValue = value.GetArrayString();
|
||||||
wxString tempStr;
|
wxString tempStr;
|
||||||
ARRSTRPROP_ARRAY_TO_STRING(tempStr, actualValue)
|
ARRSTRPROP_ARRAY_TO_STRING(tempStr, actualValue);
|
||||||
#if wxUSE_VALIDATORS
|
#if wxUSE_VALIDATORS
|
||||||
if ( dialogValidator.DoValidate( propGrid, validator, tempStr ) )
|
if ( dialogValidator.DoValidate( propGrid, validator, tempStr ) )
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user