Use standard wxVariant instead of wxPropertyGrid-specific WXVARIANT

There is no need to use WXVARIANT for data types directly supported by wxVariant.
This commit is contained in:
Artur Wieczorek
2019-06-15 20:19:34 +02:00
parent d404ff02a1
commit 98c1b057e8
4 changed files with 14 additions and 18 deletions

View File

@@ -1013,28 +1013,28 @@ public:
// Sets value (native 64-bit int) of a property. // Sets value (native 64-bit int) of a property.
void SetPropertyValue(wxPGPropArg id, wxLongLong_t value) void SetPropertyValue(wxPGPropArg id, wxLongLong_t value)
{ {
wxVariant v = WXVARIANT(wxLongLong(value)); wxVariant v = wxLongLong(value);
SetPropVal(id, v); SetPropVal(id, v);
} }
#endif #endif
// Sets value (wxLongLong) of a property. // Sets value (wxLongLong) of a property.
void SetPropertyValue( wxPGPropArg id, wxLongLong value ) void SetPropertyValue( wxPGPropArg id, wxLongLong value )
{ {
wxVariant v = WXVARIANT(value); wxVariant v(value);
SetPropVal( id, v ); SetPropVal( id, v );
} }
#ifdef wxULongLong_t #ifdef wxULongLong_t
// Sets value (native 64-bit unsigned int) of a property. // Sets value (native 64-bit unsigned int) of a property.
void SetPropertyValue(wxPGPropArg id, wxULongLong_t value) void SetPropertyValue(wxPGPropArg id, wxULongLong_t value)
{ {
wxVariant v = WXVARIANT(wxULongLong(value)); wxVariant v = wxULongLong(value);
SetPropVal(id, v); SetPropVal(id, v);
} }
#endif #endif
// Sets value (wxULongLong) of a property. // Sets value (wxULongLong) of a property.
void SetPropertyValue( wxPGPropArg id, wxULongLong value ) void SetPropertyValue( wxPGPropArg id, wxULongLong value )
{ {
wxVariant v = WXVARIANT(value); wxVariant v(value);
SetPropVal( id, v ); SetPropVal( id, v );
} }
#endif #endif

View File

@@ -2169,8 +2169,6 @@ bool wxMultiChoiceProperty::OnEvent( wxPropertyGrid* propgrid,
{ {
wxArrayInt arrInt = dlg.GetSelections(); wxArrayInt arrInt = dlg.GetSelections();
wxVariant variant;
// Strings that were not in list of choices // Strings that were not in list of choices
wxArrayString value; wxArrayString value;
@@ -2192,9 +2190,7 @@ bool wxMultiChoiceProperty::OnEvent( wxPropertyGrid* propgrid,
value.push_back(extraStrings[n]); value.push_back(extraStrings[n]);
} }
variant = WXVARIANT(value); SetValueInEvent(wxVariant(value));
SetValueInEvent(variant);
return true; return true;
} }
@@ -2211,7 +2207,7 @@ bool wxMultiChoiceProperty::StringToValue( wxVariant& variant, const wxString& t
arr.Add(token); arr.Add(token);
WX_PG_TOKENIZER2_END() WX_PG_TOKENIZER2_END()
wxVariant v( WXVARIANT(arr) ); wxVariant v(arr);
variant = v; variant = v;
return true; return true;

View File

@@ -1592,9 +1592,9 @@ wxVariant wxPGProperty::GetDefaultValue() const
return wxVariant(wxArrayString()); return wxVariant(wxArrayString());
#if wxUSE_LONGLONG #if wxUSE_LONGLONG
if ( valueType == wxPG_VARIANT_TYPE_LONGLONG ) if ( valueType == wxPG_VARIANT_TYPE_LONGLONG )
return WXVARIANT(wxLongLong(0)); return wxVariant(wxLongLong(0));
if ( valueType == wxPG_VARIANT_TYPE_ULONGLONG ) if ( valueType == wxPG_VARIANT_TYPE_ULONGLONG )
return WXVARIANT(wxULongLong(0)); return wxVariant(wxULongLong(0));
#endif #endif
if ( valueType == wxS("wxColour") ) if ( valueType == wxS("wxColour") )
return WXVARIANT(*wxBLACK); return WXVARIANT(*wxBLACK);

View File

@@ -230,7 +230,7 @@ wxIntProperty::wxIntProperty( const wxString& label, const wxString& name,
wxIntProperty::wxIntProperty( const wxString& label, const wxString& name, wxIntProperty::wxIntProperty( const wxString& label, const wxString& name,
const wxLongLong& value ) : wxPGProperty(label,name) const wxLongLong& value ) : wxPGProperty(label,name)
{ {
SetValue(WXVARIANT(value)); SetValue(wxVariant(value));
} }
#endif #endif
@@ -485,7 +485,7 @@ bool NumericValidation( const wxPGProperty* property,
if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ) if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
{ {
wxString msg; wxString msg;
wxVariant vmin = WXVARIANT(min); wxVariant vmin = min;
wxString smin = property->ValueToString(vmin); wxString smin = property->ValueToString(vmin);
if ( !maxOk ) if ( !maxOk )
msg = wxString::Format( msg = wxString::Format(
@@ -493,7 +493,7 @@ bool NumericValidation( const wxPGProperty* property,
smin); smin);
else else
{ {
wxVariant vmax = WXVARIANT(max); wxVariant vmax = max;
wxString smax = property->ValueToString(vmax); wxString smax = property->ValueToString(vmax);
msg = wxString::Format( msg = wxString::Format(
_("Value must be between %s and %s."), _("Value must be between %s and %s."),
@@ -516,7 +516,7 @@ bool NumericValidation( const wxPGProperty* property,
if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ) if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
{ {
wxString msg; wxString msg;
wxVariant vmax = WXVARIANT(max); wxVariant vmax = max;
wxString smax = property->ValueToString(vmax); wxString smax = property->ValueToString(vmax);
if ( !minOk ) if ( !minOk )
msg = wxString::Format( msg = wxString::Format(
@@ -524,7 +524,7 @@ bool NumericValidation( const wxPGProperty* property,
smax); smax);
else else
{ {
wxVariant vmin = WXVARIANT(min); wxVariant vmin = min;
wxString smin = property->ValueToString(vmin); wxString smin = property->ValueToString(vmin);
msg = wxString::Format( msg = wxString::Format(
_("Value must be between %s and %s."), _("Value must be between %s and %s."),
@@ -645,7 +645,7 @@ wxUIntProperty::wxUIntProperty( const wxString& label, const wxString& name,
const wxULongLong& value ) : wxPGProperty(label,name) const wxULongLong& value ) : wxPGProperty(label,name)
{ {
Init(); Init();
SetValue(WXVARIANT(value)); SetValue(wxVariant(value));
} }
#endif #endif