The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
hotkey_bind.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 - 2025
3 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY.
11
12 See the COPYING file for more details.
13*/
14
15#define GETTEXT_DOMAIN "wesnoth-lib"
16
18
20
21
22namespace gui2::dialogs
23{
24
25REGISTER_DIALOG(hotkey_bind)
26
27hotkey_bind::hotkey_bind(const std::string& hotkey_id)
28 : modal_dialog(window_id())
29 , hotkey_id_(hotkey_id)
30 , new_binding_()
31{
32}
33
35{
36 connect_signal<event::SDL_RAW_EVENT>(
37 std::bind(&hotkey_bind::sdl_event_callback, this, std::placeholders::_5),
39}
40
41void hotkey_bind::sdl_event_callback(const SDL_Event &event)
42{
43 if (hotkey::is_hotkeyable_event(event)) {
45 }
46 if(new_binding_) {
48 }
49}
50
51
52} // namespace dialogs
hotkey::hotkey_ptr new_binding_
const std::string & hotkey_id_
void sdl_event_callback(const SDL_Event &event)
virtual void pre_show() override
Actions to be taken before showing the window.
Abstract base class for all modal dialogs.
void set_retval(const int retval, const bool close_window=true)
Sets there return value of the window.
Definition window.hpp:387
This file contains the window object, this object is a top level container which has the event manage...
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
@ OK
Dialog was closed with the OK button.
Definition retval.hpp:35
hotkey_ptr create_hotkey(const std::string &id, const SDL_Event &event)
Create a new hotkey item for a command from an SDL_Event.
bool is_hotkeyable_event(const SDL_Event &event)
STL namespace.