Fix drawing background in wxDataViewCtrl with rules

wxRect to draw the background was prepared in a wrong way if wxDataView had
vertical or horizontal rules.

Fix this by adjusting the correct component of the rectangle when using
horizontal rules and by fixing an off by one bug when using vertical ones.
This commit is contained in:
jensgoe 2017-05-03 16:05:20 +02:00 committed by VZ
parent e958d2d8f4
commit dd4a9de048

View File

@ -2373,15 +2373,19 @@ void wxDataViewMainWindow::DrawCellBackground( wxDataViewRenderer* cell, wxDC& d
// don't overlap the horizontal rules
if ( m_owner->HasFlag(wxDV_HORIZ_RULES) )
{
rectBg.x++;
rectBg.width--;
rectBg.y++;
rectBg.height--;
}
// don't overlap the vertical rules
if ( m_owner->HasFlag(wxDV_VERT_RULES) )
{
rectBg.y++;
rectBg.height--;
// same note as in OnPaint handler above
// NB: Vertical rules are drawn in the last pixel of a column so that
// they align perfectly with native MSW wxHeaderCtrl as well as for
// consistency with MSW native list control. There's no vertical
// rule at the most-left side of the control.
rectBg.width--;
}
cell->RenderBackground(&dc, rectBg);