aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-23 17:50:38 +0600
committerEugene Sandulenko2016-07-03 12:19:31 +0200
commit421f9826c8ad403d76b6f40bf1aa4c7c0ec7e676 (patch)
treec657de462d9d39228d1810dab57ba6defa62ac4e
parent40fa9b4de3f719ad11ceb665a724712ccbcb7376 (diff)
downloadscummvm-rg350-421f9826c8ad403d76b6f40bf1aa4c7c0ec7e676.tar.gz
scummvm-rg350-421f9826c8ad403d76b6f40bf1aa4c7c0ec7e676.tar.bz2
scummvm-rg350-421f9826c8ad403d76b6f40bf1aa4c7c0ec7e676.zip
GUI: Hide scrollbar in ScrollContainerWidget when needed
-rw-r--r--gui/widgets/scrollcontainer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp
index fdb02f8be2..1173b08279 100644
--- a/gui/widgets/scrollcontainer.cpp
+++ b/gui/widgets/scrollcontainer.cpp
@@ -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 {
@@ -133,6 +133,8 @@ void ScrollContainerWidget::reflowLayout() {
ptr->setVisible(visible);
ptr = ptr->next();
}
+
+ _verticalScroll->setVisible(_verticalScroll->_numEntries > _limitH); //show when there is something to scroll
}
void ScrollContainerWidget::drawWidget() {
@@ -140,7 +142,7 @@ void ScrollContainerWidget::drawWidget() {
}
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);
}