The Battle for Wesnoth  1.15.12+dev
unit_recall.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 "gui/widgets/group.hpp"
18 #include "units/race.hpp"
19 #include "units/ptr.hpp"
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 class team;
26 
27 namespace gui2
28 {
29 
30 class text_box_base;
31 
32 namespace dialogs
33 {
34 
35 class unit_recall : public modal_dialog
36 {
37 public:
38  unit_recall(std::vector<unit_const_ptr>& recall_list, team& team);
39 
40  int get_selected_index() const
41  {
42  return selected_index_;
43  }
44 
45 private:
46  std::vector<unit_const_ptr>& recall_list_;
47 
48  team& team_;
49 
51 
52  std::vector<std::string> filter_options_;
53  std::vector<std::string> last_words_;
54 
55  /** Callbacks */
56  void list_item_clicked();
57  void filter_text_changed(const std::string& text);
58  void rename_unit();
59  void dismiss_unit();
60  void show_help();
61 
62  virtual const std::string& window_id() const override;
63 
64  virtual void pre_show(window& window) override;
65 
66  virtual void post_show(window& window) override;
67 };
68 
69 } // namespace dialogs
70 } // namespace gui2
unit_recall(std::vector< unit_const_ptr > &recall_list, team &team)
Definition: unit_recall.cpp:60
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:46
Generic file dialog.
Definition: field-fwd.hpp:22
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:44
std::vector< std::string > filter_options_
Definition: unit_recall.hpp:52
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:53
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:64