X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2c1e2499675cc8dc77dc9551de9f14ca24254fad..b5b0a35d6b648aead1aa353dfe9c03775496981f:/src/generic/vscroll.cpp diff --git a/src/generic/vscroll.cpp b/src/generic/vscroll.cpp index 609d6e0f52..59a65f856e 100644 --- a/src/generic/vscroll.cpp +++ b/src/generic/vscroll.cpp @@ -160,6 +160,13 @@ size_t wxVScrolledWindow::FindFirstFromBottom(size_t lineLast, bool full) return lineFirst; } +void wxVScrolledWindow::RemoveScrollbar() +{ + m_lineFirst = 0; + m_nVisible = m_lineMax; + SetScrollbar(wxVERTICAL, 0, 0, 0); +} + void wxVScrolledWindow::UpdateScrollbar() { // see how many lines can we fit on screen @@ -189,8 +196,8 @@ void wxVScrolledWindow::UpdateScrollbar() if ( hAll < hWindow ) { // we don't need scrollbar at all - m_lineFirst = 0; - SetScrollbar(wxVERTICAL, 0, 0, 0); + RemoveScrollbar(); + return; } } @@ -222,8 +229,15 @@ void wxVScrolledWindow::SetLineCount(size_t count) m_heightTotal = EstimateTotalHeight(); // recalculate the scrollbars parameters - m_lineFirst = 1; // make sure it is != 0 - ScrollToLine(0); + if ( count ) + { + m_lineFirst = 1; // make sure it is != 0 + ScrollToLine(0); + } + else // no items + { + RemoveScrollbar(); + } } void wxVScrolledWindow::RefreshLine(size_t line)