The Battle for Wesnoth  1.15.1+dev
hotkey_handler_sp.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2018 by Chris Beck <render787@gmail.com>
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 /**
16  * @file
17  * An extension of play_controller::hotkey_handler, which has support for
18  * SP wesnoth features like whiteboard, end turn, etc.
19  */
20 
21 #pragma once
22 
24 
26 
28 
29 protected:
31 
32  std::shared_ptr<wb::manager> whiteboard_manager_;
33 
34  bool is_observer() const;
35 
36 public:
39 
40  virtual void recruit() override;
41  virtual void repeat_recruit() override;
42  virtual void recall() override;
43  virtual bool can_execute_command(const hotkey::hotkey_command& command, int index=-1) const override;
44  virtual void toggle_shroud_updates() override;
45  virtual void update_shroud_now() override;
46  virtual void end_turn() override;
47  virtual void rename_unit() override;
48  virtual void create_unit() override;
49  virtual void change_side() override;
50  virtual void kill_unit() override;
51  virtual void label_terrain(bool) override;
52  virtual void clear_labels() override;
53  virtual void label_settings() override;
54  virtual void continue_move() override;
55  virtual void unit_hold_position() override;
56  virtual void end_unit_turn() override;
57  virtual void user_command() override;
58  virtual void custom_command() override;
59  virtual void ai_formula() override;
60  virtual void clear_messages() override;
61  // Whiteboard hotkeys
62  virtual void whiteboard_toggle() override;
63  virtual void whiteboard_execute_action() override;
64  virtual void whiteboard_execute_all_actions() override;
65  virtual void whiteboard_delete_action() override;
66  virtual void whiteboard_bump_up_action() override;
67  virtual void whiteboard_bump_down_action() override;
68  virtual void whiteboard_suppose_dead() override;
69 
70  //replay
72  {
73  assert(playsingle_controller_.get_replay_controller());
74  return *playsingle_controller_.get_replay_controller();
75  }
76  virtual void stop_replay() override
77  { return get_replay_controller().stop_replay(); }
78  virtual void play_replay() override
79  { return get_replay_controller().play_replay(); }
80  virtual void replay_next_turn() override
82  virtual void replay_next_side() override
84  virtual void replay_next_move() override
86  virtual void replay_show_everything() override
88  virtual void replay_show_each() override
90  virtual void replay_show_team1() override
92  virtual void reset_replay() override
93  { return playsingle_controller_.reset_replay(); }
94  virtual void replay_exit() override;
95  virtual void load_autosave(const std::string& filename) override;
96  virtual hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const override;
97 };
virtual bool can_execute_command(const hotkey::hotkey_command &command, int index=-1) const override
Check if a command can be executed.
virtual void replay_show_everything() override
virtual void toggle_shroud_updates() override
std::shared_ptr< wb::manager > whiteboard_manager_
virtual void load_autosave(const std::string &filename) override
Stores all information related to functions that can be bound to hotkeys.
virtual void whiteboard_suppose_dead() override
This file implements all the hotkey handling and menu details for play controller.
replay_controller * get_replay_controller() const override
virtual hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const override
virtual void whiteboard_bump_down_action() override
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:71
hotkey_handler(playsingle_controller &, saved_game &)
virtual void whiteboard_bump_up_action() override
virtual void whiteboard_execute_all_actions() override
virtual void whiteboard_delete_action() override
virtual void label_terrain(bool) override
playsingle_controller & playsingle_controller_
virtual void whiteboard_execute_action() override