diff options
author | Max Horn | 2002-12-01 12:47:13 +0000 |
---|---|---|
committer | Max Horn | 2002-12-01 12:47:13 +0000 |
commit | 7098159101a7be094586dbe7383d7ecb1a2f53cf (patch) | |
tree | d0d7efd962ccf3ce8070694032db9ab912e25a34 /gui | |
parent | 1c8599066bad54d952b68254571f7d340fe6d096 (diff) | |
download | scummvm-rg350-7098159101a7be094586dbe7383d7ecb1a2f53cf.tar.gz scummvm-rg350-7098159101a7be094586dbe7383d7ecb1a2f53cf.tar.bz2 scummvm-rg350-7098159101a7be094586dbe7383d7ecb1a2f53cf.zip |
fixed launcher buttons again
svn-id: r5770
Diffstat (limited to 'gui')
-rw-r--r-- | gui/launcher.cpp | 52 | ||||
-rw-r--r-- | gui/launcher.h | 1 |
2 files changed, 29 insertions, 24 deletions
diff --git a/gui/launcher.cpp b/gui/launcher.cpp index d0be18ad47..0bfae7ca35 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -180,27 +180,27 @@ LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector) addButton(1*(_w - kButtonWidth)/6, _h - 24, "Quit", kQuitCmd, 'Q'); addButton(3*(_w - kButtonWidth)/6, _h - 24, "Options", kOptionsCmd, 'O'); _startButton = addButton(5*(_w - kButtonWidth)/6, _h - 24, "Start", kStartCmd, 'S'); - _startButton->setEnabled(false); // Add list with game titles _list = new ListWidget(this, 10, 28, 300, 112); _list->setEditable(false); _list->setNumberingMode(kListNumberingOff); - // Populate the list - updateListing(); - - // TODO - make a default selection (maybe the game user played last?) - //_list->setSelected(0); - // Two more buttons directly below the list box const int kBigButtonWidth = 90; new ButtonWidget(this, 10, 144, kBigButtonWidth, 16, "Add Game...", kAddGameCmd, 'A'); _editButton = new ButtonWidget(this, (320-kBigButtonWidth)/2, 144, kBigButtonWidth, 16, "Edit Game...", kEditGameCmd, 'E'); - _editButton->setEnabled(false); _removeButton = new ButtonWidget(this, 320-kBigButtonWidth-10, 144, kBigButtonWidth, 16, "Remove Game", kRemoveGameCmd, 'R'); - _removeButton->setEnabled(false); + // Populate the list + updateListing(); + + // TODO - make a default selection (maybe the game user played last?) + //_list->setSelected(0); + + // En-/Disable the buttons depending on the list selection + updateButtons(); + // Create file browser dialog _browser = new BrowserDialog(_gui); @@ -262,6 +262,7 @@ void LauncherDialog::updateListing() } _list->setList(l); + updateButtons(); } /* @@ -448,21 +449,8 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat _detector.setGame(_domains[item]); close(); break; - case kListSelectionChangedCmd: { - bool enable = ((int)data >= 0); - if (enable != _startButton->isEnabled()) { - _startButton->setEnabled(enable); - _startButton->draw(); - } - if (enable != _editButton->isEnabled()) { - _editButton->setEnabled(enable); - _editButton->draw(); - } - if (enable != _removeButton->isEnabled()) { - _removeButton->setEnabled(enable); - _removeButton->draw(); - } - } + case kListSelectionChangedCmd: + updateButtons(); break; case kQuitCmd: g_system->quit(); @@ -471,3 +459,19 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat Dialog::handleCommand(sender, cmd, data); } } + +void LauncherDialog::updateButtons() { + bool enable = (_list->getSelected() >= 0); + if (enable != _startButton->isEnabled()) { + _startButton->setEnabled(enable); + _startButton->draw(); + } + if (enable != _editButton->isEnabled()) { + _editButton->setEnabled(enable); + _editButton->draw(); + } + if (enable != _removeButton->isEnabled()) { + _removeButton->setEnabled(enable); + _removeButton->draw(); + } +} diff --git a/gui/launcher.h b/gui/launcher.h index 33b26953f6..5c9450218b 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -50,6 +50,7 @@ protected: BrowserDialog *_browser; void updateListing(); + void updateButtons(); }; #endif |