X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d4a58a7ce50dc06be27dbe5722a6d5761520cb6c..8a28cd66a63ce30c75173e10948e9d49d366d218:/src/generic/vscroll.cpp diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index 96fcd3f54d..589451775c 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -31,6 +31,8 @@ #include "wx/vscroll.h" +#include "wx/utils.h" // For wxMin/wxMax(). + // ============================================================================ // wxVarScrollHelperEvtHandler declaration // ============================================================================ @@ -308,14 +310,17 @@ size_t wxVarScrollHelperBase::GetNewScrollPosition(wxScrollWinEvent& event) cons } else if ( evtType == wxEVT_SCROLLWIN_PAGEUP ) { - return FindFirstVisibleFromLast(m_unitFirst); + // Page up should do at least as much as line up. + return wxMin(FindFirstVisibleFromLast(m_unitFirst), + m_unitFirst ? m_unitFirst - 1 : 0); } else if ( evtType == wxEVT_SCROLLWIN_PAGEDOWN ) { + // And page down should do at least as much as line down. if ( GetVisibleEnd() ) - return GetVisibleEnd() - 1; + return wxMax(GetVisibleEnd() - 1, m_unitFirst + 1); else - return GetVisibleEnd(); + return wxMax(GetVisibleEnd(), m_unitFirst + 1); } else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) { @@ -482,10 +487,10 @@ void wxVarScrollHelperBase::RefreshUnits(size_t from, size_t to) to = GetVisibleEnd(); // calculate the rect occupied by these units on screen - int orient_size, nonorient_size, orient_pos; - orient_size = nonorient_size = orient_pos = 0; + int orient_size = 0, + orient_pos = 0; - nonorient_size = GetNonOrientationTargetSize(); + int nonorient_size = GetNonOrientationTargetSize(); for ( size_t nBefore = GetVisibleBegin(); nBefore < from; @@ -822,7 +827,7 @@ void wxVarHVScrollHelper::RefreshRowColumn(size_t row, size_t column) h_rect.x += OnGetColumnWidth(n); } - // refresh but specialize the behavior if we have a single target window + // refresh but specialize the behaviour if we have a single target window if ( wxVarVScrollHelper::GetTargetWindow() == wxVarHScrollHelper::GetTargetWindow() ) { v_rect.x = h_rect.x; @@ -889,7 +894,7 @@ void wxVarHVScrollHelper::RefreshRowsColumns(size_t fromRow, size_t toRow, h_rect.width += OnGetColumnWidth(nBetween); } - // refresh but specialize the behavior if we have a single target window + // refresh but specialize the behaviour if we have a single target window if ( wxVarVScrollHelper::GetTargetWindow() == wxVarHScrollHelper::GetTargetWindow() ) { v_rect.x = h_rect.x;