Skip to content

Commit

Permalink
GUI: Hide scrollbar in ScrollContainerWidget when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Tkachov authored and sev- committed Jul 3, 2016
1 parent 40fa9b4 commit 421f982
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gui/widgets/scrollcontainer.cpp
Expand Up @@ -90,7 +90,7 @@ int16 ScrollContainerWidget::getChildY() const {
}

uint16 ScrollContainerWidget::getWidth() const {
return _w - _verticalScroll->getWidth();
return _w - (_verticalScroll->isVisible() ? _verticalScroll->getWidth() : 0);
}

uint16 ScrollContainerWidget::getHeight() const {
Expand Down Expand Up @@ -133,14 +133,16 @@ void ScrollContainerWidget::reflowLayout() {
ptr->setVisible(visible);
ptr = ptr->next();
}

_verticalScroll->setVisible(_verticalScroll->_numEntries > _limitH); //show when there is something to scroll
}

void ScrollContainerWidget::drawWidget() {
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight() - 1), ThemeEngine::kDialogBackgroundDefault);
}

Widget *ScrollContainerWidget::findWidget(int x, int y) {
if (x >= _w - _verticalScroll->getWidth())
if (_verticalScroll->isVisible() && x >= _w - _verticalScroll->getWidth())
return _verticalScroll;
return Widget::findWidgetInChain(_firstWidget, x + _scrolledX, y + _scrolledY);
}
Expand Down

0 comments on commit 421f982

Please sign in to comment.