Use predefined constants to represent wxPG variant types.

Instead of using individual string literals use globally defined constants representing wxPG variant types.
This commit is contained in:
Artur Wieczorek
2015-03-29 21:38:51 +02:00
parent 5353a00180
commit 4e7fbd4e92
4 changed files with 11 additions and 11 deletions

View File

@@ -343,7 +343,7 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper
if ( property->GetAttributeAsLong(wxPG_ATTR_SPINCTRL_WRAP, 0) )
mode = wxPG_PROPERTY_VALIDATION_WRAP;
if ( property->GetValueType() == wxT("double") )
if ( property->GetValueType() == wxPG_VARIANT_TYPE_DOUBLE )
{
double v_d;
double step = property->GetAttributeAsDouble(wxPG_ATTR_SPINCTRL_STEP, 1.0);
@@ -483,7 +483,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri
wxDateTime dateValue(wxInvalidDateTime);
wxVariant value = prop->GetValue();
if ( value.IsType(wxT("datetime")) )
if ( value.IsType(wxPG_VARIANT_TYPE_DATETIME) )
dateValue = value.GetDateTime();
ctrl->Create(propgrid->GetPanel(),
@@ -509,7 +509,7 @@ void wxPGDatePickerCtrlEditor::UpdateControl( wxPGProperty* property,
wxDateTime dateValue(wxInvalidDateTime);
wxVariant v(property->GetValue());
if ( v.IsType(wxT("datetime")) )
if ( v.IsType(wxPG_VARIANT_TYPE_DATETIME) )
dateValue = v.GetDateTime();
ctrl->SetValue( dateValue );
@@ -2204,7 +2204,7 @@ void wxDateProperty::OnSetValue()
{
//
// Convert invalid dates to unspecified value
if ( m_value.IsType(wxT("datetime")) )
if ( m_value.IsType(wxPG_VARIANT_TYPE_DATETIME) )
{
if ( !m_value.GetDateTime().IsValid() )
m_value.MakeNull();

View File

@@ -1984,7 +1984,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
wxVariant attrVal = prop->GetAttribute(wxPG_ATTR_AUTOCOMPLETE);
if ( !attrVal.IsNull() )
{
wxASSERT(attrVal.IsType(wxS("arrstring")));
wxASSERT(attrVal.IsType(wxPG_VARIANT_TYPE_ARRSTRING));
tc->AutoComplete(attrVal.GetArrayString());
}

View File

@@ -732,7 +732,7 @@ TRET wxPropertyGridInterface::GetPropertyValueAs##BIGNAME( wxPGPropArg id ) cons
{ \
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFRETVAL) \
wxVariant value = p->GetValue(); \
if ( wxStrcmp(value.GetType(), wxPGTypeName_##T) != 0 ) \
if ( !value.IsType(wxPGTypeName_##T) ) \
{ \
wxPGGetFailed(p,wxPGTypeName_##T); \
return (TRET)DEFRETVAL; \
@@ -751,15 +751,15 @@ bool wxPropertyGridInterface::GetPropertyValueAsBool( wxPGPropArg id ) const
{
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
wxVariant value = p->GetValue();
if ( wxStrcmp(value.GetType(), wxPGTypeName_bool) == 0 )
if ( value.IsType(wxPG_VARIANT_TYPE_BOOL) )
{
return value.GetBool();
}
if ( wxStrcmp(value.GetType(), wxPGTypeName_long) == 0 )
if ( value.IsType(wxPG_VARIANT_TYPE_LONG) )
{
return value.GetLong()?true:false;
}
wxPGGetFailed(p,wxPGTypeName_bool);
wxPGGetFailed(p, wxPG_VARIANT_TYPE_BOOL);
return false;
}

View File

@@ -1574,7 +1574,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
wxPGProperty* p = foundProp;
// If it was a list, we still have to go through it.
if ( wxStrcmp(current->GetType(), wxS("list")) == 0 )
if ( current->IsType(wxPG_VARIANT_TYPE_LIST) )
{
DoSetPropertyValues( current->GetList(),
p->IsCategory()?p:(NULL)
@@ -1595,7 +1595,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
else
{
// Is it list?
if ( !current->IsType(wxS("list")) )
if ( !current->IsType(wxPG_VARIANT_TYPE_LIST) )
{
// Not.
}