Use enum class to implement wxPGPropValFormatFlags as bitmask

This is for better type safety of the flags.
This commit is contained in:
Artur Wieczorek 2024-01-06 17:26:12 +01:00
parent 031435bd39
commit ca3acd7a03
21 changed files with 1155 additions and 431 deletions

View file

@ -136,7 +136,16 @@ public:
const wxFont& value = wxFont()); const wxFont& value = wxFont());
virtual ~wxFontProperty() = default; virtual ~wxFontProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ValueToString(wxVariant& value, int flags) const override
{
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxVariant ChildChanged( wxVariant& thisValue, virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex, int childIndex,
wxVariant& childValue ) const override; wxVariant& childValue ) const override;
@ -168,23 +177,60 @@ public:
virtual ~wxSystemColourProperty() = default; virtual ~wxSystemColourProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual bool IntToValue(wxVariant& variant, #if WXWIN_COMPATIBILITY_3_2
int number, wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
int argFlags = 0) const override; virtual bool IntToValue(wxVariant& variant, int number,
int flags) const override
{
m_oldIntToValueCalled = true;
return IntToValue(variant, number, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool IntToValue(wxVariant& variant, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
// Override in derived class to customize how colours are printed as // Override in derived class to customize how colours are printed as
// strings. // strings.
virtual wxString ColourToString( const wxColour& col, int index, #if WXWIN_COMPATIBILITY_3_2
int argFlags = 0 ) const; mutable bool m_oldColourToStringCalled = false;
wxString ColourToStringWithCheck(const wxColour& col, int index,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use ColourToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ColourToString(const wxColour& col, int index,
int flags) const
{
m_oldColourToStringCalled = true;
return ColourToString(col, index, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ColourToString(const wxColour& col, int index,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Returns index of entry that triggers colour picker dialog // Returns index of entry that triggers colour picker dialog
// (default is last). // (default is last).
virtual int GetCustomColourIndex() const; virtual int GetCustomColourIndex() const;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool OnEvent( wxPropertyGrid* propgrid, virtual bool OnEvent( wxPropertyGrid* propgrid,
wxWindow* primary, wxEvent& event ) override; wxWindow* primary, wxEvent& event ) override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
@ -240,7 +286,16 @@ public:
const wxColour& value = *wxWHITE ); const wxColour& value = *wxWHITE );
virtual ~wxColourProperty() = default; virtual ~wxColourProperty() = default;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ValueToString(wxVariant& value, int flags) const override
{
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxColour GetColour( int index ) const override; virtual wxColour GetColour( int index ) const override;
protected: protected:
@ -262,7 +317,16 @@ class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty
int value = 0 ); int value = 0 );
virtual ~wxCursorProperty() = default; virtual ~wxCursorProperty() = default;
virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const override; #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ValueToString(wxVariant& value, int flags) const override
{
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxSize OnMeasureImage( int item ) const override; virtual wxSize OnMeasureImage( int item ) const override;
virtual void OnCustomPaint( wxDC& dc, virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect, wxPGPaintData& paintdata ) override; const wxRect& rect, wxPGPaintData& paintdata ) override;
@ -332,10 +396,27 @@ public:
virtual ~wxMultiChoiceProperty() = default; virtual ~wxMultiChoiceProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
wxArrayInt GetValueAsArrayInt() const wxArrayInt GetValueAsArrayInt() const
@ -382,10 +463,27 @@ public:
virtual ~wxDateProperty() = default; virtual ~wxDateProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;

View file

@ -1088,9 +1088,9 @@ public:
// null wxVariant in normal cases). Translated value must be assigned // null wxVariant in normal cases). Translated value must be assigned
// back to it. // back to it.
// text - Text to be translated into variant. // text - Text to be translated into variant.
// argFlags - If wxPG_FULL_VALUE is set, returns complete, storable value instead // flags - If wxPGPropValFormatFlags::FullValue 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 wxPGPropValFormatFlags::CompositeFragment is set, text is interpreted as a part of
// composite property string value (as generated by ValueToString() // composite property string value (as generated by ValueToString()
// called with this same flag). // called with this same flag).
// Returns true if resulting wxVariant value was different. // Returns true if resulting wxVariant value was different.
@ -1099,9 +1099,19 @@ public:
// You might want to take into account that m_value is Null variant // You might want to take into account that m_value is Null variant
// if property value is unspecified (which is usually only case if // if property value is unspecified (which is usually only case if
// you explicitly enabled that sort behaviour). // you explicitly enabled that sort behaviour).
virtual bool StringToValue( wxVariant& variant, #if WXWIN_COMPATIBILITY_3_2
const wxString& text, mutable bool m_oldStringToValueCalled = false;
int argFlags = 0 ) const; bool StringToValueWithCheck(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue( wxVariant& variant, const wxString& text,
int flags ) const
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Converts integer (possibly a choice selection) into wxVariant value // Converts integer (possibly a choice selection) into wxVariant value
// appropriate for this property. // appropriate for this property.
@ -1109,7 +1119,7 @@ public:
// variant - On function entry this is the old value (should not be null wxVariant // variant - On function entry this is the old value (should not be null wxVariant
// in normal cases). Translated value must be assigned back to it. // in normal cases). Translated value must be assigned back to it.
// number - Integer to be translated into variant. // number - Integer to be translated into variant.
// argFlags - If wxPG_FULL_VALUE is set, returns complete, storable value // flags - If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value
// instead of displayable one. // instead of displayable one.
// Returns true if resulting wxVariant value was different. // Returns true if resulting wxVariant value was different.
// Remarks // Remarks
@ -1122,36 +1132,69 @@ public:
// - You might want to take into account that m_value is Null variant // - You might want to take into account that m_value is Null variant
// if property value is unspecified (which is usually only case if // if property value is unspecified (which is usually only case if
// you explicitly enabled that sort behaviour). // you explicitly enabled that sort behaviour).
virtual bool IntToValue( wxVariant& value, #if WXWIN_COMPATIBILITY_3_2
int number, mutable bool m_oldIntToValueCalled = false;
int argFlags = 0 ) const; bool IntToValueWithCheck(wxVariant& variant, int number, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool IntToValue(wxVariant& value, int number, int flags) const
{
m_oldIntToValueCalled = true;
return IntToValue(value, number, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool IntToValue(wxVariant& value, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Converts property value into a text representation. // Converts property value into a text representation.
// Parameters: // Parameters:
// value - Value to be converted. // value - Value to be converted.
// argFlags - If 0 (default value), then displayed string is returned. // flags - If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
// If wxPG_FULL_VALUE is set, returns complete, storable string value // If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
// instead of displayable. If wxPG_EDITABLE_VALUE is set, returns // instead of displayable. If wxPGPropValFormatFlags::EditableValue 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 // wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
// display as a part of string property's composite text // display as a part of string property's composite text
// representation. // representation.
// Default implementation calls GenerateComposedValue(). // Default implementation calls GenerateComposedValue().
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; #if WXWIN_COMPATIBILITY_3_2
mutable bool m_oldValueToStringCalled = false;
wxString ValueToStringWithCheck(wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ValueToString(wxVariant& value, int flags) const
{
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) 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 behaviour is to do nothing. // Default behaviour is to do nothing.
// Returns true if value was changed. // Returns true if value was changed.
bool SetValueFromString( const wxString& text, int flags = wxPG_PROGRAMMATIC_VALUE ); #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetValueFromString with 'flags' argument as wxPGPropValFormatFlags")
bool SetValueFromString(const wxString& text, int flags)
{
return SetValueFromString(text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool SetValueFromString(const wxString& text, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ProgrammaticValue);
// Converts integer to a value, and if successful, calls SetValue() on it. // Converts integer to a value, and if successful, calls SetValue() on it.
// Default behaviour is to do nothing. // Default behaviour is to do nothing.
// Parameters: // Parameters:
// value - Int to get the value from. // value - Int to get the value from.
// flags - If has wxPG_FULL_VALUE, then the value given is a actual value // flags - If has wxPGPropValFormatFlags::FullValue, then the value given is a actual value
// and not an index. // and not an index.
// Returns true if value was changed. // Returns true if value was changed.
bool SetValueFromInt( long value, int flags = 0 ); #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetValueFromInt with 'flags' argument as wxPGPropValFormatFlags")
bool SetValueFromInt(long value, int flags)
{
return SetValueFromInt(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool SetValueFromInt(long value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null);
// Returns size of the custom painted image in front of property. // Returns size of the custom painted image in front of property.
// This method must be overridden to return non-default value if // This method must be overridden to return non-default value if
@ -1382,18 +1425,28 @@ public:
} }
// Returns text representation of property's value. // Returns text representation of property's value.
// argFlags - If 0 (default value), then displayed string is returned. // flags - If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
// If wxPG_FULL_VALUE is set, returns complete, storable string value // If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
// instead of displayable. If wxPG_EDITABLE_VALUE is set, returns // instead of displayable. If wxPGPropValFormatFlags::EditableValue 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 // wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
// display as a part of string property's composite text // display as a part of string property's composite text
// representation. // representation.
// In older versions, this function used to be overridden to convert // In older versions, this function used to be overridden to convert
// property's value into a string representation. This function is // property's value into a string representation. This function is
// now handled by ValueToString(), and overriding this function now // now handled by ValueToString(), and overriding this function now
// will result in run-time assertion failure. // will result in run-time assertion failure.
virtual wxString GetValueAsString( int argFlags = 0 ) const; #if WXWIN_COMPATIBILITY_3_2
mutable bool m_oldGetValueAsString = false;
wxString GetValueAsStringWithCheck(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxDEPRECATED_BUT_USED_INTERNALLY_MSG("use GetValueAsString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString GetValueAsString(int flags) const
{
m_oldGetValueAsString = true;
return GetValueAsString(static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Returns wxPGCell of given column. // Returns wxPGCell of given column.
// Const version of this member function returns 'default' // Const version of this member function returns 'default'
@ -1416,7 +1469,12 @@ public:
// Returns property's displayed text. // Returns property's displayed text.
wxString GetDisplayedString() const wxString GetDisplayedString() const
{ {
return GetValueAsString(0); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
return GetValueAsStringWithCheck(wxPGPropValFormatFlags::Null);
#else
return GetValueAsString(wxPGPropValFormatFlags::Null);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
// Returns property's hint text (shown in empty value cell). // Returns property's hint text (shown in empty value cell).
@ -2087,10 +2145,20 @@ protected:
int index = -1, int index = -1,
bool correct_mode = true ); bool correct_mode = true );
void DoGenerateComposedValue( wxString& text, #if WXWIN_COMPATIBILITY_3_2
int argFlags = wxPG_VALUE_IS_CURRENT, wxDEPRECATED_MSG("use DoGenerateComposedValue with 'flags' argument as wxPGPropValFormatFlags")
const wxVariantList* valueOverrides = nullptr, void DoGenerateComposedValue(wxString& text, int flags,
wxPGHashMapS2S* childResults = nullptr ) const; const wxVariantList* valueOverrides,
wxPGHashMapS2S* childResults) const
{
DoGenerateComposedValue(text, static_cast<wxPGPropValFormatFlags>(flags),
valueOverrides, childResults);
}
#endif // WXWIN_COMPATIBILITY_3_2
void DoGenerateComposedValue(wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ValueIsCurrent,
const wxVariantList* valueOverrides = nullptr,
wxPGHashMapS2S* childResults = nullptr) const;
bool DoHide( bool hide, wxPGPropertyValuesFlags flags ); bool DoHide( bool hide, wxPGPropertyValuesFlags flags );
@ -2266,10 +2334,17 @@ public:
wxPGRootProperty( const wxString& name = wxS("<Root>") ); wxPGRootProperty( const wxString& name = wxS("<Root>") );
virtual ~wxPGRootProperty() = default; virtual ~wxPGRootProperty() = default;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue( wxVariant&, const wxString&, int ) const override virtual bool StringToValue( wxVariant&, const wxString&, int ) const override
{ {
return false; return false;
} }
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant&, const wxString&, wxPGPropValFormatFlags ) const override
{
return false;
}
protected: protected:
}; };
@ -2292,8 +2367,24 @@ public:
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const; int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
virtual wxString ValueToString( wxVariant& value, int argFlags ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual wxString GetValueAsString( int argFlags = 0 ) const override; wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ValueToString(wxVariant& value, int flags) const override
{
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use GetValueAsString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString GetValueAsString(int flags) const override
{
m_oldGetValueAsString = true;
return GetValueAsString(static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
protected: protected:
void SetTextColIndex( unsigned int colInd ) void SetTextColIndex( unsigned int colInd )

View file

@ -1032,8 +1032,15 @@ public:
// Returns (visual) text representation of the unspecified // Returns (visual) text representation of the unspecified
// property value. // property value.
// argFlags - For internal use only. // flags - For internal use only.
wxString GetUnspecifiedValueText( int argFlags = 0 ) const; #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use GetUnspecifiedValueText with 'flags' argument as wxPGPropValFormatFlags")
wxString GetUnspecifiedValueText(int flags) const
{
return GetUnspecifiedValueText(static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
wxString GetUnspecifiedValueText(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// Set virtual width for this particular page. Width -1 indicates that the // Set virtual width for this particular page. Width -1 indicates that the
// virtual width should be disabled. // virtual width should be disabled.

View file

@ -212,36 +212,93 @@ constexpr bool operator!=(wxPGPropertyValuesFlags a, int b)
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// Misc. argument flags. // Miscellaneous property value format flags
enum wxPG_MISC_ARG_FLAGS enum class wxPGPropValFormatFlags : int
{ {
// No flags.
Null = 0,
// Get/Store full value instead of displayed value. // Get/Store full value instead of displayed value.
wxPG_FULL_VALUE = 0x00000001, FullValue = 0x00000001,
// Perform special action in case of unsuccessful conversion. // Perform special action in case of unsuccessful conversion.
wxPG_REPORT_ERROR = 0x00000002, ReportError = 0x00000002,
wxPG_PROPERTY_SPECIFIC = 0x00000004, PropertySpecific = 0x00000004,
// Get/Store editable value instead of displayed one (should only be // Get/Store editable value instead of displayed one (should only be
// different in the case of common values) // different in the case of common values)
wxPG_EDITABLE_VALUE = 0x00000008, EditableValue = 0x00000008,
// Used when dealing with fragments of composite string value // Used when dealing with fragments of composite string value
wxPG_COMPOSITE_FRAGMENT = 0x00000010, CompositeFragment = 0x00000010,
// Means property for which final string value is for cannot really be // Means property for which final string value is for cannot really be
// edited. // edited.
wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020, UneditableCompositeFragment = 0x00000020,
// ValueToString() called from GetValueAsString() // ValueToString() called from GetValueAsString()
// (guarantees that input wxVariant value is current own value) // (guarantees that input wxVariant value is current own value)
wxPG_VALUE_IS_CURRENT = 0x00000040, ValueIsCurrent = 0x00000040,
// Value is being set programmatically (i.e. not by user) // Value is being set programmatically (i.e. not by user)
wxPG_PROGRAMMATIC_VALUE = 0x00000080 ProgrammaticValue = 0x00000080
}; };
constexpr wxPGPropValFormatFlags operator&(wxPGPropValFormatFlags a, wxPGPropValFormatFlags b)
{
return static_cast<wxPGPropValFormatFlags>(static_cast<int>(a) & static_cast<int>(b));
}
constexpr wxPGPropValFormatFlags operator|(wxPGPropValFormatFlags a, wxPGPropValFormatFlags b)
{
return static_cast<wxPGPropValFormatFlags>(static_cast<int>(a) | static_cast<int>(b));
}
inline wxPGPropValFormatFlags operator|=(wxPGPropValFormatFlags& a, wxPGPropValFormatFlags b)
{
return a = a | b;
}
constexpr bool operator!(wxPGPropValFormatFlags a)
{
return static_cast<int>(a) == 0;
}
#if WXWIN_COMPATIBILITY_3_2
constexpr int operator&(int a, wxPGPropValFormatFlags b)
{
return a & static_cast<int>(b);
}
constexpr int operator|(int a, wxPGPropValFormatFlags b)
{
return a | static_cast<int>(b);
}
inline int operator|=(int& a, wxPGPropValFormatFlags b)
{
return a = a | static_cast<int>(b);
}
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::FullValue instead")
constexpr wxPGPropValFormatFlags wxPG_FULL_VALUE { wxPGPropValFormatFlags::FullValue };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::ReportError instead")
constexpr wxPGPropValFormatFlags wxPG_REPORT_ERROR { wxPGPropValFormatFlags::ReportError };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::PropertySpecific instead")
constexpr wxPGPropValFormatFlags wxPG_PROPERTY_SPECIFIC { wxPGPropValFormatFlags::PropertySpecific };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::EditableValue instead")
constexpr wxPGPropValFormatFlags wxPG_EDITABLE_VALUE { wxPGPropValFormatFlags::EditableValue };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::CompositeFragment instead")
constexpr wxPGPropValFormatFlags wxPG_COMPOSITE_FRAGMENT { wxPGPropValFormatFlags::CompositeFragment };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::UneditableCompositeFragment instead")
constexpr wxPGPropValFormatFlags wxPG_UNEDITABLE_COMPOSITE_FRAGMENT { wxPGPropValFormatFlags::UneditableCompositeFragment };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::ValueIsCurrent instead")
constexpr wxPGPropValFormatFlags wxPG_VALUE_IS_CURRENT { wxPGPropValFormatFlags::ValueIsCurrent };
wxDEPRECATED_MSG("use wxPGPropValFormatFlags::ProgrammaticValue instead")
constexpr wxPGPropValFormatFlags wxPG_PROGRAMMATIC_VALUE { wxPGPropValFormatFlags::ProgrammaticValue };
#endif // WXWIN_COMPATIBILITY_3_2
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// wxPGProperty::SetValue() flags // wxPGProperty::SetValue() flags

View file

@ -797,22 +797,22 @@ public:
// Sets an attribute for this property. // Sets an attribute for this property.
// name - Text identifier of attribute. See @ref propgrid_property_attributes. // name - Text identifier of attribute. See @ref propgrid_property_attributes.
// value - Value of attribute. // value - Value of attribute.
// argFlags - Optional. Use wxPGPropertyValuesFlags::Recurse to set the attribute to child // flags - Optional. Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
// properties recursively. // properties recursively.
// Setting attribute's value to null wxVariant will simply remove it // Setting attribute's value to null wxVariant will simply remove it
// from property's set of attributes. // from property's set of attributes.
#if WXWIN_COMPATIBILITY_3_2 #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyAttribute with argFlags argument as wxPGPropertyValuesFlags") wxDEPRECATED_MSG("use SetPropertyAttribute with 'flags' argument as wxPGPropertyValuesFlags")
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName,
wxVariant value, long argFlags) wxVariant value, long flags)
{ {
DoSetPropertyAttribute(id, attrName, value, static_cast<wxPGPropertyValuesFlags>(argFlags)); DoSetPropertyAttribute(id, attrName, value, static_cast<wxPGPropertyValuesFlags>(flags));
} }
#endif // WXWIN_COMPATIBILITY_3_2 #endif // WXWIN_COMPATIBILITY_3_2
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value, void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value,
wxPGPropertyValuesFlags argFlags = wxPGPropertyValuesFlags::DontRecurse) wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse)
{ {
DoSetPropertyAttribute(id, attrName, value, argFlags); DoSetPropertyAttribute(id, attrName, value, flags);
} }
// Sets property attribute for all applicable properties. // Sets property attribute for all applicable properties.
// Be sure to use this method only after all properties have been // Be sure to use this method only after all properties have been
@ -1236,7 +1236,7 @@ protected:
// Intermediate version needed due to wxVariant copying inefficiency // Intermediate version needed due to wxVariant copying inefficiency
void DoSetPropertyAttribute( wxPGPropArg id, void DoSetPropertyAttribute( wxPGPropArg id,
const wxString& name, const wxString& name,
wxVariant& value, wxPGPropertyValuesFlags argFlags ); wxVariant& value, wxPGPropertyValuesFlags flags );
// Empty string object to return from member functions returning const // Empty string object to return from member functions returning const
// wxString&. // wxString&.

View file

@ -99,10 +99,28 @@ public:
const wxString& value = wxString() ); const wxString& value = wxString() );
virtual ~wxStringProperty() = default; virtual ~wxStringProperty() = default;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue( wxVariant& variant, const wxString& text,
int flags ) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
@ -194,15 +212,39 @@ public:
const wxString& name, const wxString& name,
const wxLongLong& value ); const wxLongLong& value );
#endif #endif
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const override; wxPGValidationInfo& validationInfo ) const override;
virtual bool IntToValue( wxVariant& variant, #if WXWIN_COMPATIBILITY_3_2
int number, wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
int argFlags = 0 ) const override; virtual bool IntToValue(wxVariant& variant, int number, int flags) const override
{
m_oldIntToValueCalled = true;
return IntToValue(variant, number, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool IntToValue(wxVariant& variant, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
static wxValidator* GetClassValidator(); static wxValidator* GetClassValidator();
virtual wxValidator* DoGetValidator() const override; virtual wxValidator* DoGetValidator() const override;
virtual wxVariant AddSpinStepValue(long stepScale) const override; virtual wxVariant AddSpinStepValue(long stepScale) const override;
@ -240,17 +282,42 @@ public:
const wxString& name, const wxString& name,
const wxULongLong& value ); const wxULongLong& value );
#endif #endif
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const override; wxPGValidationInfo& validationInfo ) const override;
virtual wxValidator* DoGetValidator () const override; virtual wxValidator* DoGetValidator () const override;
virtual bool IntToValue( wxVariant& variant, #if WXWIN_COMPATIBILITY_3_2
int number, wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
int argFlags = 0 ) const override; virtual bool IntToValue(wxVariant& variant, int number,
int flags) const override
{
m_oldIntToValueCalled = true;
return IntToValue(variant, number, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool IntToValue(wxVariant& variant, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual wxVariant AddSpinStepValue(long stepScale) const override; virtual wxVariant AddSpinStepValue(long stepScale) const override;
protected: protected:
@ -285,10 +352,27 @@ public:
double value = 0.0 ); double value = 0.0 );
virtual ~wxFloatProperty() = default; virtual ~wxFloatProperty() = default;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
@ -321,12 +405,37 @@ public:
bool value = false ); bool value = false );
virtual ~wxBoolProperty() = default; virtual ~wxBoolProperty() = default;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
virtual bool IntToValue( wxVariant& variant, m_oldValueToStringCalled = true;
int number, int argFlags = 0 ) const override; return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool IntToValue(wxVariant& variant, int number, int flags) const override
{
m_oldIntToValueCalled = true;
return IntToValue(variant, number, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool IntToValue(wxVariant& variant, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
}; };
@ -387,18 +496,41 @@ public:
size_t GetItemCount() const { return m_choices.GetCount(); } size_t GetItemCount() const { return m_choices.GetCount(); }
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const override; wxPGValidationInfo& validationInfo ) const override;
// If wxPG_FULL_VALUE is not set in flags, then the value is interpreted // If wxPGPropValFormatFlags::FullValue is not set in flags, then the value is interpreted
// as index to choices list. Otherwise, it is actual value. // as index to choices list. Otherwise, it is actual value.
virtual bool IntToValue( wxVariant& variant, #if WXWIN_COMPATIBILITY_3_2
int number, wxDEPRECATED_MSG("use IntToValue with 'flags' argument as wxPGPropValFormatFlags")
int argFlags = 0 ) const override; virtual bool IntToValue(wxVariant& variant, int number, int flags) const override
{
m_oldIntToValueCalled = true;
return IntToValue(variant, number, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool IntToValue(wxVariant& variant, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
// //
// Additional virtuals // Additional virtuals
@ -420,25 +552,38 @@ protected:
wxDEPRECATED_MSG("use ValueFromString_(wxVariant&, int*, const wxString&, int) function instead") wxDEPRECATED_MSG("use ValueFromString_(wxVariant&, int*, const wxString&, int) function instead")
bool ValueFromString_( wxVariant& value, bool ValueFromString_( wxVariant& value,
const wxString& text, const wxString& text,
int argFlags ) const int flags ) const
{ {
return ValueFromString_(value, nullptr, text, argFlags); return ValueFromString_(value, nullptr, text, static_cast<wxPGPropValFormatFlags>(flags));
} }
wxDEPRECATED_MSG("use ValueFromInt_(wxVariant&, int*, int, int) function instead") wxDEPRECATED_MSG("use ValueFromInt_(wxVariant&, int*, int, int) function instead")
bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const bool ValueFromInt_( wxVariant& value, int intVal, int flags ) const
{ {
return ValueFromInt_(value, nullptr, intVal, argFlags); return ValueFromInt_(value, nullptr, intVal, static_cast<wxPGPropValFormatFlags>(flags));
} }
wxDEPRECATED_MSG("don't use ResetNextIndex() function") wxDEPRECATED_MSG("don't use ResetNextIndex() function")
static void ResetNextIndex() { } static void ResetNextIndex() { }
#endif #endif
// Converts text to value and returns corresponding index in the collection // Converts text to value and returns corresponding index in the collection
bool ValueFromString_(wxVariant& value, #if WXWIN_COMPATIBILITY_3_2
int* pIndex, wxDEPRECATED_MSG("use ValueFromString_ with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, bool ValueFromString_(wxVariant& value, int* pIndex,
int argFlags) const; const wxString& text, int flags) const
{
return ValueFromString_(value, pIndex, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool ValueFromString_(wxVariant& value, int* pIndex,
const wxString& text, wxPGPropValFormatFlags flags) const;
// Converts number to value and returns corresponding index in the collection // Converts number to value and returns corresponding index in the collection
bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, int argFlags) const; #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueFromInt_ with 'flags' argument as wxPGPropValFormatFlags")
bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, int flags) const
{
return ValueFromInt_(value, pIndex, intVal, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal, wxPGPropValFormatFlags flags) const;
private: private:
// This is private so that classes are guaranteed to use GetIndex // This is private so that classes are guaranteed to use GetIndex
@ -482,9 +627,17 @@ public:
virtual ~wxEditEnumProperty() = default; virtual ~wxEditEnumProperty() = default;
void OnSetValue() override; void OnSetValue() override;
bool StringToValue(wxVariant& variant, #if WXWIN_COMPATIBILITY_3_2
const wxString& text, wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
int argFlags = 0) const override; bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
bool ValidateValue(wxVariant& value, bool ValidateValue(wxVariant& value,
wxPGValidationInfo& validationInfo) const override; wxPGValidationInfo& validationInfo) const override;
@ -524,10 +677,27 @@ public:
virtual ~wxFlagsProperty () = default; virtual ~wxFlagsProperty () = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int flags ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags) const override;
virtual wxVariant ChildChanged( wxVariant& thisValue, virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex, int childIndex,
wxVariant& childValue ) const override; wxVariant& childValue ) const override;
@ -597,10 +767,26 @@ public:
virtual ~wxFileProperty() = default; virtual ~wxFileProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
static wxValidator* GetClassValidator(); static wxValidator* GetClassValidator();
@ -639,10 +825,27 @@ public:
const wxString& value = wxString() ); const wxString& value = wxString() );
virtual ~wxLongStringProperty() = default; virtual ~wxLongStringProperty() = default;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
protected: protected:
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) override; virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) override;
@ -661,9 +864,27 @@ public:
const wxString& value = wxString() ); const wxString& value = wxString() );
virtual ~wxDirProperty() = default; virtual ~wxDirProperty() = default;
virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const override; #if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
virtual wxString ValueToString(wxVariant& value, int flags) const override
{
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0) const override; int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_0 #if WXWIN_COMPATIBILITY_3_0
virtual bool DoSetAttribute(const wxString& name, wxVariant& value) override; virtual bool DoSetAttribute(const wxString& name, wxVariant& value) override;
#endif // WXWIN_COMPATIBILITY_3_0 #endif // WXWIN_COMPATIBILITY_3_0
@ -686,10 +907,27 @@ public:
virtual ~wxArrayStringProperty() = default; virtual ~wxArrayStringProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue( wxVariant& variant, wxDEPRECATED_MSG("use ValueToString with 'flags' argument as wxPGPropValFormatFlags")
const wxString& text, virtual wxString ValueToString(wxVariant& value, int flags) const override
int argFlags = 0 ) const override; {
m_oldValueToStringCalled = true;
return ValueToString(value, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
#if WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use StringToValue with 'flags' argument as wxPGPropValFormatFlags")
virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags) const override
{
m_oldStringToValueCalled = true;
return StringToValue(variant, text, static_cast<wxPGPropValFormatFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
// Implement in derived class for custom array-to-string conversion. // Implement in derived class for custom array-to-string conversion.

View file

@ -77,7 +77,8 @@ public:
const wxFont& value = wxFont()); const wxFont& value = wxFont());
virtual ~wxFontProperty(); virtual ~wxFontProperty();
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxVariant ChildChanged( wxVariant& thisValue, virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex, int childIndex,
wxVariant& childValue ) const; wxVariant& childValue ) const;
@ -107,26 +108,24 @@ public:
virtual ~wxSystemColourProperty(); virtual ~wxSystemColourProperty();
virtual void OnSetValue(); virtual void OnSetValue();
virtual bool IntToValue(wxVariant& variant, virtual bool IntToValue(wxVariant& variant, int number,
int number, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
int argFlags = 0) const;
/** /** Override in derived class to customize how colours are printed as
Override in derived class to customize how colours are printed as
strings. strings.
*/ */
virtual wxString ColourToString( const wxColour& col, int index, virtual wxString ColourToString(const wxColour& col, int index,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/** Returns index of entry that triggers colour picker dialog /** Returns index of entry that triggers colour picker dialog
(default is last). (default is last).
*/ */
virtual int GetCustomColourIndex() const; virtual int GetCustomColourIndex() const;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool OnEvent( wxPropertyGrid* propgrid, virtual bool OnEvent( wxPropertyGrid* propgrid,
wxWindow* primary, wxEvent& event ); wxWindow* primary, wxEvent& event );
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
@ -134,7 +133,8 @@ public:
virtual void OnCustomPaint( wxDC& dc, virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect, wxPGPaintData& paintdata ); const wxRect& rect, wxPGPaintData& paintdata );
// Helper function to show the colour dialog /** Helper function to show the colour dialog
*/
bool QueryColourFromUser( wxVariant& variant ) const; bool QueryColourFromUser( wxVariant& variant ) const;
/** Default is to use wxSystemSettings::GetColour(index). Override to use /** Default is to use wxSystemSettings::GetColour(index). Override to use
@ -184,7 +184,8 @@ public:
const wxColour& value = *wxWHITE ); const wxColour& value = *wxWHITE );
virtual ~wxColourProperty(); virtual ~wxColourProperty();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxColour GetColour( int index ) const; virtual wxColour GetColour( int index ) const;
protected: protected:
@ -205,6 +206,8 @@ public:
int value = 0 ); int value = 0 );
virtual ~wxCursorProperty(); virtual ~wxCursorProperty();
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxSize OnMeasureImage( int item ) const; virtual wxSize OnMeasureImage( int item ) const;
virtual void OnCustomPaint( wxDC& dc, virtual void OnCustomPaint( wxDC& dc,
const wxRect& rect, wxPGPaintData& paintdata ); const wxRect& rect, wxPGPaintData& paintdata );
@ -279,10 +282,10 @@ public:
virtual ~wxMultiChoiceProperty(); virtual ~wxMultiChoiceProperty();
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue(wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
wxArrayInt GetValueAsArrayInt() const; wxArrayInt GetValueAsArrayInt() const;
@ -322,10 +325,10 @@ public:
virtual ~wxDateProperty(); virtual ~wxDateProperty();
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue(wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );

View file

@ -822,12 +822,12 @@ enum class wxPGPropertyFlags : int
} }
virtual wxString ValueToString( wxVariant& value, virtual wxString ValueToString( wxVariant& value,
int argFlags ) const int flags ) const
{ {
// TODO: Convert given property value to a string // 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 flags )
{ {
// TODO: Adapt string to property value. // TODO: Adapt string to property value.
} }
@ -909,12 +909,12 @@ public:
@param text @param text
Text to be translated into variant. Text to be translated into variant.
@param argFlags @param flags
If ::wxPG_FULL_VALUE is set, returns complete, storable value instead If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value
of displayable one (they may be different). instead of displayable one (they may be different).
If ::wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of If wxPGPropValFormatFlags::CompositeFragment is set, text is interpreted as
composite property string value (as generated by ValueToString() a part of composite property string value (as generated by
called with this same flag). ValueToString() called with this same flag).
@return Returns @true if resulting wxVariant value was different. @return Returns @true if resulting wxVariant value was different.
@ -925,7 +925,8 @@ public:
if property value is unspecified (which is usually only case if if property value is unspecified (which is usually only case if
you explicitly enabled that sort behaviour). you explicitly enabled that sort behaviour).
*/ */
virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const; virtual bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/** /**
Converts integer (possibly a choice selection) into wxVariant value Converts integer (possibly a choice selection) into wxVariant value
@ -936,9 +937,9 @@ public:
in normal cases). Translated value must be assigned back to it. in normal cases). Translated value must be assigned back to it.
@param number @param number
Integer to be translated into variant. Integer to be translated into variant.
@param argFlags @param flags
If ::wxPG_FULL_VALUE is set, returns complete, storable value instead If wxPGPropValFormatFlags::FullValue is set, returns complete, storable value
of displayable one. instead of displayable one.
@return Returns @true if resulting wxVariant value was different. @return Returns @true if resulting wxVariant value was different.
@ -953,24 +954,25 @@ public:
property value is unspecified (which is usually only case if you property value is unspecified (which is usually only case if you
explicitly enabled that sort behaviour). explicitly enabled that sort behaviour).
*/ */
virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const; virtual bool IntToValue(wxVariant& variant, int number,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/** /**
Converts property value into a text representation. Converts property value into a text representation.
@param value @param value
Value to be converted. Value to be converted.
@param argFlags @param flags
If 0 (default value), then displayed string is returned. If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
If ::wxPG_FULL_VALUE is set, returns complete, storable string value If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
instead of displayable. If ::wxPG_EDITABLE_VALUE is set, returns instead of displayable. If wxPGPropValFormatFlags::EditableValue is set, returns
string value that must be editable in textctrl. string value that must be editable in textctrl.
If ::wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to If wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
display as a part of string property's composite text representation. display as a part of string property's composite text representation.
@remarks Default implementation calls GenerateComposedValue(). @remarks Default implementation calls GenerateComposedValue().
*/ */
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) 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.
@ -979,18 +981,19 @@ public:
@param text @param text
String to get the value from. String to get the value from.
@param flags @param flags
If ::wxPG_FULL_VALUE is set, the function sets complete, storable If wxPGPropValFormatFlags::FullValue is set, the function sets complete, storable
value instead of displayable one (they may be different). value instead of displayable one (they may be different).
::wxPG_PROGRAMMATIC_VALUE flag is used to indicate that value is wxPGPropValFormatFlags::ProgrammaticValue flag is used to indicate that value is
being set programmatically (i.e. operation is not caused by user being set programmatically (i.e. operation is not caused by user
input). input).
If ::wxPG_REPORT_ERROR is set, a special action should be If wxPGPropValFormatFlags::ReportError is set, a special action should be
performed if string couldn't have been successfully converted performed if string couldn't have been successfully converted
to the valid value (e.g. a special value can be set in this case). to the valid value (e.g. a special value can be set in this case).
@return @true if value was changed. @return @true if value was changed.
*/ */
bool SetValueFromString( const wxString& text, int flags = wxPG_PROGRAMMATIC_VALUE ); bool SetValueFromString(const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ProgrammaticValue);
/** /**
Converts integer to a value, and if successful, calls SetValue() on it. Converts integer to a value, and if successful, calls SetValue() on it.
@ -999,11 +1002,11 @@ public:
@param value @param value
Int to get the value from. Int to get the value from.
@param flags @param flags
If has ::wxPG_FULL_VALUE, then the value given is an actual value and not an index. If has wxPGPropValFormatFlags::FullValue, then the value given is an actual value and not an index.
@return @true if value was changed. @return @true if value was changed.
*/ */
bool SetValueFromInt( long value, int flags = 0 ); bool SetValueFromInt(long value, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null);
/** /**
Returns size of the custom painted image in front of property. This method Returns size of the custom painted image in front of property. This method
@ -1613,12 +1616,12 @@ public:
/** Returns text representation of property's value. /** Returns text representation of property's value.
@param argFlags @param flags
If 0 (default value), then displayed string is returned. If wxPGPropValFormatFlags::Null (default value), then displayed string is returned.
If ::wxPG_FULL_VALUE is set, returns complete, storable string value If wxPGPropValFormatFlags::FullValue is set, returns complete, storable string value
instead of displayable. If ::wxPG_EDITABLE_VALUE is set, returns instead of displayable. If wxPGPropValFormatFlags::EditableValue 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 wxPGPropValFormatFlags::CompositeFragment is set, returns text that is appropriate to
display as a part of string property's composite text display as a part of string property's composite text
representation. representation.
@ -1627,15 +1630,7 @@ public:
now handled by ValueToString(), and overriding this function now now handled by ValueToString(), and overriding this function now
will result in run-time assertion failure. will result in run-time assertion failure.
*/ */
virtual wxString GetValueAsString( int argFlags = 0 ) const; virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/** Synonymous to GetValueAsString().
@deprecated Use GetValueAsString() instead.
@see GetValueAsString()
*/
wxString GetValueString( int argFlags = 0 ) const;
/** /**
Returns value type used by this property. Returns value type used by this property.
@ -2923,7 +2918,7 @@ public:
wxPGRootProperty( const wxString& name = wxS("<Root>") ); wxPGRootProperty( const wxString& name = wxS("<Root>") );
virtual ~wxPGRootProperty(); virtual ~wxPGRootProperty();
virtual bool StringToValue( wxVariant&, const wxString&, int ) const; virtual bool StringToValue( wxVariant&, const wxString&, wxPGPropValFormatFlags ) const;
}; };
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@ -2942,10 +2937,10 @@ public:
wxPropertyCategory( const wxString& label, wxPropertyCategory( const wxString& label,
const wxString& name = wxPG_LABEL ); const wxString& name = wxPG_LABEL );
~wxPropertyCategory(); virtual ~wxPropertyCategory();
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const; int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
virtual wxString ValueToString( wxVariant& value, int argFlags ) const; virtual wxString ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const;
virtual wxString GetValueAsString( int argFlags = 0 ) const; virtual wxString GetValueAsString(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
}; };

View file

@ -851,9 +851,9 @@ public:
Returns (visual) text representation of the unspecified Returns (visual) text representation of the unspecified
property value. property value.
@param argFlags For internal use only. @param flags For internal use only.
*/ */
wxString GetUnspecifiedValueText( int argFlags = 0 ) const; wxString GetUnspecifiedValueText(wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
/** /**
Returns current vertical spacing. Returns current vertical spacing.

View file

@ -105,52 +105,57 @@ enum class wxPGPropertyValuesFlags : int
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
/** Misc argument flags. /** Miscellaneous property value format flags.
*/ */
enum wxPG_MISC_ARG_FLAGS enum class wxPGPropValFormatFlags : int
{ {
/** No flags.
@hideinitializer
*/
Null = 0,
/** Get/Store full value instead of displayed value. /** Get/Store full value instead of displayed value.
@hideinitializer @hideinitializer
*/ */
wxPG_FULL_VALUE = 0x00000001, FullValue = 0x00000001,
/** Perform special action in case of unsuccessful conversion. /** Perform special action in case of unsuccessful conversion.
@hideinitializer @hideinitializer
*/ */
wxPG_REPORT_ERROR = 0x00000002, ReportError = 0x00000002,
/** /**
@hideinitializer @hideinitializer
*/ */
wxPG_PROPERTY_SPECIFIC = 0x00000004, PropertySpecific = 0x00000004,
/** Get/Store editable value instead of displayed one (should only be /** Get/Store editable value instead of displayed one (should only be
different in the case of common values). different in the case of common values).
@hideinitializer @hideinitializer
*/ */
wxPG_EDITABLE_VALUE = 0x00000008, EditableValue = 0x00000008,
/** Used when dealing with fragments of composite string value /** Used when dealing with fragments of composite string value
@hideinitializer @hideinitializer
*/ */
wxPG_COMPOSITE_FRAGMENT = 0x00000010, CompositeFragment = 0x00000010,
/** Means property for which final string value is for cannot really be /** Means property for which final string value is for cannot really be
edited. edited.
@hideinitializer @hideinitializer
*/ */
wxPG_UNEDITABLE_COMPOSITE_FRAGMENT = 0x00000020, UneditableCompositeFragment = 0x00000020,
/** wxPGProperty::ValueToString() called from wxPGProperty::GetValueAsString() /** wxPGProperty::ValueToString() called from wxPGProperty::GetValueAsString()
(guarantees that input wxVariant value is current own value) (guarantees that input wxVariant value is current own value)
@hideinitializer @hideinitializer
*/ */
wxPG_VALUE_IS_CURRENT = 0x00000040, ValueIsCurrent = 0x00000040,
/** Value is being set programmatically (i.e. not by user) /** Value is being set programmatically (i.e. not by user)
@hideinitializer @hideinitializer
*/ */
wxPG_PROGRAMMATIC_VALUE = 0x00000080 ProgrammaticValue = 0x00000080
}; };
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View file

@ -844,7 +844,7 @@ public:
Text identifier of attribute. See @ref propgrid_property_attributes. Text identifier of attribute. See @ref propgrid_property_attributes.
@param value @param value
Value of attribute. Value of attribute.
@param argFlags @param flags
Optional. Optional.
Use wxPGPropertyValuesFlags::Recurse to set the attribute to child Use wxPGPropertyValuesFlags::Recurse to set the attribute to child
properties recursively. properties recursively.
@ -855,7 +855,7 @@ public:
- Property is refreshed with new settings. - Property is refreshed with new settings.
*/ */
void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value, void SetPropertyAttribute(wxPGPropArg id, const wxString& attrName, wxVariant value,
wxPGPropertyValuesFlags argFlags = wxPGPropertyValuesFlags::DontRecurse); wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
/** /**
Sets property attribute for all applicable properties. Sets property attribute for all applicable properties.

View file

@ -48,10 +48,10 @@ public:
const wxString& value = wxString() ); const wxString& value = wxString() );
virtual ~wxStringProperty(); virtual ~wxStringProperty();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
@ -215,15 +215,14 @@ public:
wxIntProperty( const wxString& label, wxIntProperty( const wxString& label,
const wxString& name, const wxString& name,
const wxLongLong& value ); const wxLongLong& value );
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlagsflags = wxPGPropValFormatFlags::Null) const;
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const; wxPGValidationInfo& validationInfo ) const;
virtual bool IntToValue( wxVariant& variant, virtual bool IntToValue(wxVariant& variant, int number,
int number, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
int argFlags = 0 ) const;
static wxValidator* GetClassValidator(); static wxValidator* GetClassValidator();
virtual wxValidator* DoGetValidator() const; virtual wxValidator* DoGetValidator() const;
virtual wxVariant AddSpinStepValue(long stepScale) const; virtual wxVariant AddSpinStepValue(long stepScale) const;
@ -260,17 +259,16 @@ public:
wxUIntProperty( const wxString& label, wxUIntProperty( const wxString& label,
const wxString& name, const wxString& name,
const wxULongLong& value ); const wxULongLong& value );
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const; wxPGValidationInfo& validationInfo ) const;
virtual wxValidator* DoGetValidator () const; virtual wxValidator* DoGetValidator () const;
virtual bool IntToValue( wxVariant& variant, virtual bool IntToValue(wxVariant& variant, int number,
int number, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
int argFlags = 0 ) const;
virtual wxVariant AddSpinStepValue(long stepScale) const; virtual wxVariant AddSpinStepValue(long stepScale) const;
protected: protected:
@ -299,10 +297,10 @@ public:
double value = 0.0 ); double value = 0.0 );
virtual ~wxFloatProperty(); virtual ~wxFloatProperty();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const; wxPGValidationInfo& validationInfo ) const;
@ -335,12 +333,12 @@ public:
bool value = false ); bool value = false );
virtual ~wxBoolProperty(); virtual ~wxBoolProperty();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool IntToValue( wxVariant& variant, virtual bool IntToValue(wxVariant& variant, int number,
int number, int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
}; };
@ -389,18 +387,18 @@ public:
size_t GetItemCount() const; size_t GetItemCount() const;
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool ValidateValue( wxVariant& value, virtual bool ValidateValue( wxVariant& value,
wxPGValidationInfo& validationInfo ) const; wxPGValidationInfo& validationInfo ) const;
// If wxPG_FULL_VALUE is not set in flags, then the value is interpreted /** If wxPGPropValFormatFlags::FullValue is not set in flags, then the value is interpreted
// as index to choices list. Otherwise, it is actual value. as index to choices list. Otherwise, it is actual value.
virtual bool IntToValue( wxVariant& variant, */
int number, virtual bool IntToValue(wxVariant& variant, int number,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
// //
// Additional virtuals // Additional virtuals
@ -418,13 +416,10 @@ protected:
int GetIndex() const; int GetIndex() const;
void SetIndex( int index ); void SetIndex( int index );
bool ValueFromString_( wxVariant& value, bool ValueFromString_(wxVariant& value, int* pIndex, const wxString& text,
const wxString& text, wxPGPropValFormatFlags flags) const;
int argFlags ) const; bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal,
bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const; wxPGPropValFormatFlags flags) const;
static void ResetNextIndex();
}; };
@ -468,6 +463,11 @@ public:
virtual ~wxEditEnumProperty(); virtual ~wxEditEnumProperty();
void OnSetValue() override;
bool StringToValue(wxVariant& variant, const wxString& text,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
bool ValidateValue(wxVariant& value,
wxPGValidationInfo& validationInfo) const;
}; };
@ -506,10 +506,10 @@ public:
virtual ~wxFlagsProperty (); virtual ~wxFlagsProperty ();
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int flags ) const; wxPGPropValFormatFlags flags) const;
virtual wxVariant ChildChanged( wxVariant& thisValue, virtual wxVariant ChildChanged( wxVariant& thisValue,
int childIndex, int childIndex,
wxVariant& childValue ) const; wxVariant& childValue ) const;
@ -602,10 +602,10 @@ public:
virtual ~wxFileProperty (); virtual ~wxFileProperty ();
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
static wxValidator* GetClassValidator(); static wxValidator* GetClassValidator();
@ -643,10 +643,10 @@ public:
const wxString& value = wxString() ); const wxString& value = wxString() );
virtual ~wxLongStringProperty(); virtual ~wxLongStringProperty();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
protected: protected:
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value); virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
@ -669,9 +669,10 @@ public:
const wxString& value = wxString() ); const wxString& value = wxString() );
virtual ~wxDirProperty(); virtual ~wxDirProperty();
virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const; virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool StringToValue(wxVariant& variant, const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual wxValidator* DoGetValidator() const; virtual wxValidator* DoGetValidator() const;
protected: protected:
@ -696,10 +697,10 @@ public:
virtual ~wxArrayStringProperty(); virtual ~wxArrayStringProperty();
virtual void OnSetValue(); virtual void OnSetValue();
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual wxString ValueToString(wxVariant& value,
virtual bool StringToValue( wxVariant& variant, wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
const wxString& text, virtual bool StringToValue(wxVariant& variant, const wxString& text,
int argFlags = 0 ) const; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
/** /**

View file

@ -505,11 +505,11 @@ void wxArrayDoubleProperty::OnSetValue()
} }
wxString wxArrayDoubleProperty::ValueToString( wxVariant& value, wxString wxArrayDoubleProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxString s; wxString s;
if ( argFlags & wxPG_FULL_VALUE ) if ( !!(flags & wxPGPropValFormatFlags::FullValue) )
{ {
GenerateValueAsString(s,-1,false); GenerateValueAsString(s,-1,false);
} }
@ -571,7 +571,7 @@ bool wxArrayDoubleProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v
return false; return false;
} }
bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& text, int ) const bool wxArrayDoubleProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags ) const
{ {
// Add values to a temporary array so that in case // Add values to a temporary array so that in case
// of error we can opt not to use them. // of error we can opt not to use them.
@ -707,12 +707,12 @@ wxColour MyColourProperty::GetColour(int index) const
return wxColour(); return wxColour();
} }
wxString MyColourProperty::ColourToString(const wxColour& col, int index, int argFlags) const wxString MyColourProperty::ColourToString(const wxColour& col, int index, wxPGPropValFormatFlags flags) const
{ {
if ( index == (int)(m_choices.GetCount() - 1) ) if ( index == (int)(m_choices.GetCount() - 1) )
return wxEmptyString; return wxEmptyString;
return wxColourProperty::ColourToString(col, index, argFlags); return wxColourProperty::ColourToString(col, index, flags);
} }
int MyColourProperty::GetCustomColourIndex() const int MyColourProperty::GetCustomColourIndex() const

View file

@ -116,10 +116,16 @@ public:
virtual ~wxArrayDoubleProperty() = default; virtual ~wxArrayDoubleProperty() = default;
virtual void OnSetValue() override; virtual void OnSetValue() override;
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const override; #if WXWIN_COMPATIBILITY_3_2
// To prevent warnings that obsolete methods are hidden by overloads with new signature.
using wxEditorDialogProperty::ValueToString;
using wxEditorDialogProperty::StringToValue;
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ValueToString(wxVariant& value,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual bool StringToValue( wxVariant& variant, virtual bool StringToValue( wxVariant& variant,
const wxString& text, const wxString& text,
int argFlags = 0 ) const override; wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null ) const override;
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override; virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) override;
// Generates cache for displayed text // Generates cache for displayed text
@ -150,8 +156,12 @@ public:
virtual wxColour GetColour(int index) const override; virtual wxColour GetColour(int index) const override;
virtual wxString ColourToString(const wxColour& col, #if WXWIN_COMPATIBILITY_3_2
int index, int argFlags = 0) const override; // To prevent warning that obsolete method is hidden by overload with new signature.
using wxColourProperty::ColourToString;
#endif // WXWIN_COMPATIBILITY_3_2
virtual wxString ColourToString(const wxColour& col, int index,
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const override;
virtual int GetCustomColourIndex() const override; virtual int GetCustomColourIndex() const override;
}; };

View file

@ -334,7 +334,12 @@ bool wxPGSpinCtrlEditor::OnEvent(wxPropertyGrid* propgrid, wxPGProperty* propert
stepScale *= spins; stepScale *= spins;
wxVariant v = prop->AddSpinStepValue(stepScale); wxVariant v = prop->AddSpinStepValue(stepScale);
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
SetControlStringValue(prop, propgrid->GetEditorControl(), prop->ValueToStringWithCheck(v));
#else
SetControlStringValue(prop, propgrid->GetEditorControl(), prop->ValueToString(v)); SetControlStringValue(prop, propgrid->GetEditorControl(), prop->ValueToString(v));
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
return true; return true;
} }
} }
@ -579,7 +584,7 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name,
wxPGProperty* p = new wxEnumProperty(_("Face Name"), wxS("Face Name"), wxPGProperty* p = new wxEnumProperty(_("Face Name"), wxS("Face Name"),
*wxPGGlobalVars->m_fontFamilyChoices); *wxPGGlobalVars->m_fontFamilyChoices);
p->SetValueFromString(faceName, wxPG_FULL_VALUE); p->SetValueFromString(faceName, wxPGPropValFormatFlags::FullValue);
AddPrivateChild( p ); AddPrivateChild( p );
@ -615,9 +620,9 @@ void wxFontProperty::OnSetValue()
} }
wxString wxFontProperty::ValueToString( wxVariant& value, wxString wxFontProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
return wxEditorDialogProperty::ValueToString(value, argFlags); return wxEditorDialogProperty::ValueToString(value, flags);
} }
bool wxFontProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) bool wxFontProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value)
@ -652,7 +657,7 @@ void wxFontProperty::RefreshChildren()
wxFont font; wxFont font;
font << m_value; font << m_value;
Item(0)->SetValue( (long)font.GetPointSize() ); Item(0)->SetValue( (long)font.GetPointSize() );
Item(1)->SetValueFromString( font.GetFaceName(), wxPG_FULL_VALUE ); Item(1)->SetValueFromString( font.GetFaceName(), wxPGPropValFormatFlags::FullValue );
Item(2)->SetValue( (long)font.GetStyle() ); Item(2)->SetValue( (long)font.GetStyle() );
Item(3)->SetValue( (long)font.GetWeight() ); Item(3)->SetValue( (long)font.GetWeight() );
Item(4)->SetValue( font.GetUnderlined() ); Item(4)->SetValue( font.GetUnderlined() );
@ -1054,15 +1059,35 @@ wxColour wxSystemColourProperty::GetColour( int index ) const
return wxSystemSettings::GetColour( (wxSystemColour)index ); return wxSystemSettings::GetColour( (wxSystemColour)index );
} }
#if WXWIN_COMPATIBILITY_3_2
// By call to obsolete function we want to check if user-overriden function is still in use
wxString wxSystemColourProperty::ColourToStringWithCheck(const wxColour& col, int index,
wxPGPropValFormatFlags flags) const
{
m_oldColourToStringCalled = false;
wxString res = ColourToString(col, index, static_cast<int>(flags));
if ( m_oldColourToStringCalled )
{
// Our own function was called - this implies that call was forwarded to the new overriding
// function and there is no need to call it explicitly.
}
else
{ // User-overriden obsolete function was called
wxFAIL_MSG(wxString::Format("in %s use ColourToString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
}
return res;
}
#endif // WXWIN_COMPATIBILITY_3_2
wxString wxSystemColourProperty::ColourToString( const wxColour& col, wxString wxSystemColourProperty::ColourToString( const wxColour& col,
int index, int index,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
if ( index == wxNOT_FOUND ) if ( index == wxNOT_FOUND )
{ {
if ( (argFlags & wxPG_FULL_VALUE) || !!(m_flags & wxPGPropertyFlags_ColourHasAlpha) ) if ( !!(flags & wxPGPropValFormatFlags::FullValue) || !!(m_flags & wxPGPropertyFlags_ColourHasAlpha) )
{ {
return wxString::Format(wxS("(%i,%i,%i,%i)"), return wxString::Format(wxS("(%i,%i,%i,%i)"),
(int)col.Red(), (int)col.Red(),
@ -1085,15 +1110,15 @@ wxString wxSystemColourProperty::ColourToString( const wxColour& col,
} }
wxString wxSystemColourProperty::ValueToString( wxVariant& value, wxString wxSystemColourProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxColourPropertyValue val = GetVal(&value); wxColourPropertyValue val = GetVal(&value);
int index; int index;
if ( argFlags & wxPG_VALUE_IS_CURRENT ) if ( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent) )
{ {
// GetIndex() only works reliably if wxPG_VALUE_IS_CURRENT flag is set, // GetIndex() only works reliably if wxPGPropValFormatFlags::ValueIsCurrent flag is set,
// but we should use it whenever possible. // but we should use it whenever possible.
index = GetIndex(); index = GetIndex();
@ -1108,7 +1133,12 @@ wxString wxSystemColourProperty::ValueToString( wxVariant& value,
index = m_choices.Index(val.m_type); index = m_choices.Index(val.m_type);
} }
return ColourToString(val.m_colour, index, argFlags); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
return ColourToStringWithCheck(val.m_colour, index, flags);
#else
return ColourToString(val.m_colour, index, flags);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
@ -1167,14 +1197,14 @@ bool wxSystemColourProperty::QueryColourFromUser( wxVariant& variant ) const
} }
bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, int argFlags ) const bool wxSystemColourProperty::IntToValue( wxVariant& variant, int number, wxPGPropValFormatFlags flags ) const
{ {
int index = number; int index = number;
const int type = m_choices.GetValue(index); const int type = m_choices.GetValue(index);
if ( type == wxPG_COLOUR_CUSTOM ) if ( type == wxPG_COLOUR_CUSTOM )
{ {
if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) ) if ( !(flags & wxPGPropValFormatFlags::PropertySpecific) )
return QueryColourFromUser(variant); return QueryColourFromUser(variant);
// Call from event handler. // Call from event handler.
@ -1341,7 +1371,7 @@ void wxSystemColourProperty::OnCustomPaint( wxDC& dc, const wxRect& rect,
} }
bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& text, int argFlags ) const bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
const int custIndex = GetCustomColourIndex(); const int custIndex = GetCustomColourIndex();
wxString custColName; wxString custColName;
@ -1391,7 +1421,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
!(m_flags & wxPGPropertyFlags_HideCustomColour) && !(m_flags & wxPGPropertyFlags_HideCustomColour) &&
isCustomColour ) isCustomColour )
{ {
if ( !(argFlags & wxPG_EDITABLE_VALUE )) if ( !(flags & wxPGPropValFormatFlags::EditableValue ))
{ {
// This really should not occur... // This really should not occur...
// wxASSERT(false); // wxASSERT(false);
@ -1400,7 +1430,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
if ( !QueryColourFromUser(value) ) if ( !QueryColourFromUser(value) )
{ {
if ( !(argFlags & wxPG_PROPERTY_SPECIFIC) ) if ( !(flags & wxPGPropValFormatFlags::PropertySpecific) )
return false; return false;
// If query for value comes from the event handler // If query for value comes from the event handler
// use current pending value to be processed later on in OnEvent(). // use current pending value to be processed later on in OnEvent().
@ -1417,7 +1447,7 @@ bool wxSystemColourProperty::StringToValue( wxVariant& value, const wxString& te
{ {
// Try predefined colour first // Try predefined colour first
int index; int index;
bool res = ValueFromString_(value, &index, colStr, argFlags); bool res = ValueFromString_(value, &index, colStr, flags);
if ( res && index >= 0 ) if ( res && index >= 0 )
{ {
val.m_type = index; val.m_type = index;
@ -1601,15 +1631,15 @@ void wxColourProperty::Init( wxColour colour )
} }
wxString wxColourProperty::ValueToString( wxVariant& value, wxString wxColourProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
const wxPGEditor* editor = GetEditorClass(); const wxPGEditor* editor = GetEditorClass();
if ( editor != wxPGEditor_Choice && if ( editor != wxPGEditor_Choice &&
editor != wxPGEditor_ChoiceAndButton && editor != wxPGEditor_ChoiceAndButton &&
editor != wxPGEditor_ComboBox ) editor != wxPGEditor_ComboBox )
argFlags |= wxPG_PROPERTY_SPECIFIC; flags |= wxPGPropValFormatFlags::PropertySpecific;
return wxSystemColourProperty::ValueToString(value, argFlags); return wxSystemColourProperty::ValueToString(value, flags);
} }
wxColour wxColourProperty::GetColour( int index ) const wxColour wxColourProperty::GetColour( int index ) const
@ -1711,9 +1741,9 @@ wxCursorProperty::wxCursorProperty( const wxString& label, const wxString& name,
m_flags |= wxPGPropertyFlags_StaticChoices; // Cursor selection cannot be changed. m_flags |= wxPGPropertyFlags_StaticChoices; // Cursor selection cannot be changed.
} }
wxString wxCursorProperty::ValueToString(wxVariant& value, int argFlags) const wxString wxCursorProperty::ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const
{ {
return wxGetTranslation(wxEnumProperty::ValueToString(value, argFlags), return wxGetTranslation(wxEnumProperty::ValueToString(value, flags),
wxString(), "system cursor name"); wxString(), "system cursor name");
} }
@ -1945,10 +1975,10 @@ void wxMultiChoiceProperty::OnSetValue()
} }
wxString wxMultiChoiceProperty::ValueToString( wxVariant& value, wxString wxMultiChoiceProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
// If possible, use cached string // If possible, use cached string
if ( argFlags & wxPG_VALUE_IS_CURRENT ) if ( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent) )
return m_display; return m_display;
return GenerateValueAsString(value); return GenerateValueAsString(value);
@ -2058,7 +2088,7 @@ bool wxMultiChoiceProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v
return false; return false;
} }
bool wxMultiChoiceProperty::StringToValue( wxVariant& variant, const wxString& text, int ) const bool wxMultiChoiceProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags ) const
{ {
wxArrayString arr; wxArrayString arr;
@ -2135,7 +2165,7 @@ void wxDateProperty::OnSetValue()
} }
bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text, bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text,
int WXUNUSED(argFlags) ) const wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
wxDateTime dt; wxDateTime dt;
@ -2153,7 +2183,7 @@ bool wxDateProperty::StringToValue( wxVariant& variant, const wxString& text,
} }
wxString wxDateProperty::ValueToString( wxVariant& value, wxString wxDateProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxDateTime dateTime = value.GetDateTime(); wxDateTime dateTime = value.GetDateTime();
@ -2172,7 +2202,7 @@ wxString wxDateProperty::ValueToString( wxVariant& value,
wxString format; wxString format;
if ( !m_format.empty() && if ( !m_format.empty() &&
!(argFlags & wxPG_FULL_VALUE) ) !(flags & wxPGPropValFormatFlags::FullValue) )
format = m_format; format = m_format;
// Determine default from locale // Determine default from locale

View file

@ -191,8 +191,13 @@ void wxPGEditor::SetControlAppearance( wxPropertyGrid* pg,
} }
else if ( oCell.HasText() ) else if ( oCell.HasText() )
{ {
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
tcText = property->GetValueAsStringWithCheck(
#else
tcText = property->GetValueAsString( tcText = property->GetValueAsString(
property->HasFlag(wxPGPropertyFlags::ReadOnly)?0:wxPG_EDITABLE_VALUE); #endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
property->HasFlag(wxPGPropertyFlags::ReadOnly)?wxPGPropValFormatFlags::Null:wxPGPropValFormatFlags::EditableValue);
changeText = true; changeText = true;
} }
@ -284,11 +289,16 @@ wxPGWindowList wxPGTextCtrlEditor::CreateControls( wxPropertyGrid* propGrid,
property->HasAnyChild() ) property->HasAnyChild() )
return nullptr; return nullptr;
int argFlags = 0; wxPGPropValFormatFlags fmtFlags = wxPGPropValFormatFlags::Null;
if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) && if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) &&
!property->IsValueUnspecified() ) !property->IsValueUnspecified() )
argFlags |= wxPG_EDITABLE_VALUE; fmtFlags |= wxPGPropValFormatFlags::EditableValue;
text = property->GetValueAsString(argFlags); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
text = property->GetValueAsStringWithCheck(fmtFlags);
#else
text = property->GetValueAsString(fmtFlags);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
int flags = 0; int flags = 0;
if ( property->HasFlag(wxPGPropertyFlags_Password) && if ( property->HasFlag(wxPGPropertyFlags_Password) &&
@ -330,7 +340,12 @@ void wxPGTextCtrlEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl )
wxString s; wxString s;
if ( tc->HasFlag(wxTE_PASSWORD) ) if ( tc->HasFlag(wxTE_PASSWORD) )
s = property->GetValueAsString(wxPG_FULL_VALUE); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
s = property->GetValueAsStringWithCheck(wxPGPropValFormatFlags::FullValue);
#else
s = property->GetValueAsString(wxPGPropValFormatFlags::FullValue);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
else else
s = property->GetDisplayedString(); s = property->GetDisplayedString();
@ -397,7 +412,12 @@ bool wxPGTextCtrlEditor::GetTextCtrlValueFromControl( wxVariant& variant, wxPGPr
return true; return true;
} }
bool res = property->StringToValue(variant, textVal, wxPG_EDITABLE_VALUE); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
bool res = property->StringToValueWithCheck(variant, textVal, wxPGPropValFormatFlags::EditableValue);
#else
bool res = property->StringToValue(variant, textVal, wxPGPropValFormatFlags::EditableValue);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
// Changing unspecified always causes event (returning // Changing unspecified always causes event (returning
// true here should be enough to trigger it). // true here should be enough to trigger it).
@ -435,9 +455,14 @@ void wxPGTextCtrlEditor_OnFocus( wxPGProperty* property,
{ {
// Make sure there is correct text (instead of unspecified value // Make sure there is correct text (instead of unspecified value
// indicator or hint text) // indicator or hint text)
int flags = property->HasFlag(wxPGPropertyFlags::ReadOnly) ? wxPGPropValFormatFlags fmtFlags = property->HasFlag(wxPGPropertyFlags::ReadOnly) ?
0 : wxPG_EDITABLE_VALUE; wxPGPropValFormatFlags::Null : wxPGPropValFormatFlags::EditableValue;
wxString correctText = property->GetValueAsString(flags); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
wxString correctText = property->GetValueAsStringWithCheck(fmtFlags);
#else
wxString correctText = property->GetValueAsString(fmtFlags);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
if ( tc->GetValue() != correctText ) if ( tc->GetValue() != correctText )
{ {
@ -726,7 +751,12 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
else else
{ {
if ( !p->IsValueUnspecified() ) if ( !p->IsValueUnspecified() )
text = p->GetValueAsString(0); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
text = p->GetValueAsStringWithCheck(wxPGPropValFormatFlags::Null);
#else
text = p->GetValueAsString(wxPGPropValFormatFlags::Null);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
} }
@ -948,11 +978,16 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
wxString defString; wxString defString;
int index = property->GetChoiceSelection(); int index = property->GetChoiceSelection();
int argFlags = 0; wxPGPropValFormatFlags fmtFlags = wxPGPropValFormatFlags::Null;
if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) && if ( !property->HasFlag(wxPGPropertyFlags::ReadOnly) &&
!property->IsValueUnspecified() ) !property->IsValueUnspecified() )
argFlags |= wxPG_EDITABLE_VALUE; fmtFlags |= wxPGPropValFormatFlags::EditableValue;
defString = property->GetValueAsString(argFlags); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
defString = property->GetValueAsStringWithCheck(fmtFlags);
#else
defString = property->GetValueAsString(fmtFlags);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
wxArrayString labels = choices.GetLabels(); wxArrayString labels = choices.GetLabels();
@ -1135,7 +1170,12 @@ bool wxPGChoiceEditor::GetValueFromControl( wxVariant& variant, wxPGProperty* pr
property->IsValueUnspecified() property->IsValueUnspecified()
) )
{ {
return property->IntToValue(variant, index, wxPG_PROPERTY_SPECIFIC); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
return property->IntToValueWithCheck(variant, index, wxPGPropValFormatFlags::PropertySpecific);
#else
return property->IntToValue(variant, index, wxPGPropValFormatFlags::PropertySpecific);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
return false; return false;
} }
@ -1199,7 +1239,12 @@ void wxPGComboBoxEditor::UpdateControl( wxPGProperty* property, wxWindow* ctrl )
{ {
wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl; wxOwnerDrawnComboBox* cb = (wxOwnerDrawnComboBox*)ctrl;
const int index = property->GetChoiceSelection(); const int index = property->GetChoiceSelection();
wxString s = property->GetValueAsString(wxPG_EDITABLE_VALUE); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
wxString s = property->GetValueAsStringWithCheck(wxPGPropValFormatFlags::EditableValue);
#else
wxString s = property->GetValueAsString(wxPGPropValFormatFlags::EditableValue);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
cb->SetSelection(index); cb->SetSelection(index);
property->GetGrid()->SetupTextCtrlValue(s); property->GetGrid()->SetupTextCtrlValue(s);
cb->SetValue(s); cb->SetValue(s);
@ -1247,7 +1292,12 @@ bool wxPGComboBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
return true; return true;
} }
bool res = property->StringToValue(variant, textVal, wxPG_EDITABLE_VALUE|wxPG_PROPERTY_SPECIFIC); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
bool res = property->StringToValueWithCheck(variant, textVal, wxPGPropValFormatFlags::EditableValue|wxPGPropValFormatFlags::PropertySpecific);
#else
bool res = property->StringToValue(variant, textVal, wxPGPropValFormatFlags::EditableValue | wxPGPropValFormatFlags::PropertySpecific);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
// Changing unspecified always causes event (returning // Changing unspecified always causes event (returning
// true here should be enough to trigger it). // true here should be enough to trigger it).
@ -1724,7 +1774,12 @@ bool wxPGCheckBoxEditor::GetValueFromControl( wxVariant& variant, wxPGProperty*
property->IsValueUnspecified() property->IsValueUnspecified()
) )
{ {
return property->IntToValue(variant, index, wxPG_PROPERTY_SPECIFIC); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
return property->IntToValueWithCheck(variant, index, wxPGPropValFormatFlags::PropertySpecific);
#else
return property->IntToValue(variant, index, wxPGPropValFormatFlags::PropertySpecific);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
return false; return false;
} }
@ -2048,7 +2103,12 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrlAndButton( const wxPoint& pos,
wxString text; wxString text;
if ( !property->IsValueUnspecified() ) if ( !property->IsValueUnspecified() )
text = property->GetValueAsString(property->HasFlag(wxPGPropertyFlags::ReadOnly)?0:wxPG_EDITABLE_VALUE); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
text = property->GetValueAsStringWithCheck(property->HasFlag(wxPGPropertyFlags::ReadOnly)?wxPGPropValFormatFlags::Null : wxPGPropValFormatFlags::EditableValue);
#else
text = property->GetValueAsString(property->HasFlag(wxPGPropertyFlags::ReadOnly) ? wxPGPropValFormatFlags::Null : wxPGPropValFormatFlags::EditableValue);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
return GenerateEditorTextCtrl(pos, sz, text, but, 0, property->GetMaxLength()); return GenerateEditorTextCtrl(pos, sz, text, but, 0, property->GetMaxLength());
} }

View file

@ -273,7 +273,12 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
imageWidth = paintdata.m_drawnWidth; imageWidth = paintdata.m_drawnWidth;
} }
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
text = property->GetValueAsStringWithCheck();
#else
text = property->GetValueAsString(); text = property->GetValueAsString();
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
// Add units string? // Add units string?
if ( propertyGrid->GetColumnCount() <= 2 ) if ( propertyGrid->GetColumnCount() <= 2 )
@ -978,7 +983,7 @@ wxString wxPGProperty::GetColumnText( unsigned int col, int choiceIndex ) const
*/ */
void wxPGProperty::DoGenerateComposedValue( wxString& text, void wxPGProperty::DoGenerateComposedValue( wxString& text,
int argFlags, wxPGPropValFormatFlags flags,
const wxVariantList* valueOverrides, const wxVariantList* valueOverrides,
wxPGHashMapS2S* childResults ) const wxPGHashMapS2S* childResults ) const
{ {
@ -989,13 +994,13 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
return; return;
if ( iMax > PWC_CHILD_SUMMARY_LIMIT && if ( iMax > PWC_CHILD_SUMMARY_LIMIT &&
!(argFlags & wxPG_FULL_VALUE) ) !(flags & wxPGPropValFormatFlags::FullValue) )
iMax = PWC_CHILD_SUMMARY_LIMIT; iMax = PWC_CHILD_SUMMARY_LIMIT;
size_t iMaxMinusOne = iMax-1; size_t iMaxMinusOne = iMax-1;
if ( !IsTextEditable() ) if ( !IsTextEditable() )
argFlags |= wxPG_UNEDITABLE_COMPOSITE_FRAGMENT; flags |= wxPGPropValFormatFlags::UneditableCompositeFragment;
wxPGProperty* curChild = m_children[0]; wxPGProperty* curChild = m_children[0];
@ -1046,13 +1051,19 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
childValue.IsType(wxPG_VARIANT_TYPE_LIST) ) childValue.IsType(wxPG_VARIANT_TYPE_LIST) )
{ {
wxVariantList& childList = childValue.GetList(); wxVariantList& childList = childValue.GetList();
DoGenerateComposedValue(s, argFlags|wxPG_COMPOSITE_FRAGMENT, DoGenerateComposedValue(s, flags|wxPGPropValFormatFlags::CompositeFragment,
&childList, childResults); &childList, childResults);
} }
else else
{ {
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
s = curChild->ValueToStringWithCheck(childValue,
flags|wxPGPropValFormatFlags::CompositeFragment);
#else
s = curChild->ValueToString(childValue, s = curChild->ValueToString(childValue,
argFlags|wxPG_COMPOSITE_FRAGMENT); flags|wxPGPropValFormatFlags::CompositeFragment);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
} }
@ -1060,7 +1071,7 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
(*childResults)[curChild->GetName()] = s; (*childResults)[curChild->GetName()] = s;
bool skip = false; bool skip = false;
if ( (argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT) && s.empty() ) if ( !!(flags & wxPGPropValFormatFlags::UneditableCompositeFragment) && s.empty() )
skip = true; skip = true;
if ( !curChild->HasAnyChild() || skip ) if ( !curChild->HasAnyChild() || skip )
@ -1071,8 +1082,8 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
if ( i < iMaxMinusOne ) if ( i < iMaxMinusOne )
{ {
if ( text.length() > PWC_CHILD_SUMMARY_CHAR_LIMIT && if ( text.length() > PWC_CHILD_SUMMARY_CHAR_LIMIT &&
!(argFlags & wxPG_EDITABLE_VALUE) && !(flags & wxPGPropValFormatFlags::EditableValue) &&
!(argFlags & wxPG_FULL_VALUE) ) !(flags & wxPGPropValFormatFlags::FullValue) )
break; break;
if ( !skip ) if ( !skip )
@ -1096,8 +1107,27 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
} }
} }
#if WXWIN_COMPATIBILITY_3_2
// By call to obsolete function we want to check if user-overriden function is still in use
wxString wxPGProperty::ValueToStringWithCheck(wxVariant& variant, wxPGPropValFormatFlags flags) const
{
m_oldValueToStringCalled = false;
wxString res = ValueToString(variant, static_cast<int>(flags));
if ( m_oldValueToStringCalled )
{
// Our own function was called - this implies that call was forwarded to the new overriding
// function and there is no need to call it explicitly.
}
else
{ // User-overriden obsolete function was called
wxFAIL_MSG(wxString::Format("in %s use ValueToString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
}
return res;
}
#endif // WXWIN_COMPATIBILITY_3_2
wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value), wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value),
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxCHECK_MSG( HasAnyChild(), wxCHECK_MSG( HasAnyChild(),
wxString(), wxString(),
@ -1105,39 +1135,63 @@ wxString wxPGProperty::ValueToString( wxVariant& WXUNUSED(value),
wxS("override GetValueAsString") ); wxS("override GetValueAsString") );
// FIXME: Currently code below only works if value is actually m_value // FIXME: Currently code below only works if value is actually m_value
wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT, wxASSERT_MSG( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent),
wxS("Sorry, currently default wxPGProperty::ValueToString() ") wxS("Sorry, currently default wxPGProperty::ValueToString() ")
wxS("implementation only works if value is m_value.") ); wxS("implementation only works if value is m_value.") );
wxString text; wxString text;
DoGenerateComposedValue(text, argFlags); DoGenerateComposedValue(text, flags);
return text; return text;
} }
wxString wxPGProperty::GetValueAsString( int argFlags ) const #if WXWIN_COMPATIBILITY_3_2
// By call to obsolete function we want to check if user-overriden function is still in use
wxString wxPGProperty::GetValueAsStringWithCheck(wxPGPropValFormatFlags flags) const
{
m_oldGetValueAsString = false;
wxString res = GetValueAsString(static_cast<int>(flags));
if ( m_oldGetValueAsString )
{
// Our own function was called - this implies that call was forwarded to the new overriding
// function and there is no need to call it explicitly.
}
else
{ // User-overriden obsolete function was called
wxFAIL_MSG(wxString::Format("in %s use GetValueAsString with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
}
return res;
}
#endif // WXWIN_COMPATIBILITY_3_2
wxString wxPGProperty::GetValueAsString(wxPGPropValFormatFlags flags) const
{ {
wxPropertyGrid* pg = GetGrid(); wxPropertyGrid* pg = GetGrid();
wxCHECK_MSG( pg, wxString(), wxCHECK_MSG( pg, wxString(),
wxS("Cannot get valid value for detached property") ); wxS("Cannot get valid value for detached property") );
if ( IsValueUnspecified() ) if ( IsValueUnspecified() )
return pg->GetUnspecifiedValueText(argFlags); return pg->GetUnspecifiedValueText(flags);
if ( m_commonValue == -1 ) if ( m_commonValue == -1 )
{ {
wxVariant value(GetValue()); wxVariant value(GetValue());
return ValueToString(value, argFlags|wxPG_VALUE_IS_CURRENT); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
return ValueToStringWithCheck(value, flags|wxPGPropValFormatFlags::ValueIsCurrent);
#else
return ValueToString(value, flags|wxPGPropValFormatFlags::ValueIsCurrent);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
// //
// Return common value's string representation // Return common value's string representation
const wxPGCommonValue* cv = pg->GetCommonValue(m_commonValue); const wxPGCommonValue* cv = pg->GetCommonValue(m_commonValue);
if ( argFlags & wxPG_FULL_VALUE ) if ( !!(flags & wxPGPropValFormatFlags::FullValue) )
{ {
return cv->GetLabel(); return cv->GetLabel();
} }
else if ( argFlags & wxPG_EDITABLE_VALUE ) else if ( !!(flags & wxPGPropValFormatFlags::EditableValue) )
{ {
return cv->GetEditableText(); return cv->GetEditableText();
} }
@ -1147,14 +1201,52 @@ wxString wxPGProperty::GetValueAsString( int argFlags ) const
} }
} }
bool wxPGProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const #if WXWIN_COMPATIBILITY_3_2
// By call to obsolete function we want to check if user-overriden function is still in use
bool wxPGProperty::IntToValueWithCheck(wxVariant& variant, int number, wxPGPropValFormatFlags flags) const
{
m_oldIntToValueCalled = false;
bool res = IntToValue(variant, number, static_cast<int>(flags));
if ( m_oldIntToValueCalled )
{
// Our own function was called - this implies that call was forwarded to the new overriding
// function and there is no need to call it explicitly.
}
else
{ // User-overriden obsolete function was called
wxFAIL_MSG(wxString::Format("in %s use IntoToValue with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
}
return res;
}
#endif // WXWIN_COMPATIBILITY_3_2
bool wxPGProperty::IntToValue( wxVariant& variant, int number, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
variant = (long)number; variant = (long)number;
return true; return true;
} }
#if WXWIN_COMPATIBILITY_3_2
// By call to obsolete function we want to check if user-overriden function is still in use#if WXWIN_COMPATIBILITY_3_2
bool wxPGProperty::StringToValueWithCheck(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags) const
{
m_oldStringToValueCalled = false;
bool res = StringToValue(variant, text, static_cast<int>(flags));
if ( m_oldStringToValueCalled )
{
// Our own function was called - this implies that call was forwarded to the new overriding
// function and there is no need to call it explicitly.
}
else
{ // User-overriden obsolete function was called
wxFAIL_MSG(wxString::Format("in %s use StringToValue with 'flags' argument as wxPGPropValFormatFlags", GetClassInfo()->GetClassName()));
}
return res;
}
#endif // WXWIN_COMPATIBILITY_3_2
// Convert semicolon delimited tokens into child values. // Convert semicolon delimited tokens into child values.
bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFlags ) const bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
if ( !HasAnyChild() ) if ( !HasAnyChild() )
return false; return false;
@ -1164,7 +1256,7 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
unsigned int iMax = m_children.size(); unsigned int iMax = m_children.size();
if ( iMax > PWC_CHILD_SUMMARY_LIMIT && if ( iMax > PWC_CHILD_SUMMARY_LIMIT &&
!(argFlags & wxPG_FULL_VALUE) ) !(flags & wxPGPropValFormatFlags::FullValue) )
iMax = PWC_CHILD_SUMMARY_LIMIT; iMax = PWC_CHILD_SUMMARY_LIMIT;
bool changed = false; bool changed = false;
@ -1181,7 +1273,7 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
wxVariantList temp_list; wxVariantList temp_list;
wxVariant list(temp_list); wxVariant list(temp_list);
int propagatedFlags = argFlags & (wxPG_REPORT_ERROR|wxPG_PROGRAMMATIC_VALUE); wxPGPropValFormatFlags propagatedFlags = flags & (wxPGPropValFormatFlags::ReportError|wxPGPropValFormatFlags::ProgrammaticValue);
wxLogTrace("propgrid", wxLogTrace("propgrid",
wxS(">> %s.StringToValue('%s')"), GetLabel(), text); wxS(">> %s.StringToValue('%s')"), GetLabel(), text);
@ -1216,14 +1308,20 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
token, childName); token, childName);
// Add only if editable or setting programmatically // Add only if editable or setting programmatically
if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) || if ( !!(flags & wxPGPropValFormatFlags::ProgrammaticValue) ||
(!child->HasFlag(wxPGPropertyFlags::Disabled) && (!child->HasFlag(wxPGPropertyFlags::Disabled) &&
!child->HasFlag(wxPGPropertyFlags::ReadOnly)) ) !child->HasFlag(wxPGPropertyFlags::ReadOnly)) )
{ {
if ( len > 0 ) if ( len > 0 )
{ {
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
if ( child->StringToValueWithCheck(variant, token,
propagatedFlags | wxPGPropValFormatFlags::CompositeFragment) )
#else
if ( child->StringToValue(variant, token, if ( child->StringToValue(variant, token,
propagatedFlags|wxPG_COMPOSITE_FRAGMENT) ) propagatedFlags | wxPGPropValFormatFlags::CompositeFragment) )
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
{ {
// We really need to set the variant's name // We really need to set the variant's name
// *after* child->StringToValue() has been // *after* child->StringToValue() has been
@ -1295,14 +1393,20 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
wxVariant oldChildValue = child->GetValue(); wxVariant oldChildValue = child->GetValue();
wxVariant variant(oldChildValue); wxVariant variant(oldChildValue);
if ( (argFlags & wxPG_PROGRAMMATIC_VALUE) || if ( !!(flags & wxPGPropValFormatFlags::ProgrammaticValue) ||
(!child->HasFlag(wxPGPropertyFlags::Disabled) && (!child->HasFlag(wxPGPropertyFlags::Disabled) &&
!child->HasFlag(wxPGPropertyFlags::ReadOnly)) ) !child->HasFlag(wxPGPropertyFlags::ReadOnly)) )
{ {
wxString childName = child->GetBaseName(); wxString childName = child->GetBaseName();
bool stvRes = child->StringToValue( variant, token, #if WXWIN_COMPATIBILITY_3_2
propagatedFlags ); // Special implementation with check if user-overriden obsolete function is still in use
bool stvRes = child->StringToValueWithCheck(variant, token,
propagatedFlags);
#else
bool stvRes = child->StringToValue(variant, token,
propagatedFlags);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
if ( stvRes || (variant != oldChildValue) ) if ( stvRes || (variant != oldChildValue) )
{ {
variant.SetName(childName); variant.SetName(childName);
@ -1350,19 +1454,19 @@ bool wxPGProperty::StringToValue( wxVariant& v, const wxString& text, int argFla
return changed; return changed;
} }
bool wxPGProperty::SetValueFromString( const wxString& text, int argFlags ) bool wxPGProperty::SetValueFromString( const wxString& text, wxPGPropValFormatFlags flags )
{ {
wxVariant variant(m_value); wxVariant variant(m_value);
bool res = StringToValue(variant, text, argFlags); bool res = StringToValue(variant, text, flags);
if ( res ) if ( res )
SetValue(variant); SetValue(variant);
return res; return res;
} }
bool wxPGProperty::SetValueFromInt( long number, int argFlags ) bool wxPGProperty::SetValueFromInt( long number, wxPGPropValFormatFlags flags )
{ {
wxVariant variant(m_value); wxVariant variant(m_value);
bool res = IntToValue(variant, number, argFlags); bool res = IntToValue(variant, number, flags);
if ( res ) if ( res )
SetValue(variant); SetValue(variant);
return res; return res;
@ -2901,15 +3005,15 @@ wxPropertyCategory::wxPropertyCategory( const wxString &label, const wxString& n
} }
wxString wxPropertyCategory::ValueToString( wxVariant& WXUNUSED(value), wxString wxPropertyCategory::ValueToString( wxVariant& WXUNUSED(value),
int WXUNUSED(argFlags) ) const wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
return m_value.IsType(wxPG_VARIANT_TYPE_STRING) ? m_value.GetString() : wxString(); return m_value.IsType(wxPG_VARIANT_TYPE_STRING) ? m_value.GetString() : wxString();
} }
wxString wxPropertyCategory::GetValueAsString( int argFlags ) const wxString wxPropertyCategory::GetValueAsString(wxPGPropValFormatFlags flags) const
{ {
// Unspecified value is always empty string // Unspecified value is always empty string
return IsValueUnspecified() ? wxString() : wxPGProperty::GetValueAsString(argFlags); return IsValueUnspecified() ? wxString() : wxPGProperty::GetValueAsString(flags);
} }
static int DoGetTextExtent(const wxWindow* wnd, const wxString& label, const wxFont& font) static int DoGetTextExtent(const wxWindow* wnd, const wxString& label, const wxFont& font)

View file

@ -3485,7 +3485,12 @@ wxVariant wxPropertyGrid::GetUncommittedPropertyValue()
if ( !tc || !IsEditorsValueModified() ) if ( !tc || !IsEditorsValueModified() )
return value; return value;
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
if ( !prop->StringToValueWithCheck(value, tc->GetValue()) )
#else
if ( !prop->StringToValue(value, tc->GetValue()) ) if ( !prop->StringToValue(value, tc->GetValue()) )
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
return value; return value;
if ( !PerformValidation(prop, value, IsStandaloneValidation) ) if ( !PerformValidation(prop, value, IsStandaloneValidation) )
@ -3865,13 +3870,13 @@ void wxPropertyGrid::CustomSetCursor( int type, bool override )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
wxString wxString
wxPropertyGrid::GetUnspecifiedValueText( int argFlags ) const wxPropertyGrid::GetUnspecifiedValueText(wxPGPropValFormatFlags flags) const
{ {
const wxPGCell& ua = GetUnspecifiedValueAppearance(); const wxPGCell& ua = GetUnspecifiedValueAppearance();
if ( ua.HasText() && if ( ua.HasText() &&
!(argFlags & wxPG_FULL_VALUE) && !(flags & wxPGPropValFormatFlags::FullValue) &&
!(argFlags & wxPG_EDITABLE_VALUE) ) !(flags & wxPGPropValFormatFlags::EditableValue) )
return ua.GetText(); return ua.GetText();
return wxString(); return wxString();
@ -5098,7 +5103,12 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
wxSize imageSize = GetImageSize(m_propHover, -1); wxSize imageSize = GetImageSize(m_propHover, -1);
if ( imageSize.x > 0 ) if ( imageSize.x > 0 )
imageWidth = imageSize.x; imageWidth = imageSize.x;
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
tipString = m_propHover->GetValueAsStringWithCheck();
#else
tipString = m_propHover->GetValueAsString(); tipString = m_propHover->GetValueAsString();
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
if ( GetColumnCount() <= 2 ) if ( GetColumnCount() <= 2 )
{ {
wxString unitsString = m_propHover->GetAttribute(wxPG_ATTR_UNITS, wxString()); wxString unitsString = m_propHover->GetAttribute(wxPG_ATTR_UNITS, wxString());
@ -6396,8 +6406,8 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass,
m_state->DoInsert(parent, -1, property); m_state->DoInsert(parent, -1, property);
if ( propValue ) if ( propValue )
property->SetValueFromString( *propValue, wxPG_FULL_VALUE| property->SetValueFromString( *propValue, wxPGPropValFormatFlags::FullValue|
wxPG_PROGRAMMATIC_VALUE ); wxPGPropValFormatFlags::ProgrammaticValue );
return property; return property;
} }

View file

@ -424,16 +424,16 @@ wxPGProperty* wxPropertyGridInterface::GetPropertyByLabel( const wxString& label
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxPropertyGridInterface::DoSetPropertyAttribute( wxPGPropArg id, const wxString& name, void wxPropertyGridInterface::DoSetPropertyAttribute( wxPGPropArg id, const wxString& name,
wxVariant& value, wxPGPropertyValuesFlags argFlags ) wxVariant& value, wxPGPropertyValuesFlags flags )
{ {
wxPG_PROP_ARG_CALL_PROLOG() wxPG_PROP_ARG_CALL_PROLOG()
p->SetAttribute( name, value ); // property is also refreshed here p->SetAttribute( name, value ); // property is also refreshed here
if ( !!(argFlags & wxPGPropertyValuesFlags::Recurse) ) if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{ {
for ( unsigned int i = 0; i < p->GetChildCount(); i++ ) for ( unsigned int i = 0; i < p->GetChildCount(); i++ )
DoSetPropertyAttribute(p->Item(i), name, value, argFlags); DoSetPropertyAttribute(p->Item(i), name, value, flags);
} }
} }
@ -748,7 +748,12 @@ wxVariant wxPropertyGridInterface::GetPropertyValue(wxPGPropArg id)
wxString wxPropertyGridInterface::GetPropertyValueAsString( wxPGPropArg id ) const wxString wxPropertyGridInterface::GetPropertyValueAsString( wxPGPropArg id ) const
{ {
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxString()) wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxString())
return p->GetValueAsString(wxPG_FULL_VALUE); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
return p->GetValueAsStringWithCheck(wxPGPropValFormatFlags::FullValue);
#else
return p->GetValueAsString(wxPGPropValFormatFlags::FullValue);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
} }
bool wxPropertyGridInterface::GetPropertyValueAsBool( wxPGPropArg id ) const bool wxPropertyGridInterface::GetPropertyValueAsBool( wxPGPropArg id ) const

View file

@ -1220,11 +1220,16 @@ bool wxPropertyGridPageState::DoSetPropertyValueString( wxPGProperty* p, const w
{ {
if ( p ) if ( p )
{ {
int flags = wxPG_REPORT_ERROR|wxPG_FULL_VALUE|wxPG_PROGRAMMATIC_VALUE; constexpr wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::ReportError|wxPGPropValFormatFlags::FullValue|wxPGPropValFormatFlags::ProgrammaticValue;
wxVariant variant = p->GetValueRef(); wxVariant variant = p->GetValueRef();
#if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
if ( p->StringToValueWithCheck(variant, value, flags) )
#else
if ( p->StringToValue(variant, value, flags) ) if ( p->StringToValue(variant, value, flags) )
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
{ {
p->SetValue(variant); p->SetValue(variant);
if ( p == m_pPropGrid->GetSelection() && IsDisplayed() ) if ( p == m_pPropGrid->GetSelection() && IsDisplayed() )

View file

@ -70,23 +70,23 @@ void wxStringProperty::OnSetValue()
} }
wxString wxStringProperty::ValueToString( wxVariant& value, wxString wxStringProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxString s = value.GetString(); wxString s = value.GetString();
if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) ) if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) )
{ {
// 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) || if ( !!(flags & wxPGPropValFormatFlags::FullValue) ||
(argFlags & wxPG_EDITABLE_VALUE) || !!(flags & wxPGPropValFormatFlags::EditableValue) ||
s.empty() ) s.empty() )
{ {
// Calling this under incorrect conditions will fail // Calling this under incorrect conditions will fail
wxASSERT_MSG( argFlags & wxPG_VALUE_IS_CURRENT, wxASSERT_MSG( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent),
wxS("Sorry, currently default wxPGProperty::ValueToString() ") wxS("Sorry, currently default wxPGProperty::ValueToString() ")
wxS("implementation only works if value is m_value.") ); wxS("implementation only works if value is m_value.") );
DoGenerateComposedValue(s, argFlags); DoGenerateComposedValue(s, flags);
} }
return s; return s;
@ -94,16 +94,16 @@ wxString wxStringProperty::ValueToString( wxVariant& value,
// If string is password and value is for visual purposes, // If string is password and value is for visual purposes,
// then return asterisks instead the actual string. // then return asterisks instead the actual string.
if ( !!(m_flags & wxPGPropertyFlags_Password) && !(argFlags & (wxPG_FULL_VALUE|wxPG_EDITABLE_VALUE)) ) if ( !!(m_flags & wxPGPropertyFlags_Password) && !(flags & (wxPGPropValFormatFlags::FullValue|wxPGPropValFormatFlags::EditableValue)) )
return wxString(wxS('*'), s.length()); return wxString(wxS('*'), s.length());
return s; return s;
} }
bool wxStringProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const bool wxStringProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) ) if ( HasAnyChild() && HasFlag(wxPGPropertyFlags::ComposedValue) )
return wxPGProperty::StringToValue(variant, text, argFlags); return wxPGProperty::StringToValue(variant, text, flags);
if ( variant != text ) if ( variant != text )
{ {
@ -251,7 +251,12 @@ namespace {
{ {
// Round value to the required precision. // Round value to the required precision.
wxVariant variant = value; wxVariant variant = value;
wxString strVal = prop->ValueToString(variant, wxPG_FULL_VALUE); #if WXWIN_COMPATIBILITY_3_2
// Special implementation with check if user-overriden obsolete function is still in use
wxString strVal = prop->ValueToStringWithCheck(variant, wxPGPropValFormatFlags::FullValue);
#else
wxString strVal = prop->ValueToString(variant, wxPGPropValFormatFlags::FullValue);
#endif // WXWIN_COMPATIBILITY_3_2 | !WXWIN_COMPATIBILITY_3_2
wxNumberFormatter::FromString(strVal, &value); wxNumberFormatter::FromString(strVal, &value);
return value; return value;
} }
@ -372,7 +377,7 @@ wxIntProperty::wxIntProperty( const wxString& label, const wxString& name,
#endif #endif
wxString wxIntProperty::ValueToString( wxVariant& value, wxString wxIntProperty::ValueToString( wxVariant& value,
int WXUNUSED(argFlags) ) const wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
const wxString valType(value.GetType()); const wxString valType(value.GetType());
if ( valType == wxPG_VARIANT_TYPE_LONG ) if ( valType == wxPG_VARIANT_TYPE_LONG )
@ -390,7 +395,7 @@ wxString wxIntProperty::ValueToString( wxVariant& value,
return wxString(); return wxString();
} }
bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
if ( text.empty() ) if ( text.empty() )
{ {
@ -445,13 +450,13 @@ bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int
} }
} }
} }
else if ( argFlags & wxPG_REPORT_ERROR ) else if ( !!(flags & wxPGPropValFormatFlags::ReportError) )
{ {
} }
return false; return false;
} }
bool wxIntProperty::IntToValue( wxVariant& variant, int value, int WXUNUSED(argFlags) ) const bool wxIntProperty::IntToValue( wxVariant& variant, int value, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
if ( !variant.IsType(wxPG_VARIANT_TYPE_LONG) || variant != (long)value ) if ( !variant.IsType(wxPG_VARIANT_TYPE_LONG) || variant != (long)value )
{ {
@ -586,7 +591,7 @@ wxUIntProperty::wxUIntProperty( const wxString& label, const wxString& name,
} }
#endif #endif
wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const wxString wxUIntProperty::ValueToString(wxVariant& value, wxPGPropValFormatFlags flags) const
{ {
static const wxStringCharType* const gs_uintTemplates32[wxPG_UINT_TEMPLATE_MAX] = static const wxStringCharType* const gs_uintTemplates32[wxPG_UINT_TEMPLATE_MAX] =
{ {
@ -639,7 +644,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
const wxString valType(value.GetType()); const wxString valType(value.GetType());
if ( valType == wxPG_VARIANT_TYPE_LONG ) if ( valType == wxPG_VARIANT_TYPE_LONG )
{ {
const wxStringCharType* fmt = argFlags & wxPG_EDITABLE_VALUE ? const wxStringCharType* fmt = !!(flags & wxPGPropValFormatFlags::EditableValue) ?
gs_uintEditTemplates32[index] : gs_uintEditTemplates32[index] :
gs_uintTemplates32[index]; gs_uintTemplates32[index];
return wxString::Format(fmt, (unsigned long)value.GetLong()); return wxString::Format(fmt, (unsigned long)value.GetLong());
@ -647,7 +652,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
#if wxUSE_LONGLONG #if wxUSE_LONGLONG
else if ( valType == wxPG_VARIANT_TYPE_ULONGLONG ) else if ( valType == wxPG_VARIANT_TYPE_ULONGLONG )
{ {
const wxStringCharType* fmt = argFlags & wxPG_EDITABLE_VALUE ? const wxStringCharType* fmt = !!(flags & wxPGPropValFormatFlags::EditableValue) ?
gs_uintEditTemplates64[index] : gs_uintEditTemplates64[index] :
gs_uintTemplates64[index]; gs_uintTemplates64[index];
wxULongLong ull = value.GetULongLong(); wxULongLong ull = value.GetULongLong();
@ -657,7 +662,7 @@ wxString wxUIntProperty::ValueToString(wxVariant& value, int argFlags) const
return wxString(); return wxString();
} }
bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, int argFlags) const bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags) const
{ {
if ( text.empty() ) if ( text.empty() )
{ {
@ -707,14 +712,14 @@ bool wxUIntProperty::StringToValue(wxVariant& variant, const wxString& text, int
return true; return true;
} }
} }
else if ( argFlags & wxPG_REPORT_ERROR ) else if ( !!(flags & wxPGPropValFormatFlags::ReportError) )
{ {
} }
return false; return false;
} }
bool wxUIntProperty::IntToValue( wxVariant& variant, int number, int WXUNUSED(argFlags) ) const bool wxUIntProperty::IntToValue( wxVariant& variant, int number, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
if ( variant != (long)number ) if ( variant != (long)number )
{ {
@ -920,19 +925,19 @@ const wxString& wxPropertyGrid::DoubleToString(wxString& target,
#endif // WXWIN_COMPATIBILITY_3_0 #endif // WXWIN_COMPATIBILITY_3_0
wxString wxFloatProperty::ValueToString( wxVariant& value, wxString wxFloatProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxString text; wxString text;
if ( !value.IsNull() ) if ( !value.IsNull() )
{ {
text = wxNumberFormatter::ToString(value.GetDouble(), m_precision, text = wxNumberFormatter::ToString(value.GetDouble(), m_precision,
argFlags & wxPG_FULL_VALUE ? wxNumberFormatter::Style_None !!(flags & wxPGPropValFormatFlags::FullValue) ? wxNumberFormatter::Style_None
: wxNumberFormatter::Style_NoTrailingZeroes); : wxNumberFormatter::Style_NoTrailingZeroes);
} }
return text; return text;
} }
bool wxFloatProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const bool wxFloatProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
if ( text.empty() ) if ( text.empty() )
{ {
@ -950,7 +955,7 @@ bool wxFloatProperty::StringToValue( wxVariant& variant, const wxString& text, i
return true; return true;
} }
} }
else if ( argFlags & wxPG_REPORT_ERROR ) else if ( !!(flags & wxPGPropValFormatFlags::ReportError) )
{ {
} }
return false; return false;
@ -1050,13 +1055,13 @@ wxBoolProperty::wxBoolProperty( const wxString& label, const wxString& name, boo
} }
wxString wxBoolProperty::ValueToString( wxVariant& value, wxString wxBoolProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
bool boolValue = 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 ( !!(flags & wxPGPropValFormatFlags::CompositeFragment) )
{ {
if ( boolValue ) if ( boolValue )
{ {
@ -1064,7 +1069,7 @@ wxString wxBoolProperty::ValueToString( wxVariant& value,
} }
else else
{ {
if ( argFlags & wxPG_UNEDITABLE_COMPOSITE_FRAGMENT ) if ( !!(flags & wxPGPropValFormatFlags::UneditableCompositeFragment) )
return wxString(); return wxString();
wxString notFmt; wxString notFmt;
@ -1077,7 +1082,7 @@ wxString wxBoolProperty::ValueToString( wxVariant& value,
} }
} }
if ( !(argFlags & wxPG_FULL_VALUE) ) if ( !(flags & wxPGPropValFormatFlags::FullValue) )
{ {
return wxPGGlobalVars->m_boolChoices[boolValue?1:0].GetText(); return wxPGGlobalVars->m_boolChoices[boolValue?1:0].GetText();
} }
@ -1085,7 +1090,7 @@ wxString wxBoolProperty::ValueToString( wxVariant& value,
return boolValue? wxS("true"): wxS("false"); return boolValue? wxS("true"): wxS("false");
} }
bool wxBoolProperty::StringToValue( wxVariant& variant, const wxString& text, int WXUNUSED(argFlags) ) const bool wxBoolProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
bool boolValue = false; bool boolValue = false;
if ( text.CmpNoCase(wxPGGlobalVars->m_boolChoices[1].GetText()) == 0 || if ( text.CmpNoCase(wxPGGlobalVars->m_boolChoices[1].GetText()) == 0 ||
@ -1107,7 +1112,7 @@ bool wxBoolProperty::StringToValue( wxVariant& variant, const wxString& text, in
return false; return false;
} }
bool wxBoolProperty::IntToValue( wxVariant& variant, int value, int ) const bool wxBoolProperty::IntToValue( wxVariant& variant, int value, wxPGPropValFormatFlags ) const
{ {
bool boolValue = (bool)value; bool boolValue = (bool)value;
@ -1229,11 +1234,11 @@ void wxEnumProperty::OnSetValue()
int index = -1; int index = -1;
if ( valType == wxPG_VARIANT_TYPE_LONG ) if ( valType == wxPG_VARIANT_TYPE_LONG )
{ {
ValueFromInt_(m_value, &index, m_value.GetLong(), wxPG_FULL_VALUE); ValueFromInt_(m_value, &index, m_value.GetLong(), wxPGPropValFormatFlags::FullValue);
} }
else if ( valType == wxPG_VARIANT_TYPE_STRING ) else if ( valType == wxPG_VARIANT_TYPE_STRING )
{ {
ValueFromString_(m_value, &index, m_value.GetString(), 0); ValueFromString_(m_value, &index, m_value.GetString(), wxPGPropValFormatFlags::Null);
} }
else else
{ {
@ -1250,13 +1255,13 @@ bool wxEnumProperty::ValidateValue( wxVariant& value, wxPGValidationInfo& WXUNUS
// unless property has string as preferred value type // unless property has string as preferred value type
// To reduce code size, use conversion here as well // To reduce code size, use conversion here as well
if ( value.IsType(wxPG_VARIANT_TYPE_STRING) ) if ( value.IsType(wxPG_VARIANT_TYPE_STRING) )
return ValueFromString_(value, nullptr, value.GetString(), wxPG_PROPERTY_SPECIFIC); return ValueFromString_(value, nullptr, value.GetString(), wxPGPropValFormatFlags::PropertySpecific);
return true; return true;
} }
wxString wxEnumProperty::ValueToString( wxVariant& value, wxString wxEnumProperty::ValueToString( wxVariant& value,
int WXUNUSED(argFlags) ) const wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
if ( value.IsType(wxPG_VARIANT_TYPE_STRING) ) if ( value.IsType(wxPG_VARIANT_TYPE_STRING) )
return value.GetString(); return value.GetString();
@ -1268,17 +1273,17 @@ wxString wxEnumProperty::ValueToString( wxVariant& value,
return m_choices.GetLabel(index); return m_choices.GetLabel(index);
} }
bool wxEnumProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const bool wxEnumProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
return ValueFromString_(variant, nullptr, text, argFlags); return ValueFromString_(variant, nullptr, text, flags);
} }
bool wxEnumProperty::IntToValue( wxVariant& variant, int intVal, int argFlags ) const bool wxEnumProperty::IntToValue( wxVariant& variant, int intVal, wxPGPropValFormatFlags flags ) const
{ {
return ValueFromInt_(variant, nullptr, intVal, argFlags); return ValueFromInt_(variant, nullptr, intVal, flags);
} }
bool wxEnumProperty::ValueFromString_(wxVariant& value, int* pIndex, const wxString& text, int WXUNUSED(argFlags)) const bool wxEnumProperty::ValueFromString_(wxVariant& value, int* pIndex, const wxString& text, wxPGPropValFormatFlags WXUNUSED(flags)) const
{ {
int useIndex = -1; int useIndex = -1;
long useValue = 0; long useValue = 0;
@ -1313,13 +1318,13 @@ bool wxEnumProperty::ValueFromString_(wxVariant& value, int* pIndex, const wxStr
return false; return false;
} }
bool wxEnumProperty::ValueFromInt_(wxVariant& value, int* pIndex, int intVal, int argFlags) const bool wxEnumProperty::ValueFromInt_(wxVariant& value, int* pIndex, int intVal, wxPGPropValFormatFlags flags) const
{ {
// If wxPG_FULL_VALUE is *not* in argFlags, then intVal is index from combo box. // If wxPGPropValFormatFlags::FullValue is *not* in flags, then intVal is index from combo box.
// //
int setAsNextIndex = -2; int setAsNextIndex = -2;
if ( argFlags & wxPG_FULL_VALUE ) if ( !!(flags & wxPGPropValFormatFlags::FullValue) )
{ {
setAsNextIndex = GetIndexForValue( intVal ); setAsNextIndex = GetIndexForValue( intVal );
} }
@ -1333,7 +1338,7 @@ bool wxEnumProperty::ValueFromInt_(wxVariant& value, int* pIndex, int intVal, in
if ( setAsNextIndex != -2 ) if ( setAsNextIndex != -2 )
{ {
if ( !(argFlags & wxPG_FULL_VALUE) ) if ( !(flags & wxPGPropValFormatFlags::FullValue) )
intVal = m_choices.GetValue(intVal); intVal = m_choices.GetValue(intVal);
value = (long)intVal; value = (long)intVal;
@ -1406,12 +1411,12 @@ void wxEditEnumProperty::OnSetValue()
int index = -1; int index = -1;
if ( valType == wxPG_VARIANT_TYPE_LONG ) if ( valType == wxPG_VARIANT_TYPE_LONG )
{ {
ValueFromInt_(m_value, &index, m_value.GetLong(), wxPG_FULL_VALUE); ValueFromInt_(m_value, &index, m_value.GetLong(), wxPGPropValFormatFlags::FullValue);
} }
else if ( valType == wxPG_VARIANT_TYPE_STRING ) else if ( valType == wxPG_VARIANT_TYPE_STRING )
{ {
wxString val = m_value.GetString(); wxString val = m_value.GetString();
ValueFromString_(m_value, &index, val, 0); ValueFromString_(m_value, &index, val, wxPGPropValFormatFlags::Null);
// If text is not any of the choices, store as plain text instead. // If text is not any of the choices, store as plain text instead.
if (index == -1) if (index == -1)
{ {
@ -1428,10 +1433,10 @@ void wxEditEnumProperty::OnSetValue()
} }
bool wxEditEnumProperty::StringToValue(wxVariant& variant, bool wxEditEnumProperty::StringToValue(wxVariant& variant,
const wxString& text, int argFlags) const const wxString& text, wxPGPropValFormatFlags flags) const
{ {
int index; int index;
bool res = ValueFromString_(variant, &index, text, argFlags); bool res = ValueFromString_(variant, &index, text, flags);
// If text is not any of the choices, store as plain text instead. // If text is not any of the choices, store as plain text instead.
if (index == -1) if (index == -1)
{ {
@ -1588,7 +1593,7 @@ void wxFlagsProperty::OnSetValue()
} }
wxString wxFlagsProperty::ValueToString( wxVariant& value, wxString wxFlagsProperty::ValueToString( wxVariant& value,
int WXUNUSED(argFlags) ) const wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
wxString text; wxString text;
@ -1616,7 +1621,7 @@ wxString wxFlagsProperty::ValueToString( wxVariant& value,
} }
// Translate string into flag tokens // Translate string into flag tokens
bool wxFlagsProperty::StringToValue( wxVariant& variant, const wxString& text, int ) const bool wxFlagsProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags ) const
{ {
if ( !m_choices.IsOk() ) if ( !m_choices.IsOk() )
return false; return false;
@ -1741,12 +1746,12 @@ wxDirProperty::wxDirProperty( const wxString& label, const wxString& name, const
SetValue(value); SetValue(value);
} }
wxString wxDirProperty::ValueToString(wxVariant& value, int WXUNUSED(argFlags)) const wxString wxDirProperty::ValueToString(wxVariant& value, wxPGPropValFormatFlags WXUNUSED(flags)) const
{ {
return value; return value;
} }
bool wxDirProperty::StringToValue(wxVariant& variant, const wxString& text, int) const bool wxDirProperty::StringToValue(wxVariant& variant, const wxString& text, wxPGPropValFormatFlags) const
{ {
if ( variant != text ) if ( variant != text )
{ {
@ -1959,7 +1964,7 @@ wxFileName wxFileProperty::GetFileName() const
} }
wxString wxFileProperty::ValueToString( wxVariant& value, wxString wxFileProperty::ValueToString( wxVariant& value,
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
wxFileName filename = value.GetString(); wxFileName filename = value.GetString();
@ -1970,7 +1975,7 @@ wxString wxFileProperty::ValueToString( wxVariant& value,
if ( fullName.empty() ) if ( fullName.empty() )
return wxString(); return wxString();
if ( argFlags & wxPG_FULL_VALUE ) if ( !!(flags & wxPGPropValFormatFlags::FullValue) )
{ {
return filename.GetFullPath(); return filename.GetFullPath();
} }
@ -1988,11 +1993,11 @@ wxString wxFileProperty::ValueToString( wxVariant& value,
return filename.GetFullName(); return filename.GetFullName();
} }
bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, int argFlags ) const bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags flags ) const
{ {
wxFileName filename = variant.GetString(); wxFileName filename = variant.GetString();
if ( !!(m_flags & wxPGPropertyFlags::ShowFullFileName) || (argFlags & wxPG_FULL_VALUE) ) if ( !!(m_flags & wxPGPropertyFlags::ShowFullFileName) || !!(flags & wxPGPropValFormatFlags::FullValue) )
{ {
if ( filename != text ) if ( filename != text )
{ {
@ -2101,7 +2106,7 @@ wxLongStringProperty::wxLongStringProperty( const wxString& label, const wxStrin
} }
wxString wxLongStringProperty::ValueToString( wxVariant& value, wxString wxLongStringProperty::ValueToString( wxVariant& value,
int WXUNUSED(argFlags) ) const wxPGPropValFormatFlags WXUNUSED(flags) ) const
{ {
return value; return value;
} }
@ -2164,7 +2169,7 @@ bool wxLongStringProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& va
return false; return false;
} }
bool wxLongStringProperty::StringToValue( wxVariant& variant, const wxString& text, int ) const bool wxLongStringProperty::StringToValue( wxVariant& variant, const wxString& text, wxPGPropValFormatFlags ) const
{ {
if ( variant != text ) if ( variant != text )
{ {
@ -2570,11 +2575,11 @@ wxString wxArrayStringProperty::ConvertArrayToString(const wxArrayString& arr,
} }
wxString wxArrayStringProperty::ValueToString( wxVariant& WXUNUSED(value), wxString wxArrayStringProperty::ValueToString( wxVariant& WXUNUSED(value),
int argFlags ) const wxPGPropValFormatFlags flags ) const
{ {
// //
// If this is called from GetValueAsString(), return cached string // If this is called from GetValueAsString(), return cached string
if ( argFlags & wxPG_VALUE_IS_CURRENT ) if ( !!(flags & wxPGPropValFormatFlags::ValueIsCurrent) )
{ {
return m_display; return m_display;
} }
@ -2723,7 +2728,7 @@ bool wxArrayStringProperty::DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& v
} }
bool wxArrayStringProperty::StringToValue( wxVariant& variant, bool wxArrayStringProperty::StringToValue( wxVariant& variant,
const wxString& text, int ) const const wxString& text, wxPGPropValFormatFlags ) const
{ {
wxArrayString arr; wxArrayString arr;