The Battle for Wesnoth  1.19.7+dev
unit_recall.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2016 - 2024
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 "units/ptr.hpp"
19 
20 #include <string>
21 #include <vector>
22 
23 class team;
24 
25 namespace gui2
26 {
27 
28 
29 namespace dialogs
30 {
31 
32 class unit_recall : public modal_dialog
33 {
34 public:
35  unit_recall(std::vector<unit_const_ptr>& recall_list, team& team);
36 
37  int get_selected_index() const
38  {
39  return selected_index_;
40  }
41 
42 private:
43  std::vector<unit_const_ptr>& recall_list_;
44 
46 
48 
49  std::vector<std::string> filter_options_;
50  std::vector<std::string> last_words_;
51 
52  /** Callbacks */
53  void list_item_clicked();
54  void filter_text_changed(const std::string& text);
55  void rename_unit();
56  void dismiss_unit();
57  void show_help();
58 
59  virtual const std::string& window_id() const override;
60 
61  virtual void pre_show() override;
62 
63  virtual void post_show() override;
64 };
65 
66 } // namespace dialogs
67 } // namespace gui2
Abstract base class for all modal dialogs.
std::vector< std::string > filter_options_
Definition: unit_recall.hpp:49
unit_recall(std::vector< unit_const_ptr > &recall_list, team &team)
Definition: unit_recall.cpp:56
virtual void pre_show() override
Actions to be taken before showing the window.
void list_item_clicked()
Callbacks.
void filter_text_changed(const std::string &text)
virtual const std::string & window_id() const override
The ID of the window to build.
std::vector< unit_const_ptr > & recall_list_
Definition: unit_recall.hpp:43
virtual void post_show() override
Actions to be taken after the window has been shown.
std::vector< std::string > last_words_
Definition: unit_recall.hpp:50
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:75
Various uncategorised dialogs.
Generic file dialog.