The Battle for Wesnoth  1.19.0-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(window& window) override;
62 
63  virtual void post_show(window& window) override;
64 };
65 
66 } // namespace dialogs
67 } // namespace gui2
Abstract base class for all modal dialogs.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
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:57
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.
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
std::vector< unit_const_ptr > & recall_list_
Definition: unit_recall.hpp:43
std::vector< std::string > last_words_
Definition: unit_recall.hpp:50
base class of top level items, the only item which needs to store the final canvases to draw on.
Definition: window.hpp:63
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:74
Various uncategorised dialogs.
Generic file dialog.