Fix wxDV_ROW_LINES drawing when horizontally scrolled in generic version.
Use the correct, i.e. logical, as wxDC does the translation to physical internally, coordinates for drawing the highlighted rows. Closes #16815. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1807,9 +1807,11 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
wxDataViewModel *model = GetModel();
|
wxDataViewModel *model = GetModel();
|
||||||
wxAutoBufferedPaintDC dc( this );
|
wxAutoBufferedPaintDC dc( this );
|
||||||
|
|
||||||
|
const wxSize size = GetClientSize();
|
||||||
|
|
||||||
dc.SetBrush(GetOwner()->GetBackgroundColour());
|
dc.SetBrush(GetOwner()->GetBackgroundColour());
|
||||||
dc.SetPen( *wxTRANSPARENT_PEN );
|
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||||
dc.DrawRectangle(GetClientSize());
|
dc.DrawRectangle(size);
|
||||||
|
|
||||||
if ( IsEmpty() )
|
if ( IsEmpty() )
|
||||||
{
|
{
|
||||||
@@ -1895,13 +1897,16 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc.SetBrush(wxBrush(altRowColour));
|
dc.SetBrush(wxBrush(altRowColour));
|
||||||
|
|
||||||
|
// We only need to draw the visible part, so limit the rectangle to it.
|
||||||
|
const int xRect = m_owner->CalcUnscrolledPosition(wxPoint(0, 0)).x;
|
||||||
|
const int widthRect = size.x;
|
||||||
for (unsigned int item = item_start; item < item_last; item++)
|
for (unsigned int item = item_start; item < item_last; item++)
|
||||||
{
|
{
|
||||||
if ( item % 2 )
|
if ( item % 2 )
|
||||||
{
|
{
|
||||||
dc.DrawRectangle(x_start,
|
dc.DrawRectangle(xRect,
|
||||||
GetLineStart(item),
|
GetLineStart(item),
|
||||||
GetClientSize().GetWidth(),
|
widthRect,
|
||||||
GetLineHeight(item));
|
GetLineHeight(item));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user