X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8ae8032cf99972ef33be74433d7aa087fe0d0523..17d98558b35b75e3cad68d96841b4fa5a0c7e6ee:/src/msw/scrolbar.cpp diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index 54a5cf7e27..f45e294396 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -119,7 +119,6 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, return false; } - int position = scrollInfo.nPos; int maxPos = scrollInfo.nMax; // A page size greater than one has the effect of reducing the effective @@ -128,61 +127,54 @@ bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam, if ( m_pageSize > 1 ) maxPos -= (m_pageSize - 1); + int position = scrollInfo.nPos; wxEventType scrollEvent = wxEVT_NULL; - - int nScrollInc; switch ( wParam ) { case SB_TOP: - nScrollInc = maxPos - position; + position = 0; scrollEvent = wxEVT_SCROLL_TOP; break; case SB_BOTTOM: - nScrollInc = -position; + position = maxPos; scrollEvent = wxEVT_SCROLL_BOTTOM; break; case SB_LINEUP: - nScrollInc = -1; + position--; scrollEvent = wxEVT_SCROLL_LINEUP; break; case SB_LINEDOWN: - nScrollInc = 1; + position++; scrollEvent = wxEVT_SCROLL_LINEDOWN; break; case SB_PAGEUP: - nScrollInc = -GetPageSize(); + position -= GetPageSize(); scrollEvent = wxEVT_SCROLL_PAGEUP; break; case SB_PAGEDOWN: - nScrollInc = GetPageSize(); + position += GetPageSize(); scrollEvent = wxEVT_SCROLL_PAGEDOWN; break; case SB_THUMBPOSITION: case SB_THUMBTRACK: - nScrollInc = scrollInfo.nTrackPos - position; + position = scrollInfo.nTrackPos; scrollEvent = wParam == SB_THUMBPOSITION ? wxEVT_SCROLL_THUMBRELEASE : wxEVT_SCROLL_THUMBTRACK; break; case SB_ENDSCROLL: - nScrollInc = 0; scrollEvent = wxEVT_SCROLL_CHANGED; break; - - default: - nScrollInc = 0; } - if ( nScrollInc ) + if ( position != scrollInfo.nPos ) { - position += nScrollInc; - if ( position < 0 ) position = 0; if ( position > maxPos )