diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/launcher.cpp | 51 | ||||
-rw-r--r-- | gui/launcher.h | 5 |
2 files changed, 41 insertions, 15 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp index cf9c0bf56d..f96dd17d46 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -99,6 +99,30 @@ LauncherDialog::LauncherDialog() _w = screenW; _h = screenH; + build(); + + GUI::GuiManager::instance()._launched = true; +} + +void LauncherDialog::selectTarget(const String &target) { + if (!target.empty()) { + int itemToSelect = 0; + StringArray::const_iterator iter; + for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) { + if (target == *iter) { + _list->setSelected(itemToSelect); + break; + } + } + } +} + +LauncherDialog::~LauncherDialog() { + delete _browser; + delete _loadDialog; +} + +void LauncherDialog::build() { #ifndef DISABLE_FANCY_THEMES _logo = 0; if (g_gui.xmlEval()->getVar("Globals.ShowLauncherLogo") == 1 && g_gui.theme()->supportsImages()) { @@ -174,28 +198,25 @@ LauncherDialog::LauncherDialog() // Create Load dialog _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"), false); - - GUI::GuiManager::instance()._launched = true; } -void LauncherDialog::selectTarget(const String &target) { - if (!target.empty()) { - int itemToSelect = 0; - StringArray::const_iterator iter; - for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) { - if (target == *iter) { - _list->setSelected(itemToSelect); - break; - } - } +void LauncherDialog::clean() { + while (_firstWidget) { + Widget* w = _firstWidget; + removeWidget(w); + delete w; } -} - -LauncherDialog::~LauncherDialog() { delete _browser; delete _loadDialog; } +void LauncherDialog::rebuild() { + clean(); + build(); + reflowLayout(); + setFocusWidget(_firstWidget); +} + void LauncherDialog::open() { // Clear the active domain, in case we return to the dialog from a // failure to launch a game. Otherwise, pressing ESC will attempt to diff --git a/gui/launcher.h b/gui/launcher.h index 58f1c930ed..08413fe3d2 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -47,6 +47,8 @@ public: LauncherDialog(); ~LauncherDialog(); + void rebuild(); + virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); virtual void handleKeyDown(Common::KeyState state); @@ -83,6 +85,9 @@ protected: void updateButtons(); void switchButtonsText(ButtonWidget *button, const char *normalText, const char *shiftedText); + void build(); + void clean(); + void open(); void close(); |