15 #define GETTEXT_DOMAIN "wesnoth-lib" 
   41     , recruit_map_(recruit_map)
 
   45     for(
const auto& pair : recruit_map) {
 
   46         recruit_list_.push_back(pair.first);
 
   49     std::sort(recruit_list_.begin(), recruit_list_.end(), [](
const unit_type* t1, 
const unit_type* t2) {
 
   50         return t1->type_name().str() < t2->type_name().str();
 
   65     find_widget<listbox>(
"recruit_list")
 
   68             if(!
type) 
return true;
 
   71             const auto race = 
type->race();
 
   78                 std::to_string(
type->level()),
 
   80                 (race ? race->name(default_gender) : 
""),
 
   81                 (race ? race->plural_name() : 
"")
 
   88     text_box* 
filter = find_widget<text_box>(
"filter_box", 
false, 
true);
 
   91     listbox& list = find_widget<listbox>(
"recruit_list");
 
   99         find_widget<button>(
"show_help"),
 
  108         std::string image_string = recruit->image() + 
"~RC(" + recruit->flag_rgb() + 
">" 
  111         const bool is_recruitable = error.
empty();
 
  113         const std::string cost_string = std::to_string(recruit->cost());
 
  115         column[
"use_markup"] = 
"true";
 
  118             column[
"tooltip"] = error;
 
  121         column[
"label"] = image_string + (is_recruitable ? 
"" : 
"~GS()");
 
  122         row_data.emplace(
"unit_image", column);
 
  125         row_data.emplace(
"unit_type", column);
 
  128         row_data.emplace(
"unit_cost", column);
 
  131         if(!is_recruitable) {
 
  143     const int selected_row
 
  144         = find_widget<listbox>(
"recruit_list").get_selected_row();
 
  146     if(selected_row == -1) {
 
  150     find_widget<unit_preview_pane>(
"recruit_details")
 
Abstract base class for all modal dialogs.
 
int get_retval() const
Returns the cached window exit code.
 
virtual void pre_show() override
Actions to be taken before showing the window.
 
virtual void post_show() override
Actions to be taken after the window has been shown.
 
std::map< const unit_type *, t_string > & recruit_map_
 
void filter_text_changed(const std::string &text)
 
std::vector< const unit_type * > recruit_list_
A vector of unit types in the order listed in the UI.
 
widget * find(const std::string_view id, const bool must_be_active) override
See widget::find.
 
t_string get_image() const
Wrapper for label.
 
void set_image(const t_string &label)
Wrapper for set_label.
 
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
 
A widget that allows the user to input text in single line.
 
void keyboard_capture(widget *widget)
 
void add_to_keyboard_chain(widget *widget)
Adds the widget to the keyboard chain.
 
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
 
This class stores all the data for a single 'side' (in game nomenclature).
 
const std::string & color() const
 
A single unit type that the player may recruit.
 
static std::string alignment_description(unit_alignments::type align, unit_race::GENDER gender=unit_race::MALE)
Implementation detail of unit_type::alignment_description.
 
static std::string gray_if_unrecruitable(const std::string &text, const bool is_recruitable)
 
static const color_t inactive_row_color(0x96, 0x96, 0x96)
 
REGISTER_DIALOG(editor_edit_unit)
 
void connect_signal_notify_modified(dispatcher &dispatcher, const signal_notification &signal)
Connects a signal handler for getting a notification upon modification.
 
void connect_signal_mouse_left_click(dispatcher &dispatcher, const signal &signal)
Connects a signal handler for a left mouse button click.
 
std::map< std::string, widget_item > widget_data
 
std::map< std::string, t_string > widget_item
 
@ OK
Dialog was closed with the OK button.
 
void show_help(const std::string &show_topic)
Open the help browser, show topic with id show_topic.
 
Functions to load and save images from/to disk.
 
std::string span_color(const color_t &color, Args &&... data)
 
auto make_ci_matcher(std::string_view filter_text)
Returns a function which performs locale-aware case-insensitive search.
 
The basic class for representing 8-bit RGB or RGBA colour values.