From a6570433b6acb8de2e102816091fcf7848cb0ed0 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Fri, 28 Dec 2018 13:58:38 +0100 Subject: [PATCH] Change wxPGProperty::OnCustomPaint measure item call signature Because horizontally scrolled wxPGProperty can have x-coordinate < 0 so there is a need to change measure item call signature from rect.x < 0 condition to something more specific to avoid misinterpretation of the calls. --- interface/wx/propgrid/property.h | 11 ++++++----- src/propgrid/editors.cpp | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index e60002a638..48e0e21dbe 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -1147,16 +1147,17 @@ public: NOTE: Following applies when OnMeasureImage() returns a "flexible" height ( using wxPG_FLEXIBLE_SIZE(W,H) macro), which implies variable height items: - If rect.x is < 0, then this is a measure item call, which means that - dc is invalid and only thing that should be done is to set paintdata.m_drawnHeight - to the height of the image of item at index paintdata.m_choiceItem. This call - may be done even as often as once every drop-down popup show. + If (rect.x+rect.width) is < 0, then this is a measure item call, which + means that dc is invalid and only thing that should be done is to set + paintdata.m_drawnHeight to the height of the image of item at index + paintdata.m_choiceItem. This call may be done even as often as once every + drop-down popup show. @param dc wxDC to paint on. @param rect Box reserved for custom graphics. Includes surrounding rectangle, if any. - If x is < 0, then this is a measure item call (see above). + If x+width is < 0, then this is a measure item call (see above). @param paintdata wxPGPaintData structure with much useful data about painted item. @code diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index 160004b02f..b4dc593346 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -797,7 +797,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, cis = GetImageSize(p, item); } - if ( rect.x < 0 ) + if ( rect.x + rect.width < 0 ) { // Default measure behaviour (no flexible, custom paint image only) if ( rect.width < 0 )