diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/browser.cpp | 51 | ||||
-rw-r--r-- | gui/browser.h | 45 | ||||
-rw-r--r-- | gui/launcher.cpp | 11 |
3 files changed, 104 insertions, 3 deletions
diff --git a/gui/browser.cpp b/gui/browser.cpp new file mode 100644 index 0000000000..dd20b6c01c --- /dev/null +++ b/gui/browser.cpp @@ -0,0 +1,51 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#include "browser.h" +#include "newgui.h" +#include "ListWidget.h" + +#include "backends/fs/fs.h" + +/* We want to use this as a general directory selector at some point... possible uses + * - to select the data dir for a game + * - to select the place where save games are stored + * - others??? + */ + +BrowserDialog::BrowserDialog(NewGui *gui) + : Dialog(gui, 50, 20, 320-2*50, 200-2*20) +{ + // Headline - TODO: should be customizable during creation time + new StaticTextWidget(this, 10, 10, _w-2*10, kLineHeight, + "Select directory with game data", kTextAlignCenter); + + // Add file list + _fileList = new ListWidget(this, 10, 20, _w-2*10, _h-20-24-10); + + // Buttons + addButton(10, _h-24, "Go up", kCloseCmd, 0); + addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0); + addButton(_w-(kButtonWidth+10), _h-24, "Choose", kCloseCmd, 0); + + // TODO - populate list item, implement buttons, etc. etc. + // TODO - will the choose button select the directory we are currrently in?!? + // TODO - double clicking an item should traverse into that directory +} diff --git a/gui/browser.h b/gui/browser.h new file mode 100644 index 0000000000..a07f169eb3 --- /dev/null +++ b/gui/browser.h @@ -0,0 +1,45 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + */ + +#ifndef BROWSER_DIALOG_H +#define BROWSER_DIALOG_H + +#include "dialog.h" +#include "common/str.h" +#include "common/list.h" + +class ListWidget; +class FilesystemNode; +class FSList; + +class BrowserDialog : public Dialog { + typedef ScummVM::String String; + typedef ScummVM::StringList StringList; +public: + BrowserDialog(NewGui *gui); + +protected: + ListWidget *_fileList; + FilesystemNode *_node; + FSList *_content; + +}; + +#endif diff --git a/gui/launcher.cpp b/gui/launcher.cpp index fff6290f3f..2526d0a6ba 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -20,6 +20,7 @@ #include "stdafx.h" #include "launcher.h" +#include "browser.h" #include "newgui.h" #include "ListWidget.h" @@ -112,7 +113,7 @@ LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector) // Two more buttons directly below the list box bw = new ButtonWidget(this, 10, 144, 80, 16, "Add Game...", kAddGameCmd, 'A'); - bw->setEnabled(false); +// bw->setEnabled(false); bw = new ButtonWidget(this, 320-90, 144, 80, 16, "Configure...", kConfigureGameCmd, 'C'); bw->setEnabled(false); } @@ -122,14 +123,18 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat int item; switch (cmd) { - case kAddGameCmd: + case kAddGameCmd: { // TODO: Allow user to add a new game to the list. - // 1) show a file selection dialog (to be implemented!) which lets + // 1) show a dir selection dialog which lets // the user pick the directory the game data resides in. // 2) show the user a list of games to pick from. Initially just show // all known games. But ideally, we would refine this list by checking // which choices are possible. E.g. if we don't find atlantis.000 in that // directory, then it's not FOA etc. + BrowserDialog *browser = new BrowserDialog(_gui); + browser->runModal(); + delete browser; + } break; case kConfigureGameCmd: // Set game specifc options. Most of these should be "optional", i.e. by |