Fix determining last visible row in wxDataViewCtrl

If entire client area is filled with displayed rows, the last visible row is the row occupying the line at the bottom of the client area (at y = dimY-1).
Because last displayed row can be partially visible in the client area, it cannot be determined as previous row to the row virtually displayed below the client area (at y = dimY), like it is currently implemented.
This commit is contained in:
Artur Wieczorek
2016-10-14 23:50:49 +02:00
parent 9c3c6074eb
commit 239361c7c4

View File

@@ -2762,11 +2762,10 @@ unsigned int wxDataViewMainWindow::GetFirstVisibleRow() const
unsigned int wxDataViewMainWindow::GetLastVisibleRow()
{
wxSize client_size = GetClientSize();
m_owner->CalcUnscrolledPosition( client_size.x, client_size.y,
// Find row occupying the bottom line of the client area (dimY-1).
m_owner->CalcUnscrolledPosition( client_size.x, client_size.y-1,
&client_size.x, &client_size.y );
// we should deal with the pixel here
unsigned int row = GetLineAt(client_size.y) - 1;
unsigned int row = GetLineAt(client_size.y);
return wxMin( GetRowCount()-1, row );
}