X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0c6027b5a0af9050eca56774967437a66241026..a689b6d6dd19f6c7d369079a8330cde24f3bf7aa:/src/generic/vscroll.cpp diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index e7cb8cfa06..4a9cc64d7c 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -74,7 +74,7 @@ wxCoord wxVScrolledWindow::GetLinesHeight(size_t lineMin, size_t lineMax) const return height; } -size_t wxVScrolledWindow::FindFirstFromBottom(size_t lineLast) +size_t wxVScrolledWindow::FindFirstFromBottom(size_t lineLast, bool full) { const wxCoord hWindow = GetClientSize().y; @@ -88,7 +88,13 @@ size_t wxVScrolledWindow::FindFirstFromBottom(size_t lineLast) if ( h > hWindow ) { - lineFirst++; + // for this line to be fully visible we need to go one line + // down, but if it is enough for it to be only partly visible then + // this line will do as well + if ( full ) + { + lineFirst++; + } break; } @@ -164,8 +170,8 @@ 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); } @@ -196,6 +202,13 @@ void wxVScrolledWindow::RefreshLine(size_t line) RefreshRect(rect); } +void wxVScrolledWindow::RefreshAll() +{ + UpdateScrollbar(); + + Refresh(); +} + int wxVScrolledWindow::HitTest(wxCoord WXUNUSED(x), wxCoord y) const { const size_t lineMax = GetLastVisibleLine(); @@ -223,7 +236,7 @@ bool wxVScrolledWindow::ScrollToLine(size_t line) // determine the real first line to scroll to: we shouldn't scroll beyond // the end - size_t lineFirstLast = FindFirstFromBottom(m_lineMax - 1); + size_t lineFirstLast = FindFirstFromBottom(m_lineMax - 1, true); if ( line > lineFirstLast ) line = lineFirstLast; @@ -354,5 +367,9 @@ void wxVScrolledWindow::OnScroll(wxScrollWinEvent& event) } ScrollToLine(lineFirstNew); + +#ifdef __WXMAC__ + Update(); +#endif // __WXMAC__ }