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.
void SetPropertyValue(wxPGPropArg id, wxLongLong_t value)
{
wxVariant v = WXVARIANT(wxLongLong(value));
wxVariant v = wxLongLong(value);
SetPropVal(id, v);
}
#endif
// Sets value (wxLongLong) of a property.
void SetPropertyValue( wxPGPropArg id, wxLongLong value )
{
wxVariant v = WXVARIANT(value);
wxVariant v(value);
SetPropVal( id, v );
}
#ifdef wxULongLong_t
// Sets value (native 64-bit unsigned int) of a property.
void SetPropertyValue(wxPGPropArg id, wxULongLong_t value)
{
wxVariant v = WXVARIANT(wxULongLong(value));
wxVariant v = wxULongLong(value);
SetPropVal(id, v);
}
#endif
// Sets value (wxULongLong) of a property.
void SetPropertyValue( wxPGPropArg id, wxULongLong value )
{
wxVariant v = WXVARIANT(value);
wxVariant v(value);
SetPropVal( id, v );
}
#endif

View File

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

View File

@@ -1592,9 +1592,9 @@ wxVariant wxPGProperty::GetDefaultValue() const
return wxVariant(wxArrayString());
#if wxUSE_LONGLONG
if ( valueType == wxPG_VARIANT_TYPE_LONGLONG )
return WXVARIANT(wxLongLong(0));
return wxVariant(wxLongLong(0));
if ( valueType == wxPG_VARIANT_TYPE_ULONGLONG )
return WXVARIANT(wxULongLong(0));
return wxVariant(wxULongLong(0));
#endif
if ( valueType == wxS("wxColour") )
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,
const wxLongLong& value ) : wxPGProperty(label,name)
{
SetValue(WXVARIANT(value));
SetValue(wxVariant(value));
}
#endif
@@ -485,7 +485,7 @@ bool NumericValidation( const wxPGProperty* property,
if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
{
wxString msg;
wxVariant vmin = WXVARIANT(min);
wxVariant vmin = min;
wxString smin = property->ValueToString(vmin);
if ( !maxOk )
msg = wxString::Format(
@@ -493,7 +493,7 @@ bool NumericValidation( const wxPGProperty* property,
smin);
else
{
wxVariant vmax = WXVARIANT(max);
wxVariant vmax = max;
wxString smax = property->ValueToString(vmax);
msg = wxString::Format(
_("Value must be between %s and %s."),
@@ -516,7 +516,7 @@ bool NumericValidation( const wxPGProperty* property,
if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE )
{
wxString msg;
wxVariant vmax = WXVARIANT(max);
wxVariant vmax = max;
wxString smax = property->ValueToString(vmax);
if ( !minOk )
msg = wxString::Format(
@@ -524,7 +524,7 @@ bool NumericValidation( const wxPGProperty* property,
smax);
else
{
wxVariant vmin = WXVARIANT(min);
wxVariant vmin = min;
wxString smin = property->ValueToString(vmin);
msg = wxString::Format(
_("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)
{
Init();
SetValue(WXVARIANT(value));
SetValue(wxVariant(value));
}
#endif