GUI: tabs with scrollbars for more pages
This commit is contained in:
parent
4ef38a9255
commit
42a27fda40
6 changed files with 38 additions and 22 deletions
|
@ -272,7 +272,7 @@ ConfigDialog::ConfigDialog() :
|
||||||
// The game specific options tab
|
// The game specific options tab
|
||||||
//
|
//
|
||||||
|
|
||||||
int tabId = tab->addTab(_("Game"), "GlobalConfig_Engine");
|
int tabId = tab->addTab(_("Game"), "GlobalConfig_Engine", false);
|
||||||
|
|
||||||
if (g_engine->hasFeature(Engine::kSupportsChangingOptionsDuringRuntime)) {
|
if (g_engine->hasFeature(Engine::kSupportsChangingOptionsDuringRuntime)) {
|
||||||
_engineOptions = metaEngine->buildEngineOptionsWidgetDynamic(tab, "GlobalConfig_Engine.Container", gameDomain);
|
_engineOptions = metaEngine->buildEngineOptionsWidgetDynamic(tab, "GlobalConfig_Engine.Container", gameDomain);
|
||||||
|
@ -315,14 +315,14 @@ ConfigDialog::ConfigDialog() :
|
||||||
|
|
||||||
Common::KeymapArray keymaps = metaEngine->initKeymaps(gameDomain.c_str());
|
Common::KeymapArray keymaps = metaEngine->initKeymaps(gameDomain.c_str());
|
||||||
if (!keymaps.empty()) {
|
if (!keymaps.empty()) {
|
||||||
tab->addTab(_("Keymaps"), "GlobalConfig_KeyMapper");
|
tab->addTab(_("Keymaps"), "GlobalConfig_KeyMapper", false);
|
||||||
addKeyMapperControls(tab, "GlobalConfig_KeyMapper.", keymaps, gameDomain);
|
addKeyMapperControls(tab, "GlobalConfig_KeyMapper.", keymaps, gameDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The backend tab (shown only if the backend implements one)
|
// The backend tab (shown only if the backend implements one)
|
||||||
//
|
//
|
||||||
int backendTabId = tab->addTab(_("Backend"), "GlobalConfig_Backend");
|
int backendTabId = tab->addTab(_("Backend"), "GlobalConfig_Backend", false);
|
||||||
|
|
||||||
_backendOptions = g_system->buildBackendOptionsWidget(tab, "GlobalConfig_Backend.Container", _domain);
|
_backendOptions = g_system->buildBackendOptionsWidget(tab, "GlobalConfig_Backend.Container", _domain);
|
||||||
|
|
||||||
|
@ -337,11 +337,11 @@ ConfigDialog::ConfigDialog() :
|
||||||
//
|
//
|
||||||
AchMan.setActiveDomain(metaEngine->getAchievementsInfo(gameDomain));
|
AchMan.setActiveDomain(metaEngine->getAchievementsInfo(gameDomain));
|
||||||
if (AchMan.getAchievementCount()) {
|
if (AchMan.getAchievementCount()) {
|
||||||
tab->addTab(_("Achievements"), "GlobalConfig_Achievements");
|
tab->addTab(_("Achievements"), "GlobalConfig_Achievements", false);
|
||||||
addAchievementsControls(tab, "GlobalConfig_Achievements.");
|
addAchievementsControls(tab, "GlobalConfig_Achievements.");
|
||||||
}
|
}
|
||||||
if (AchMan.getStatCount()) {
|
if (AchMan.getStatCount()) {
|
||||||
tab->addTab(_("Statistics"), "GlobalConfig_Achievements");
|
tab->addTab(_("Statistics"), "GlobalConfig_Achievements", false);
|
||||||
addStatisticsControls(tab, "GlobalConfig_Achievements.");
|
addStatisticsControls(tab, "GlobalConfig_Achievements.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ EditGameDialog::EditGameDialog(const Common::String &domain)
|
||||||
//
|
//
|
||||||
// 1) The game tab
|
// 1) The game tab
|
||||||
//
|
//
|
||||||
tab->addTab(_("Game"), "GameOptions_Game", true);
|
tab->addTab(_("Game"), "GameOptions_Game");
|
||||||
|
|
||||||
// GUI: Label & edit widget for the game ID
|
// GUI: Label & edit widget for the game ID
|
||||||
if (g_system->getOverlayWidth() > 320)
|
if (g_system->getOverlayWidth() > 320)
|
||||||
|
@ -204,7 +204,7 @@ EditGameDialog::EditGameDialog(const Common::String &domain)
|
||||||
//
|
//
|
||||||
// 3) The graphics tab
|
// 3) The graphics tab
|
||||||
//
|
//
|
||||||
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"), "GameOptions_Graphics");
|
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"), "GameOptions_Graphics", false);
|
||||||
ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GameOptions_Graphics.Container", "GameOptions_Graphics_Container", kGraphicsTabContainerReflowCmd);
|
ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GameOptions_Graphics.Container", "GameOptions_Graphics_Container", kGraphicsTabContainerReflowCmd);
|
||||||
graphicsContainer->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
graphicsContainer->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
||||||
graphicsContainer->setTarget(this);
|
graphicsContainer->setTarget(this);
|
||||||
|
@ -241,14 +241,14 @@ EditGameDialog::EditGameDialog(const Common::String &domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!keymaps.empty()) {
|
if (!keymaps.empty()) {
|
||||||
tab->addTab(_("Keymaps"), "GameOptions_KeyMapper");
|
tab->addTab(_("Keymaps"), "GameOptions_KeyMapper", false);
|
||||||
addKeyMapperControls(tab, "GameOptions_KeyMapper.", keymaps, domain);
|
addKeyMapperControls(tab, "GameOptions_KeyMapper.", keymaps, domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The backend tab (shown only if the backend implements one)
|
// The backend tab (shown only if the backend implements one)
|
||||||
//
|
//
|
||||||
int backendTabId = tab->addTab(_("Backend"), "GameOptions_Backend");
|
int backendTabId = tab->addTab(_("Backend"), "GameOptions_Backend", false);
|
||||||
|
|
||||||
if (g_system->getOverlayWidth() > 320)
|
if (g_system->getOverlayWidth() > 320)
|
||||||
_globalBackendOverride = new CheckboxWidget(tab, "GameOptions_Backend.EnableTabCheckbox", _("Override global backend settings"), Common::U32String(), kCmdGlobalBackendOverride);
|
_globalBackendOverride = new CheckboxWidget(tab, "GameOptions_Backend.EnableTabCheckbox", _("Override global backend settings"), Common::U32String(), kCmdGlobalBackendOverride);
|
||||||
|
@ -367,11 +367,11 @@ EditGameDialog::EditGameDialog(const Common::String &domain)
|
||||||
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
const MetaEngine &metaEngine = enginePlugin->get<MetaEngine>();
|
||||||
AchMan.setActiveDomain(metaEngine.getAchievementsInfo(domain));
|
AchMan.setActiveDomain(metaEngine.getAchievementsInfo(domain));
|
||||||
if (AchMan.getAchievementCount()) {
|
if (AchMan.getAchievementCount()) {
|
||||||
tab->addTab(_("Achievements"), "GameOptions_Achievements");
|
tab->addTab(_("Achievements"), "GameOptions_Achievements", false);
|
||||||
addAchievementsControls(tab, "GameOptions_Achievements.");
|
addAchievementsControls(tab, "GameOptions_Achievements.");
|
||||||
}
|
}
|
||||||
if (AchMan.getStatCount()) {
|
if (AchMan.getStatCount()) {
|
||||||
tab->addTab(_("Statistics"), "GameOptions_Achievements");
|
tab->addTab(_("Statistics"), "GameOptions_Achievements", false);
|
||||||
addStatisticsControls(tab, "GameOptions_Achievements.");
|
addStatisticsControls(tab, "GameOptions_Achievements.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1981,7 +1981,7 @@ void GlobalOptionsDialog::build() {
|
||||||
//
|
//
|
||||||
// 1) The graphics tab
|
// 1) The graphics tab
|
||||||
//
|
//
|
||||||
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"), "GlobalOptions_Graphics");
|
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"), "GlobalOptions_Graphics", false);
|
||||||
ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GlobalOptions_Graphics.Container", "GlobalOptions_Graphics_Container", kGraphicsTabContainerReflowCmd);
|
ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GlobalOptions_Graphics.Container", "GlobalOptions_Graphics_Container", kGraphicsTabContainerReflowCmd);
|
||||||
graphicsContainer->setTarget(this);
|
graphicsContainer->setTarget(this);
|
||||||
graphicsContainer->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
graphicsContainer->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
||||||
|
@ -2026,14 +2026,14 @@ void GlobalOptionsDialog::build() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!keymaps.empty()) {
|
if (!keymaps.empty()) {
|
||||||
tab->addTab(_("Keymaps"), "GlobalOptions_KeyMapper");
|
tab->addTab(_("Keymaps"), "GlobalOptions_KeyMapper", false);
|
||||||
addKeyMapperControls(tab, "GlobalOptions_KeyMapper.", keymaps, Common::ConfigManager::kKeymapperDomain);
|
addKeyMapperControls(tab, "GlobalOptions_KeyMapper.", keymaps, Common::ConfigManager::kKeymapperDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// The backend tab (shown only if the backend implements one)
|
// The backend tab (shown only if the backend implements one)
|
||||||
//
|
//
|
||||||
int backendTabId = tab->addTab(_("Backend"), "GlobalOptions_Backend");
|
int backendTabId = tab->addTab(_("Backend"), "GlobalOptions_Backend", false);
|
||||||
|
|
||||||
g_system->registerDefaultSettings(_domain);
|
g_system->registerDefaultSettings(_domain);
|
||||||
_backendOptions = g_system->buildBackendOptionsWidget(tab, "GlobalOptions_Backend.Container", _domain);
|
_backendOptions = g_system->buildBackendOptionsWidget(tab, "GlobalOptions_Backend.Container", _domain);
|
||||||
|
@ -2084,9 +2084,9 @@ void GlobalOptionsDialog::build() {
|
||||||
// 6) The miscellaneous tab
|
// 6) The miscellaneous tab
|
||||||
//
|
//
|
||||||
if (g_system->getOverlayWidth() > 320)
|
if (g_system->getOverlayWidth() > 320)
|
||||||
tab->addTab(_("Misc"), "GlobalOptions_Misc");
|
tab->addTab(_("Misc"), "GlobalOptions_Misc", false);
|
||||||
else
|
else
|
||||||
tab->addTab(_c("Misc", "lowres"), "GlobalOptions_Misc");
|
tab->addTab(_c("Misc", "lowres"), "GlobalOptions_Misc", false);
|
||||||
ScrollContainerWidget *miscContainer = new ScrollContainerWidget(tab, "GlobalOptions_Misc.Container", "GlobalOptions_Misc_Container");
|
ScrollContainerWidget *miscContainer = new ScrollContainerWidget(tab, "GlobalOptions_Misc.Container", "GlobalOptions_Misc_Container");
|
||||||
miscContainer->setTarget(this);
|
miscContainer->setTarget(this);
|
||||||
miscContainer->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
miscContainer->setBackgroundType(ThemeEngine::kWidgetBackgroundNo);
|
||||||
|
@ -2098,9 +2098,9 @@ void GlobalOptionsDialog::build() {
|
||||||
// 7) The Cloud tab (remote storages)
|
// 7) The Cloud tab (remote storages)
|
||||||
//
|
//
|
||||||
if (g_system->getOverlayWidth() > 320)
|
if (g_system->getOverlayWidth() > 320)
|
||||||
tab->addTab(_("Cloud"), "GlobalOptions_Cloud");
|
tab->addTab(_("Cloud"), "GlobalOptions_Cloud", false);
|
||||||
else
|
else
|
||||||
tab->addTab(_c("Cloud", "lowres"), "GlobalOptions_Cloud");
|
tab->addTab(_c("Cloud", "lowres"), "GlobalOptions_Cloud", false);
|
||||||
|
|
||||||
ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", "GlobalOptions_Cloud_Container", kCloudTabContainerReflowCmd);
|
ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", "GlobalOptions_Cloud_Container", kCloudTabContainerReflowCmd);
|
||||||
container->setTarget(this);
|
container->setTarget(this);
|
||||||
|
|
|
@ -1044,7 +1044,7 @@ void OptionsContainerWidget::reflowLayout() {
|
||||||
|
|
||||||
Widget *w = _firstWidget;
|
Widget *w = _firstWidget;
|
||||||
int16 minY = getAbsY();
|
int16 minY = getAbsY();
|
||||||
int maxY = minY;
|
int maxY = minY + _h;
|
||||||
while (w) {
|
while (w) {
|
||||||
w->reflowLayout();
|
w->reflowLayout();
|
||||||
minY = MIN(minY, w->getAbsY());
|
minY = MIN(minY, w->getAbsY());
|
||||||
|
|
|
@ -161,6 +161,14 @@ Widget *TabWidget::addChild(Widget *newChild) {
|
||||||
return _tabs[_activeTab].scrollWidget->addChild(newChild);
|
return _tabs[_activeTab].scrollWidget->addChild(newChild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TabWidget::removeWidget(Widget *del) {
|
||||||
|
if (_activeTab == -1 || _tabs[_activeTab].scrollWidget == nullptr){
|
||||||
|
Widget::removeWidget(del);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_tabs[_activeTab].scrollWidget->removeWidget(del);
|
||||||
|
}
|
||||||
|
|
||||||
void TabWidget::removeTab(int tabID) {
|
void TabWidget::removeTab(int tabID) {
|
||||||
assert(0 <= tabID && tabID < (int)_tabs.size());
|
assert(0 <= tabID && tabID < (int)_tabs.size());
|
||||||
|
|
||||||
|
@ -171,7 +179,11 @@ void TabWidget::removeTab(int tabID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispose the widgets in that tab and then the tab itself
|
// Dispose the widgets in that tab and then the tab itself
|
||||||
delete _tabs[tabID].scrollWidget;
|
if (_tabs[tabID].scrollWidget) {
|
||||||
|
delete _tabs[tabID].scrollWidget;
|
||||||
|
} else {
|
||||||
|
delete _tabs[tabID].firstWidget;
|
||||||
|
}
|
||||||
_tabs.remove_at(tabID);
|
_tabs.remove_at(tabID);
|
||||||
|
|
||||||
// Adjust _firstVisibleTab if necessary
|
// Adjust _firstVisibleTab if necessary
|
||||||
|
@ -201,7 +213,10 @@ void TabWidget::setActiveTab(int tabID) {
|
||||||
releaseFocus();
|
releaseFocus();
|
||||||
}
|
}
|
||||||
_activeTab = tabID;
|
_activeTab = tabID;
|
||||||
_firstWidget = _tabs[tabID].firstWidget;
|
if (_tabs[tabID].scrollWidget)
|
||||||
|
_firstWidget = _tabs[_activeTab].scrollWidget;
|
||||||
|
else
|
||||||
|
_firstWidget = _tabs[tabID].firstWidget;
|
||||||
|
|
||||||
// Also ensure the tab is visible in the tab bar
|
// Also ensure the tab is visible in the tab bar
|
||||||
if (_firstVisibleTab > tabID)
|
if (_firstVisibleTab > tabID)
|
||||||
|
|
|
@ -76,9 +76,10 @@ public:
|
||||||
* Add a new tab with the given title. Returns a unique ID which can be used
|
* Add a new tab with the given title. Returns a unique ID which can be used
|
||||||
* to identify the tab (to remove it / activate it etc.).
|
* to identify the tab (to remove it / activate it etc.).
|
||||||
*/
|
*/
|
||||||
int addTab(const Common::U32String &title, const Common::String &dialogName, bool withScroll = false);
|
int addTab(const Common::U32String &title, const Common::String &dialogName, bool withScroll = true);
|
||||||
|
|
||||||
virtual Widget *addChild(Widget *newChild);
|
virtual Widget *addChild(Widget *newChild);
|
||||||
|
virtual void removeWidget(Widget *del);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the tab with the given tab ID. Disposes all child widgets of that tab.
|
* Remove the tab with the given tab ID. Disposes all child widgets of that tab.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue