diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/chooser.cpp | 7 | ||||
-rw-r--r-- | gui/chooser.h | 4 | ||||
-rw-r--r-- | gui/launcher.cpp | 3 |
3 files changed, 10 insertions, 4 deletions
diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 78d270269e..ad32c4f6ad 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -29,7 +29,7 @@ enum { kChooseCmd = 'Chos' }; -ChooserDialog::ChooserDialog(const String &title, const StringList& list, const String &buttonLabel, int height) +ChooserDialog::ChooserDialog(const String &title, const String &buttonLabel, int height) : Dialog(8, (200 - height) / 2, 320 - 2 * 8, height) { // Headline new StaticTextWidget(this, 10, 6, _w - 2 * 10, kLineHeight, title, kTextAlignCenter); @@ -37,7 +37,6 @@ ChooserDialog::ChooserDialog(const String &title, const StringList& list, const // Add choice list _list = new ListWidget(this, 10, 18, _w - 2 * 10, _h - 14 - 24 - 10); _list->setNumberingMode(kListNumberingOff); - _list->setList(list); // Buttons addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); @@ -45,6 +44,10 @@ ChooserDialog::ChooserDialog(const String &title, const StringList& list, const _chooseButton->setEnabled(false); } +void ChooserDialog::setList(const StringList& list) { + _list->setList(list); +} + void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { int item = _list->getSelected(); switch (cmd) { diff --git a/gui/chooser.h b/gui/chooser.h index e1d8311f07..bf8732be91 100644 --- a/gui/chooser.h +++ b/gui/chooser.h @@ -42,7 +42,9 @@ protected: ButtonWidget *_chooseButton; public: - ChooserDialog(const String &title, const StringList &list, const String &buttonLabel = "Choose", int height = 140); + ChooserDialog(const String &title, const String &buttonLabel = "Choose", int height = 140); + + void setList(const StringList& list); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); }; diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 5cabc4c7bb..6ac0a8a9a7 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -428,7 +428,8 @@ void LauncherDialog::addGame() { for (idx = 0; idx < candidates.size(); idx++) list.push_back(candidates[idx].description); - ChooserDialog dialog("Pick the game:", list); + ChooserDialog dialog("Pick the game:"); + dialog.setList(list); idx = dialog.runModal(); } if (0 <= idx && idx < candidates.size()) { |