The Battle for Wesnoth  1.15.1+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  typedef std::vector<unit_const_ptr> recalls_ptr_vector;
38 
39 public:
40  unit_recall(recalls_ptr_vector& recall_list, team& team);
41 
42  int get_selected_index() const
43  {
44  return selected_index_;
45  }
46 
47 private:
48  recalls_ptr_vector& recall_list_;
49 
51 
53 
54  std::vector<std::string> filter_options_;
55  std::vector<std::string> last_words_;
56 
57  /** Callbacks */
59  void filter_text_changed(text_box_base* textbox, const std::string& text);
60  void rename_unit(window& window);
61  void dismiss_unit(window& window);
62  void show_help();
63 
64  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
65  virtual const std::string& window_id() const override;
66 
67  /** Inherited from modal_dialog. */
68  virtual void pre_show(window& window) override;
69 
70  /** Inherited from modal_dialog. */
71  virtual void post_show(window& window) override;
72 };
73 
74 } // namespace dialogs
75 } // namespace gui2
void list_item_clicked(window &window)
Callbacks.
Abstract base class for text items.
virtual void post_show(window &window) override
Inherited from modal_dialog.
std::vector< unit_const_ptr > recalls_ptr_vector
Definition: unit_recall.hpp:37
void filter_text_changed(text_box_base *textbox, const std::string &text)
Generic file dialog.
Definition: field-fwd.hpp:22
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:54
recalls_ptr_vector & recall_list_
Definition: unit_recall.hpp:48
Various uncategorised dialogs.
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
void rename_unit(window &window)
std::vector< std::string > last_words_
Definition: unit_recall.hpp:55
void dismiss_unit(window &window)
Abstract base class for all modal dialogs.
unit_recall(recalls_ptr_vector &recall_list, team &team)
Definition: unit_recall.cpp:60
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63