The Battle for Wesnoth  1.17.0-dev
hotkey_bind.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2021
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 #pragma once
16 
18 #include "hotkey/hotkey_item.hpp"
19 
20 #include <SDL2/SDL_keycode.h>
21 
22 #include <string>
23 
24 namespace gui2::dialogs
25 {
26 
27 class hotkey_bind : public modal_dialog
28 {
29 public:
30  explicit hotkey_bind(const std::string& hotkey_id);
31 
33  {
34  return new_binding_;
35  }
36 
37 private:
38  const std::string& hotkey_id_;
39 
41 
42  void sdl_event_callback(const SDL_Event& event);
43 
44  virtual const std::string& window_id() const override;
45 
46  virtual void pre_show(window& window) override;
47 };
48 
49 } // namespace dialogs
hotkey::hotkey_ptr get_new_binding() const
Definition: hotkey_bind.hpp:32
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
Definition: hotkey_bind.cpp:36
hotkey_bind(const std::string &hotkey_id)
Definition: hotkey_bind.cpp:29
hotkey::hotkey_ptr new_binding_
Definition: hotkey_bind.hpp:40
const std::string & hotkey_id_
Definition: hotkey_bind.hpp:38
std::shared_ptr< hotkey_base > hotkey_ptr
Definition: hotkey_item.hpp:32
Abstract base class for all modal dialogs.
void sdl_event_callback(const SDL_Event &event)
Definition: hotkey_bind.cpp:43
virtual const std::string & window_id() const override
The id of the window to build.
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65