diff options
author | Max Horn | 2002-10-01 23:11:19 +0000 |
---|---|---|
committer | Max Horn | 2002-10-01 23:11:19 +0000 |
commit | 3d7552890a52067ed493c63522fb11bb13ed72bd (patch) | |
tree | ab6bb989f3a36b00cc8f6c15337aba640c1a1cd1 /gui/launcher.cpp | |
parent | 1e626a712828e630d0a8583ab1a9a0b838d2d6cf (diff) | |
download | scummvm-rg350-3d7552890a52067ed493c63522fb11bb13ed72bd.tar.gz scummvm-rg350-3d7552890a52067ed493c63522fb11bb13ed72bd.tar.bz2 scummvm-rg350-3d7552890a52067ed493c63522fb11bb13ed72bd.zip |
fixed ListWidget drawin/behaviour if there are less items than fit on one page; enhanced launcher dialog to disable start button if nothing is selected
svn-id: r5068
Diffstat (limited to 'gui/launcher.cpp')
-rw-r--r-- | gui/launcher.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp index e953982035..f602b1bb77 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -50,7 +50,8 @@ LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector) // Add three buttons at the bottom addButton(1*(_w - 54)/6, _h - 24, 54, 16, "Quit", kQuitCmd, 'Q'); addButton(3*(_w - 54)/6, _h - 24, 54, 16, "Options", kOptionsCmd, 'O'); - addButton(5*(_w - 54)/6, _h - 24, 54, 16, "Start", kStartCmd, 'S'); + _startButton = addButton(5*(_w - 54)/6, _h - 24, 54, 16, "Start", kStartCmd, 'S'); + _startButton->setEnabled(false); // Add list with game titles _list = new ListWidget(this, 10, 10, 300, 112); @@ -83,14 +84,13 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kListItemDoubleClickedCmd: // Print out what was selected item = _list->getSelected(); - if (item >= 0) { - printf("Selected game: %s\n", _filenames[item].c_str()); - _detector.setGame(_filenames[item].c_str()); - close(); - } else { - // TODO - beep or so ? - // Ideally, the start button should be disabled if no game is selected - } + assert(item >= 0); + _detector.setGame(_filenames[item].c_str()); + close(); + break; + case kListSelectionChangedCmd: + _startButton->setEnabled(_list->getSelected() >= 0); + _startButton->draw(); break; case kQuitCmd: g_system->quit(); |