X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/687dcff3a46a55c11851b1cabdbbbef5492a2f5f..a72f1d162b1f511d3e9fa54304be695f07c79832:/src/generic/vscroll.cpp diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index 49545e7aba..ad0951f3a7 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -17,7 +17,7 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "vscroll.h" #endif @@ -44,6 +44,8 @@ END_EVENT_TABLE() // implementation // ============================================================================ +IMPLEMENT_ABSTRACT_CLASS(wxVScrolledWindow, wxPanel) + // ---------------------------------------------------------------------------- // initialization // ---------------------------------------------------------------------------- @@ -90,7 +92,7 @@ wxCoord wxVScrolledWindow::EstimateTotalHeight() const // use the height of the lines we looked as the average heightTotal = (wxCoord) - (((float)m_heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); + (((float)heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); } return heightTotal; @@ -372,6 +374,7 @@ void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event) size_t lineFirstNew; const wxEventType evtType = event.GetEventType(); + if ( evtType == wxEVT_SCROLLWIN_TOP ) { lineFirstNew = 0; @@ -396,21 +399,19 @@ void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event) { lineFirstNew = GetLastVisibleLine(); } + else if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) + { + lineFirstNew = event.GetPosition(); + } + else if ( evtType == wxEVT_SCROLLWIN_THUMBTRACK ) + { + lineFirstNew = event.GetPosition(); + } + else // unknown scroll event? { - if ( evtType == wxEVT_SCROLLWIN_THUMBRELEASE ) - { - lineFirstNew = event.GetPosition(); - } - else - { - wxASSERT_MSG( evtType == wxEVT_SCROLLWIN_THUMBTRACK, - _T("unknown scroll event type?") ); - - // don't do anything, otherwise dragging the thumb around would - // be too slow - return; - } + wxFAIL_MSG( _T("unknown scroll event type?") ); + return; } ScrollToLine(lineFirstNew);