aboutsummaryrefslogtreecommitdiff
path: root/gui/launcher.cpp
diff options
context:
space:
mode:
authorMax Horn2002-11-21 12:48:50 +0000
committerMax Horn2002-11-21 12:48:50 +0000
commitdec234c6a563fbc0bec4d604dea45189739e2ee2 (patch)
tree6b138affb87fdf3936af1999785112f98becf8c8 /gui/launcher.cpp
parentcb160cfbf369c8a66d7ad9e6bfdecfaacc826ef2 (diff)
downloadscummvm-rg350-dec234c6a563fbc0bec4d604dea45189739e2ee2.tar.gz
scummvm-rg350-dec234c6a563fbc0bec4d604dea45189739e2ee2.tar.bz2
scummvm-rg350-dec234c6a563fbc0bec4d604dea45189739e2ee2.zip
factored out ChooserDialog into it's own header/source file, and made the title adjustable; added a dummy file for EditFieldWidget (not implemented yet); some other cleanup
svn-id: r5658
Diffstat (limited to 'gui/launcher.cpp')
-rw-r--r--gui/launcher.cpp64
1 files changed, 2 insertions, 62 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index bf0087835a..88efae7860 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -21,6 +21,7 @@
#include "stdafx.h"
#include "launcher.h"
#include "browser.h"
+#include "chooser.h"
#include "newgui.h"
#include "ListWidget.h"
@@ -30,67 +31,6 @@
#include "common/gameDetector.h"
enum {
- kChooseCmd = 'Chos'
-};
-
-/*
- * A dialog that allows the user to choose between a selection of items
- */
-
-class ChooserDialog : public Dialog {
- typedef ScummVM::String String;
- typedef ScummVM::StringList StringList;
-public:
- ChooserDialog(NewGui *gui, const StringList& list);
-
- virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
-
-protected:
- ListWidget *_list;
- ButtonWidget *_chooseButton;
-};
-
-ChooserDialog::ChooserDialog(NewGui *gui, const StringList& list)
- : Dialog(gui, 40, 30, 320-2*40, 200-2*30)
-{
- // Headline
- new StaticTextWidget(this, 10, 8, _w-2*10, kLineHeight,
- "Pick the game:", kTextAlignCenter);
-
- // Add choice list
- _list = new ListWidget(this, 10, 22, _w-2*10, _h-22-24-10);
- _list->setNumberingMode(kListNumberingOff);
- _list->setList(list);
-
- // Buttons
- addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0);
- _chooseButton = addButton(_w-(kButtonWidth+10), _h-24, "Choose", kChooseCmd, 0);
- _chooseButton->setEnabled(false);
-
- // Result = -1 -> no choice was made
- setResult(-1);
-}
-
-void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
- int item = _list->getSelected();
- switch (cmd) {
- case kChooseCmd:
- case kListItemDoubleClickedCmd:
- setResult(item);
- close();
- break;
- case kListSelectionChangedCmd:
- _chooseButton->setEnabled(item >= 0);
- _chooseButton->draw();
- break;
- default:
- Dialog::handleCommand(sender, cmd, data);
- }
-}
-
-
-enum {
kStartCmd = 'STRT',
kOptionsCmd = 'OPTN',
kAddGameCmd = 'ADDG',
@@ -279,7 +219,7 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
for (i = 0; i < candidates.size(); i++)
list.push_back(candidates[i]->gamename);
- ChooserDialog dialog(_gui, list);
+ ChooserDialog dialog(_gui, "Pick the game:", list);
i = dialog.runModal();
if (0 <= i && i < candidates.size())
v = candidates[i];