GUI: Setting the active tab also ensures it is visible in the tab bar

This commit is contained in:
Thierry Crozat 2016-10-30 18:22:56 +00:00
parent 54230af9fd
commit 50847f9e03

View File

@ -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();
}