X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/234b1c01470c3e88931f97bb7ed4fdceead196bf..6493aacaeb7b22b9fa35c559f7753e9fec0da71f:/src/generic/vscroll.cpp diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index 083e26c801..3fc8a940d5 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -171,6 +171,25 @@ void wxVScrolledWindow::UpdateScrollbar() h += OnGetLineHeight(line); } + // if we still have remaining space below, maybe we can fit everything? + if ( h < hWindow ) + { + wxCoord hAll = h; + for ( size_t lineFirst = m_lineFirst; lineFirst > 0; lineFirst-- ) + { + hAll += OnGetLineHeight(m_lineFirst - 1); + if ( hAll > hWindow ) + break; + } + + if ( hAll < hWindow ) + { + // we don't need scrollbar at all + m_lineFirst = 0; + SetScrollbar(wxVERTICAL, 0, 0, 0); + } + } + m_nVisible = line - m_lineFirst; int pageSize = m_nVisible;