The Battle for Wesnoth  1.15.2+dev
hotkey_bind.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2018 by the Battle for Wesnoth Project https://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12 */
13 
14 #pragma once
15 
17 #include "hotkey/hotkey_item.hpp"
18 
19 #include <SDL2/SDL_keycode.h>
20 
21 #include <string>
22 
23 namespace gui2
24 {
25 namespace dialogs
26 {
27 
28 class hotkey_bind : public modal_dialog
29 {
30 public:
31  explicit hotkey_bind(const std::string& hotkey_id);
32 
34  {
35  return new_binding_;
36  }
37 
38 private:
39  const std::string& hotkey_id_;
40 
42 
43  void sdl_event_callback(window& win, const SDL_Event &event);
44 
45  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
46  virtual const std::string& window_id() const override;
47 
48  /** Inherited from modal_dialog. */
49  virtual void pre_show(window& window) override;
50 };
51 
52 } // namespace dialogs
53 } // namespace gui2
hotkey::hotkey_ptr get_new_binding() const
Definition: hotkey_bind.hpp:33
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Definition: hotkey_bind.cpp:37
hotkey_bind(const std::string &hotkey_id)
Definition: hotkey_bind.cpp:30
Generic file dialog.
Definition: field-fwd.hpp:22
hotkey::hotkey_ptr new_binding_
Definition: hotkey_bind.hpp:41
Various uncategorised dialogs.
const std::string & hotkey_id_
Definition: hotkey_bind.hpp:39
void sdl_event_callback(window &win, const SDL_Event &event)
Definition: hotkey_bind.cpp:44
std::shared_ptr< hotkey_base > hotkey_ptr
Definition: hotkey_item.hpp:30
Abstract base class for all modal dialogs.
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62