Avoid drawing the scroll bars if the widget is non-visible

This commit is contained in:
Markus Gans 2019-06-02 19:11:17 +02:00
parent c93c0b6e33
commit 7c46d52ef4
6 changed files with 65 additions and 36 deletions

View File

@ -1,3 +1,6 @@
2019-06-02 Markus Gans <guru.mail@muenster.de>
* Avoid drawing the scroll bars if the widget is non-visible
2019-05-27 Markus Gans <guru.mail@muenster.de> 2019-05-27 Markus Gans <guru.mail@muenster.de>
* Use the Singleton design pattern to get a single object instance * Use the Singleton design pattern to get a single object instance
via FTerm via FTerm

View File

@ -737,6 +737,8 @@ void FListBox::adjustSize()
hbar->setWidth (width + nf_offset, false); hbar->setWidth (width + nf_offset, false);
hbar->resize(); hbar->resize();
if ( isShown() )
{
if ( isHorizontallyScrollable() ) if ( isHorizontallyScrollable() )
hbar->show(); hbar->show();
else else
@ -747,6 +749,7 @@ void FListBox::adjustSize()
else else
vbar->hide(); vbar->hide();
} }
}
// private methods of FListBox // private methods of FListBox
@ -1180,12 +1183,15 @@ void FListBox::recalculateHorizontalBar (std::size_t len, bool has_brackets)
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4)); hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset - 4));
hbar->calculateSliderValues(); hbar->calculateSliderValues();
if ( isShown() )
{
if ( isHorizontallyScrollable() ) if ( isHorizontallyScrollable() )
hbar->show(); hbar->show();
else else
hbar->hide(); hbar->hide();
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::recalculateVerticalBar (std::size_t element_count) void FListBox::recalculateVerticalBar (std::size_t element_count)
@ -1197,11 +1203,14 @@ void FListBox::recalculateVerticalBar (std::size_t element_count)
vbar->setPageSize (int(element_count), int(getHeight()) - 2); vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues(); vbar->calculateSliderValues();
if ( isShown() )
{
if ( isVerticallyScrollable() ) if ( isVerticallyScrollable() )
vbar->show(); vbar->show();
else else
vbar->hide(); vbar->hide();
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FListBox::getWidgetFocus() inline void FListBox::getWidgetFocus()

View File

@ -1361,6 +1361,8 @@ void FListView::adjustSize()
hbar->setWidth (width, false); hbar->setWidth (width, false);
hbar->resize(); hbar->resize();
if ( isShown() )
{
if ( isHorizontallyScrollable() ) if ( isHorizontallyScrollable() )
hbar->show(); hbar->show();
else else
@ -1371,6 +1373,7 @@ void FListView::adjustSize()
else else
vbar->hide(); vbar->hide();
} }
}
// private methods of FListView // private methods of FListView
@ -1966,12 +1969,15 @@ void FListView::recalculateHorizontalBar (std::size_t len)
hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset) - 4); hbar->setPageSize (int(max_line_width), int(getWidth() - nf_offset) - 4);
hbar->calculateSliderValues(); hbar->calculateSliderValues();
if ( isShown() )
{
if ( isHorizontallyScrollable() ) if ( isHorizontallyScrollable() )
hbar->show(); hbar->show();
else else
hbar->hide(); hbar->hide();
} }
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::recalculateVerticalBar (std::size_t element_count) void FListView::recalculateVerticalBar (std::size_t element_count)
@ -1983,11 +1989,14 @@ void FListView::recalculateVerticalBar (std::size_t element_count)
vbar->setPageSize (int(element_count), int(getHeight()) - 2); vbar->setPageSize (int(element_count), int(getHeight()) - 2);
vbar->calculateSliderValues(); vbar->calculateSliderValues();
if ( isShown() )
{
if ( isVerticallyScrollable() ) if ( isVerticallyScrollable() )
vbar->show(); vbar->show();
else else
vbar->hide(); vbar->hide();
} }
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::mouseHeaderClicked() void FListView::mouseHeaderClicked()

View File

@ -814,6 +814,9 @@ void FScrollView::calculateScrollbarPos()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollView::setHorizontalScrollBarVisibility() void FScrollView::setHorizontalScrollBarVisibility()
{ {
if ( ! isShown() )
return;
switch ( hMode ) switch ( hMode )
{ {
case fc::Auto: case fc::Auto:
@ -836,6 +839,9 @@ void FScrollView::setHorizontalScrollBarVisibility()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FScrollView::setVerticalScrollBarVisibility() void FScrollView::setVerticalScrollBarVisibility()
{ {
if ( ! isShown() )
return;
switch ( vMode ) switch ( vMode )
{ {
case fc::Auto: case fc::Auto:

View File

@ -1237,13 +1237,15 @@ inline void FTermLinux::initSpecialCharacter()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
sInt16 FTermLinux::getFontPos (wchar_t ucs) sInt16 FTermLinux::getFontPos (wchar_t ucs)
{ {
constexpr sInt16 NOT_FOUND = -1;
for (std::size_t n = 0; n < screen_unicode_map.entry_ct; n++) for (std::size_t n = 0; n < screen_unicode_map.entry_ct; n++)
{ {
if ( screen_unicode_map.entries[n].unicode == ucs ) if ( screen_unicode_map.entries[n].unicode == ucs )
return sInt16(screen_unicode_map.entries[n].fontpos); return sInt16(screen_unicode_map.entries[n].fontpos);
} }
return -1; return NOT_FOUND;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------