From 63916e4494c0f0d382f9ed3337d1fcec900028d1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Apr 2006 17:16:45 +0000 Subject: [PATCH] don't show vertical scrollbar if we don't need it git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/vscroll.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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; -- 2.45.2