The Battle for Wesnoth  1.15.1+dev
unit_recruit.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 
18 
19 class unit_type;
20 class team;
21 
22 namespace gui2
23 {
24 namespace dialogs
25 {
26 
27 class unit_recruit : public modal_dialog
28 {
29 public:
30  unit_recruit(std::vector<const unit_type*>& recruit_list, team& team);
31 
32  int get_selected_index() const
33  {
34  return selected_index_;
35  }
36 
37 private:
38  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
39  virtual const std::string& window_id() const override;
40 
41  /** Inherited from modal_dialog. */
42  virtual void pre_show(window& window) override;
43  virtual void post_show(window& window) override;
44 
45  void list_item_clicked(window& window);
46  void filter_text_changed(text_box_base* textbox, const std::string& text);
47 
48  void show_help();
49 
50  std::vector<const unit_type*>& recruit_list_;
51 
52  team& team_;
53 
55 
56  std::vector<std::string> last_words_;
57 };
58 
59 } // namespace dialogs
60 } // namespace gui2
unit_recruit(std::vector< const unit_type *> &recruit_list, team &team)
Abstract base class for text items.
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
A single unit type that the player may recruit.
Definition: types.hpp:42
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
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Various uncategorised dialogs.
void list_item_clicked(window &window)
std::vector< const unit_type * > & recruit_list_
Abstract base class for all modal dialogs.
void filter_text_changed(text_box_base *textbox, const std::string &text)
std::vector< std::string > last_words_
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63