X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf7d6329530d0a9f181ac24dcc722d276885f05e..4760fa91097407e9967efd21f90ef04d69e5bb9c:/src/generic/vscroll.cpp diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index aa52fab013..5d2ccf0cb6 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -164,15 +164,58 @@ void wxVScrolledWindow::SetLineCount(size_t count) count/2 + NUM_LINES_TO_SAMPLE/2); // use the height of the lines we looked as the average - m_heightTotal = ((float)m_heightTotal / (3*NUM_LINES_TO_SAMPLE)) * - m_lineMax; + m_heightTotal = (wxCoord) + (((float)m_heightTotal / (3*NUM_LINES_TO_SAMPLE)) * m_lineMax); } // recalculate the scrollbars parameters + m_lineFirst = 1; // make sure it is != 0 ScrollToLine(0); } +void wxVScrolledWindow::RefreshLine(size_t line) +{ + // is this line visible? + if ( !IsVisible(line) ) + { + // no, it is useless to do anything + return; + } + + // calculate the rect occupied by this line on screen + wxRect rect; + rect.width = GetClientSize().x; + rect.height = OnGetLineHeight(line); + for ( size_t n = GetFirstVisibleLine(); n < line; n++ ) + { + rect.y += OnGetLineHeight(n); + } + + // do refresh it + RefreshRect(rect); +} + +void wxVScrolledWindow::RefreshAll() +{ + UpdateScrollbar(); + + Refresh(); +} + +int wxVScrolledWindow::HitTest(wxCoord WXUNUSED(x), wxCoord y) const +{ + const size_t lineMax = GetLastVisibleLine(); + for ( size_t line = GetFirstVisibleLine(); line <= lineMax; line++ ) + { + y -= OnGetLineHeight(line); + if ( y < 0 ) + return line; + } + + return wxNOT_FOUND; +} + // ---------------------------------------------------------------------------- // scrolling // ---------------------------------------------------------------------------- @@ -318,5 +361,9 @@ void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event) } ScrollToLine(lineFirstNew); + +#ifdef __WXMAC__ + Update(); +#endif // __WXMAC__ }