Use wxVariant::IsType() function to check the type of variant values in wxPG.
Since there is a dedicated function to check the type of variant then there is not necessary to call wxVariant::GetType() function and perform explicit comparisons of returned strings.
This commit is contained in:
@@ -483,7 +483,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri
|
||||
wxDateTime dateValue(wxInvalidDateTime);
|
||||
|
||||
wxVariant value = prop->GetValue();
|
||||
if ( value.GetType() == wxT("datetime") )
|
||||
if ( value.IsType(wxT("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.GetType() == wxT("datetime") )
|
||||
if ( v.IsType(wxT("datetime")) )
|
||||
dateValue = v.GetDateTime();
|
||||
|
||||
ctrl->SetValue( dateValue );
|
||||
@@ -697,7 +697,7 @@ bool wxFontProperty::OnEvent( wxPropertyGrid* propgrid, wxWindow* WXUNUSED(prima
|
||||
wxFontData data;
|
||||
wxFont font;
|
||||
|
||||
if ( useValue.GetType() == wxS("wxFont") )
|
||||
if ( useValue.IsType(wxS("wxFont")) )
|
||||
font << useValue;
|
||||
|
||||
data.SetInitialFont( font );
|
||||
@@ -1069,7 +1069,7 @@ int wxSystemColourProperty::ColToInd( const wxColour& colour ) const
|
||||
void wxSystemColourProperty::OnSetValue()
|
||||
{
|
||||
// Convert from generic wxobject ptr to wxPGVariantDataColour
|
||||
if ( m_value.GetType() == wxS("wxColour*") )
|
||||
if ( m_value.IsType(wxS("wxColour*")) )
|
||||
{
|
||||
wxColour* pCol = wxStaticCast(m_value.GetWxObjectPtr(), wxColour);
|
||||
m_value << *pCol;
|
||||
@@ -1093,7 +1093,7 @@ void wxSystemColourProperty::OnSetValue()
|
||||
|
||||
int ind = wxNOT_FOUND;
|
||||
|
||||
if ( m_value.GetType() == wxS("wxColourPropertyValue") )
|
||||
if ( m_value.IsType(wxS("wxColourPropertyValue")) )
|
||||
{
|
||||
wxColourPropertyValue cpv;
|
||||
cpv << m_value;
|
||||
@@ -1218,7 +1218,7 @@ int wxSystemColourProperty::GetCustomColourIndex() const
|
||||
|
||||
bool wxSystemColourProperty::QueryColourFromUser( wxVariant& variant ) const
|
||||
{
|
||||
wxASSERT( m_value.GetType() != wxPG_VARIANT_TYPE_STRING );
|
||||
wxASSERT( !m_value.IsType(wxPG_VARIANT_TYPE_STRING) );
|
||||
bool res = false;
|
||||
|
||||
wxPropertyGrid* propgrid = GetGrid();
|
||||
@@ -2018,7 +2018,7 @@ void wxMultiChoiceProperty::GenerateValueAsString( wxVariant& value,
|
||||
{
|
||||
wxArrayString strings;
|
||||
|
||||
if ( value.GetType() == wxPG_VARIANT_TYPE_ARRSTRING )
|
||||
if ( value.IsType(wxPG_VARIANT_TYPE_ARRSTRING) )
|
||||
strings = value.GetArrayString();
|
||||
|
||||
wxString& tempStr = *target;
|
||||
@@ -2204,7 +2204,7 @@ void wxDateProperty::OnSetValue()
|
||||
{
|
||||
//
|
||||
// Convert invalid dates to unspecified value
|
||||
if ( m_value.GetType() == wxT("datetime") )
|
||||
if ( m_value.IsType(wxT("datetime")) )
|
||||
{
|
||||
if ( !m_value.GetDateTime().IsValid() )
|
||||
m_value.MakeNull();
|
||||
|
||||
Reference in New Issue
Block a user