The Battle for Wesnoth  1.17.0-dev
unit_recall.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 "gui/widgets/group.hpp"
19 #include "units/race.hpp"
20 #include "units/ptr.hpp"
21 
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 class team;
27 
28 namespace gui2
29 {
30 
31 class text_box_base;
32 
33 namespace dialogs
34 {
35 
36 class unit_recall : public modal_dialog
37 {
38 public:
39  unit_recall(std::vector<unit_const_ptr>& recall_list, team& team);
40 
41  int get_selected_index() const
42  {
43  return selected_index_;
44  }
45 
46 private:
47  std::vector<unit_const_ptr>& recall_list_;
48 
49  team& team_;
50 
52 
53  std::vector<std::string> filter_options_;
54  std::vector<std::string> last_words_;
55 
56  /** Callbacks */
57  void list_item_clicked();
58  void filter_text_changed(const std::string& text);
59  void rename_unit();
60  void dismiss_unit();
61  void show_help();
62 
63  virtual const std::string& window_id() const override;
64 
65  virtual void pre_show(window& window) override;
66 
67  virtual void post_show(window& window) override;
68 };
69 
70 } // namespace dialogs
71 } // namespace gui2
unit_recall(std::vector< unit_const_ptr > &recall_list, team &team)
Definition: unit_recall.cpp:61
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
std::vector< unit_const_ptr > & recall_list_
Definition: unit_recall.hpp:47
Generic file dialog.
Definition: field-fwd.hpp:23
void filter_text_changed(const std::string &text)
This class stores all the data for a single &#39;side&#39; (in game nomenclature).
Definition: team.hpp:72
std::vector< std::string > filter_options_
Definition: unit_recall.hpp:53
Various uncategorised dialogs.
virtual const std::string & window_id() const override
The id of the window to build.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
void list_item_clicked()
Callbacks.
std::vector< std::string > last_words_
Definition: unit_recall.hpp:54
Abstract base class for all modal dialogs.
base class of top level items, the only item which needs to store the final canvases to draw on...
Definition: window.hpp:65