Fix drawing empty wxPropertyGrid

If wxPG doesn't contain any visible items it's entire area should
be erased so we need to return -1 as a last drawn line index to ensure
that painted area will be clared from 0 y-coordinate.

Closes #18666.
This commit is contained in:
Artur Wieczorek
2020-02-12 17:03:58 +01:00
parent ee8009af64
commit 489cc1cb36

View File

@@ -2040,10 +2040,11 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
const wxRect* itemsRect ) const const wxRect* itemsRect ) const
#endif #endif
{ {
const wxPGProperty* firstItem; const wxPGProperty* firstItem = DoGetItemAtY(itemsRect->y);
firstItem = DoGetItemAtY(itemsRect->y); if ( !firstItem ) // Signal a need to clear entire paint area if grid is empty
return -1;
if ( IsFrozen() || m_height < 1 || firstItem == NULL ) if ( IsFrozen() || m_height < 1 )
return itemsRect->GetBottom(); return itemsRect->GetBottom();
wxCHECK_MSG( !m_pState->m_itemsAdded, itemsRect->GetBottom(), wxCHECK_MSG( !m_pState->m_itemsAdded, itemsRect->GetBottom(),