diff --git a/include/wx/propgrid/property.h b/include/wx/propgrid/property.h index d245dec3f9..19e16d8843 100644 --- a/include/wx/propgrid/property.h +++ b/include/wx/propgrid/property.h @@ -1293,7 +1293,7 @@ public: @remarks - Default behaviour is to return wxSize(0,0), which means no image. - Default image width or height is indicated with dimension -1. - - You can also return wxPG_DEFAULT_IMAGE_SIZE, i.e. wxSize(-1, -1). + - You can also return wxPG_DEFAULT_IMAGE_SIZE, i.e. wxDefaultSize. */ virtual wxSize OnMeasureImage( int item = -1 ) const; diff --git a/include/wx/propgrid/propgriddefs.h b/include/wx/propgrid/propgriddefs.h index e25a091d60..bed733cda2 100644 --- a/include/wx/propgrid/propgriddefs.h +++ b/include/wx/propgrid/propgriddefs.h @@ -246,7 +246,7 @@ class wxPGValidationInfo; /** If property is supposed to have custom-painted image, then returning this in OnMeasureImage() will usually be enough. */ -#define wxPG_DEFAULT_IMAGE_SIZE wxSize(-1, -1) +#define wxPG_DEFAULT_IMAGE_SIZE wxDefaultSize /** This callback function is used for sorting properties. diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index cf7de3a8d7..b0c3f4fee0 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -802,7 +802,7 @@ wxVariant wxFontProperty::ChildChanged( wxVariant& thisValue, /* wxSize wxFontProperty::OnMeasureImage() const { - return wxSize(-1,-1); + return wxPG_DEFAULT_IMAGE_SIZE; } void wxFontProperty::OnCustomPaint(wxDC& dc, diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp index f141bfd9f5..20901cce8b 100644 --- a/src/propgrid/property.cpp +++ b/src/propgrid/property.cpp @@ -543,7 +543,7 @@ void wxPGProperty::InitAfterAdded( wxPropertyGridPageState* pageState, // Set custom image flag. int custImgHeight = OnMeasureImage().y; - if ( custImgHeight < 0 ) + if ( custImgHeight == wxDefaultCoord ) { SetFlag(wxPG_PROP_CUSTOMIMAGE); } @@ -2288,7 +2288,7 @@ void wxPGProperty::DoPreAddChild( int index, wxPGProperty* prop ) prop ); int custImgHeight = prop->OnMeasureImage().y; - if ( custImgHeight < 0 /*|| custImgHeight > 1*/ ) + if ( custImgHeight == wxDefaultCoord /*|| custImgHeight > 1*/ ) prop->m_flags |= wxPG_PROP_CUSTOMIMAGE; prop->m_parent = this; diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 4c08519c20..072156b596 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -3777,7 +3777,8 @@ wxRect wxPropertyGrid::GetEditorWidgetRect( wxPGProperty* p, int column ) const { //m_iFlags |= wxPG_FL_CUR_USES_CUSTOM_IMAGE; int iw = p->OnMeasureImage().x; - if ( iw < 1 ) + wxASSERT( iw == wxDefaultCoord || iw >= 0 ); + if ( iw == wxDefaultCoord || iw == 0 ) iw = wxPG_CUSTOM_IMAGE_WIDTH; imageOffset = p->GetImageOffset(iw); } @@ -3827,17 +3828,15 @@ wxSize wxPropertyGrid::GetImageSize( wxPGProperty* p, int item ) const else if ( item >= 0 && choiceCount == 0 ) return wxSize(0, 0); - if ( cis.x < 0 ) + wxASSERT( cis.x == wxDefaultCoord || cis.x >= 0 ); + if ( cis.x == wxDefaultCoord ) { - if ( cis.x <= -1 ) - cis.x = wxPG_CUSTOM_IMAGE_WIDTH; + cis.x = wxPG_CUSTOM_IMAGE_WIDTH; } - if ( cis.y <= 0 ) + wxASSERT( cis.y == wxDefaultCoord || cis.y >= 0 ); + if ( cis.y == wxDefaultCoord || cis.y == 0 ) { - if ( cis.y >= -1 ) - cis.y = wxPG_STD_CUST_IMAGE_HEIGHT(m_lineHeight); - else - cis.y = -cis.y; + cis.y = wxPG_STD_CUST_IMAGE_HEIGHT(m_lineHeight); } return cis; }