diff options
author | Bastien Bouclet | 2019-12-28 10:43:58 +0100 |
---|---|---|
committer | Bastien Bouclet | 2020-01-04 10:56:25 +0100 |
commit | c0d8b6d9fc73abc8de4575686e0776e3468d37b2 (patch) | |
tree | 156e4305363210c7a52a2d90985d71e1cd22a4ce /gui/options.cpp | |
parent | 303ee2694f4e85d3d9796068e33d2d48ca100e8a (diff) | |
download | scummvm-rg350-c0d8b6d9fc73abc8de4575686e0776e3468d37b2.tar.gz scummvm-rg350-c0d8b6d9fc73abc8de4575686e0776e3468d37b2.tar.bz2 scummvm-rg350-c0d8b6d9fc73abc8de4575686e0776e3468d37b2.zip |
GUI: Introduce dynamic layouts
Prior to this change, a GUI layout was only affected by the screen size.
Now, a layout can additionally be influenced by the GUI dialog and widgets
that uses it. This capability is leveraged to implement the following
features:
* Layout elements that are not bound to a GUI widget do not take space.
This means that dialogs where the widgets shown depend on for example
a feature being enabled at configure time no longer have blank spaces.
* Widgets can define a minimal required size for their contents not to be
cut. For now this is only used for buttons so their width is always
sufficient for their caption not to be cut. This mechanism could be
applied to other widget types in the future.
Diffstat (limited to 'gui/options.cpp')
-rw-r--r-- | gui/options.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/gui/options.cpp b/gui/options.cpp index 161742d9bc..599d865ffb 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1548,8 +1548,8 @@ void GlobalOptionsDialog::build() { // // 1) The graphics tab // - _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX")); - ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GlobalOptions_Graphics.Container", kGraphicsTabContainerReflowCmd); + _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"), "GlobalOptions_Graphics"); + ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GlobalOptions_Graphics.Container", "GlobalOptions_Graphics_Container", kGraphicsTabContainerReflowCmd); graphicsContainer->setTarget(this); graphicsContainer->setBackgroundType(ThemeEngine::kDialogBackgroundNone); addGraphicControls(graphicsContainer, "GlobalOptions_Graphics_Container."); @@ -1559,7 +1559,7 @@ void GlobalOptionsDialog::build() { // if (g_system->hasFeature(OSystem::kFeatureShader)) { - tab->addTab(_("Shader")); + tab->addTab(_("Shader"), "GlobalOptions_Shader"); addShaderControls(tab, "GlobalOptions_Shader."); } @@ -1571,21 +1571,21 @@ void GlobalOptionsDialog::build() { g_system->hasFeature(OSystem::kFeatureSwapMenuAndBackButtons) || g_system->hasFeature(OSystem::kFeatureKbdMouseSpeed) || g_system->hasFeature(OSystem::kFeatureJoystickDeadzone)) { - tab->addTab(_("Control")); + tab->addTab(_("Control"), "GlobalOptions_Control"); addControlControls(tab, "GlobalOptions_Control."); } // // 2) The audio tab // - tab->addTab(_("Audio")); + tab->addTab(_("Audio"), "GlobalOptions_Audio"); addAudioControls(tab, "GlobalOptions_Audio."); addSubtitleControls(tab, "GlobalOptions_Audio."); if (g_system->getOverlayWidth() > 320) - tab->addTab(_("Volume")); + tab->addTab(_("Volume"), "GlobalOptions_Volume"); else - tab->addTab(_c("Volume", "lowres")); + tab->addTab(_c("Volume", "lowres"), "GlobalOptions_Volume"); addVolumeControls(tab, "GlobalOptions_Volume."); // TODO: cd drive setting @@ -1593,7 +1593,7 @@ void GlobalOptionsDialog::build() { // // 3) The MIDI tab // - _midiTabId = tab->addTab(_("MIDI")); + _midiTabId = tab->addTab(_("MIDI"), "GlobalOptions_MIDI"); addMIDIControls(tab, "GlobalOptions_MIDI."); #ifdef USE_FLUIDSYNTH @@ -1603,16 +1603,16 @@ void GlobalOptionsDialog::build() { // // 4) The MT-32 tab // - tab->addTab(_("MT-32")); + tab->addTab(_("MT-32"), "GlobalOptions_MT32"); addMT32Controls(tab, "GlobalOptions_MT32."); // // 5) The Paths tab // if (g_system->getOverlayWidth() > 320) - _pathsTabId = tab->addTab(_("Paths")); + _pathsTabId = tab->addTab(_("Paths"), "GlobalOptions_Paths"); else - _pathsTabId = tab->addTab(_c("Paths", "lowres")); + _pathsTabId = tab->addTab(_c("Paths", "lowres"), "GlobalOptions_Paths"); #if !defined(__DC__) // These two buttons have to be extra wide, or the text will be @@ -1656,9 +1656,9 @@ void GlobalOptionsDialog::build() { // 6) The miscellaneous tab // if (g_system->getOverlayWidth() > 320) - tab->addTab(_("Misc")); + tab->addTab(_("Misc"), "GlobalOptions_Misc"); else - tab->addTab(_c("Misc", "lowres")); + tab->addTab(_c("Misc", "lowres"), "GlobalOptions_Misc"); new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", _("Theme:"), 0, kChooseThemeCmd); _curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName()); @@ -1762,11 +1762,11 @@ void GlobalOptionsDialog::build() { // 7) The Cloud tab (remote storages) // if (g_system->getOverlayWidth() > 320) - tab->addTab(_("Cloud")); + tab->addTab(_("Cloud"), "GlobalOptions_Cloud"); else - tab->addTab(_c("Cloud", "lowres")); + tab->addTab(_c("Cloud", "lowres"), "GlobalOptions_Cloud"); - ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", kCloudTabContainerReflowCmd); + ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", "GlobalOptions_Cloud_Container", kCloudTabContainerReflowCmd); container->setTarget(this); container->setBackgroundType(ThemeEngine::kDialogBackgroundNone); setTarget(container); @@ -1778,9 +1778,9 @@ void GlobalOptionsDialog::build() { // 8) The LAN tab (local "cloud" webserver) // if (g_system->getOverlayWidth() > 320) - tab->addTab(_("LAN")); + tab->addTab(_("LAN"), "GlobalOptions_Network"); else - tab->addTab(_c("LAN", "lowres")); + tab->addTab(_c("LAN", "lowres"), "GlobalOptions_Network"); addNetworkControls(tab, "GlobalOptions_Network.", g_system->getOverlayWidth() <= 320); #endif // USE_SDL_NET #endif // USE_CLOUD @@ -1788,9 +1788,9 @@ void GlobalOptionsDialog::build() { //Accessibility #ifdef USE_TTS if (g_system->getOverlayWidth() > 320) - tab->addTab(_("Accessibility")); + tab->addTab(_("Accessibility"), "GlobalOptions_Accessibility"); else - tab->addTab(_c("Accessibility", "lowres")); + tab->addTab(_c("Accessibility", "lowres"), "GlobalOptions_Accessibility"); _ttsCheckbox = new CheckboxWidget(tab, "GlobalOptions_Accessibility.TTSCheckbox", _("Use Text to speech"), _("Will read text in gui on mouse over.")); if (ConfMan.hasKey("tts_enabled")) @@ -2175,9 +2175,9 @@ void GlobalOptionsDialog::apply() { #endif if (isRebuildNeeded) { - rebuild(); if (_launcher != 0) _launcher->rebuild(); + rebuild(); } _newTheme.clear(); |