From 37ef8ec908bdf0e31aafb1236f169bfe31db40c2 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 25 Jan 2014 22:30:25 +0100 Subject: [PATCH] Savegame dialog: support loading saves using Enter key or double-click --- apps/openmw/mwgui/savegamedialog.cpp | 8 ++++++++ apps/openmw/mwgui/savegamedialog.hpp | 1 + 2 files changed, 9 insertions(+) diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 91993b0be..17aaa1189 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -34,7 +34,13 @@ namespace MWGui mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SaveGameDialog::onCancelButtonClicked); mCharacterSelection->eventComboChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onCharacterSelected); mSaveList->eventListChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onSlotSelected); + mSaveList->eventListSelectAccept += MyGUI::newDelegate(this, &SaveGameDialog::onSlotActivated); + } + void SaveGameDialog::onSlotActivated(MyGUI::ListBox *sender, size_t pos) + { + onSlotSelected(sender, pos); + onOkButtonClicked(mOkButton); } void SaveGameDialog::open() @@ -103,6 +109,8 @@ namespace MWGui void SaveGameDialog::onOkButtonClicked(MyGUI::Widget *sender) { + MyGUI::InputManager::getInstance().setKeyFocusWidget(NULL); + // Get the selected slot, if any unsigned int i=0; const MWState::Slot* slot = NULL; diff --git a/apps/openmw/mwgui/savegamedialog.hpp b/apps/openmw/mwgui/savegamedialog.hpp index 2a188061c..bf6fab73a 100644 --- a/apps/openmw/mwgui/savegamedialog.hpp +++ b/apps/openmw/mwgui/savegamedialog.hpp @@ -24,6 +24,7 @@ namespace MWGui void onOkButtonClicked (MyGUI::Widget* sender); void onCharacterSelected (MyGUI::ComboBox* sender, size_t pos); void onSlotSelected (MyGUI::ListBox* sender, size_t pos); + void onSlotActivated (MyGUI::ListBox* sender, size_t pos); void fillSaveList();