#include "wx/vscroll.h"
+#include "wx/utils.h" // For wxMin/wxMax().
+
// ============================================================================
// wxVarScrollHelperEvtHandler declaration
// ============================================================================
if ( wasSkipped )
event.Skip(false);
- // reset the skipped flag to false as it might have been set to true in
- // ProcessEvent() above
- event.Skip(false);
-
if ( evType == wxEVT_SCROLLWIN_TOP ||
evType == wxEVT_SCROLLWIN_BOTTOM ||
evType == wxEVT_SCROLLWIN_LINEUP ||
}
#endif // wxUSE_MOUSEWHEEL
- if ( processed )
- event.Skip(wasSkipped);
+ event.Skip(wasSkipped);
return processed;
}
}
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 )
{
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;
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;