GUI2/Game Load: allow deleting saves with the Delete key (closes #1730)

This commit is contained in:
Charles Dang 2017-05-29 21:39:22 +11:00
parent 121c1cb007
commit 118b467044
2 changed files with 14 additions and 0 deletions

View file

@ -105,6 +105,9 @@ game_load::game_load(const config& cache_config, savegame::load_game_metadata& d
void game_load::pre_show(window& window)
{
// Allow deleting saves with the Delete key.
connect_signal_pre_key_press(window, std::bind(&game_load::key_press_callback, this, std::ref(window), _5));
find_widget<minimap>(&window, "minimap", false).set_config(&cache_config_);
text_box* filter = find_widget<text_box>(&window, "txtFilter", false, true);
@ -388,5 +391,12 @@ void game_load::delete_button_callback(window& window)
}
}
void game_load::key_press_callback(window& window, const SDL_Keycode key)
{
if(key == SDLK_DELETE) {
delete_button_callback(window);
}
}
} // namespace dialogs
} // namespace gui2

View file

@ -21,6 +21,8 @@
#include "tstring.hpp"
#include "gettext.hpp"
#include <SDL_keycode.h>
namespace gui2
{
@ -58,6 +60,8 @@ private:
void display_savegame(window& window);
void evaluate_summary_string(std::stringstream& str, const config& cfg_summary);
void key_press_callback(window& window, const SDL_Keycode key);
std::string& filename_;
field_bool* change_difficulty_;