aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/ListWidget.cpp11
-rw-r--r--gui/ListWidget.h1
-rw-r--r--gui/launcher.cpp3
3 files changed, 15 insertions, 0 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index 3d5c3dee62..1ca6846e86 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -243,6 +243,17 @@ bool ListWidget::handleKeyDown(Common::KeyState state) {
sendCommand(kListItemActivatedCmd, _selectedItem);
}
break;
+ case Common::KEYCODE_BACKSPACE:
+ case Common::KEYCODE_KP_PERIOD:
+ case Common::KEYCODE_DELETE:
+ if (_selectedItem >= 0) {
+ if (_editable) {
+ // Ignore delete and backspace when the list item is editable
+ } else {
+ sendCommand(kListItemRemovalRequestCmd, _selectedItem);
+ }
+ }
+ break;
case Common::KEYCODE_UP:
if (_selectedItem > 0)
_selectedItem--;
diff --git a/gui/ListWidget.h b/gui/ListWidget.h
index fe3dd4cd7e..50d16f494f 100644
--- a/gui/ListWidget.h
+++ b/gui/ListWidget.h
@@ -42,6 +42,7 @@ enum NumberingMode {
enum {
kListItemDoubleClickedCmd = 'LIdb', // double click on item - 'data' will be item index
kListItemActivatedCmd = 'LIac', // item activated by return/enter - 'data' will be item index
+ kListItemRemovalRequestCmd = 'LIrm', // request to remove the item with the delete/backspace keys - 'data' will be item index
kListSelectionChangedCmd = 'Lsch' // selection changed - 'data' will be item index
};
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 215f389f6d..2dc3fbba28 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -839,6 +839,9 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
ConfMan.setActiveDomain(_domains[item]);
close();
break;
+ case kListItemRemovalRequestCmd:
+ removeGame(item);
+ break;
case kListSelectionChangedCmd:
updateButtons();
break;