aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorThierry Crozat2016-10-30 18:22:56 +0000
committerThierry Crozat2016-10-30 18:22:56 +0000
commit50847f9e033ce5f4f009b5e0e739b0ac1975940f (patch)
tree7320bc7ea1fcc469505cfa7add53d7bdfd35c280 /gui
parent54230af9fd54d6defa5c211b61ab51cc4a5bbacf (diff)
downloadscummvm-rg350-50847f9e033ce5f4f009b5e0e739b0ac1975940f.tar.gz
scummvm-rg350-50847f9e033ce5f4f009b5e0e739b0ac1975940f.tar.bz2
scummvm-rg350-50847f9e033ce5f4f009b5e0e739b0ac1975940f.zip
GUI: Setting the active tab also ensures it is visible in the tab bar
Diffstat (limited to 'gui')
-rw-r--r--gui/widgets/tab.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index ed261c98ec..cf9dd5d962 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -199,6 +199,12 @@ void TabWidget::setActiveTab(int tabID) {
}
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
+
+ // Also ensure the tab is visible in the tab bar
+ if (_firstVisibleTab > tabID)
+ _firstVisibleTab = tabID;
+ else if (_firstVisibleTab + _w / _tabWidth <= tabID)
+ _firstVisibleTab = tabID - _w / _tabWidth + 1;
_boss->draw();
}