14 #define GETTEXT_DOMAIN "wesnoth-lib"
22 #ifdef GUI2_EXPERIMENTAL_LISTBOX
47 : recruit_list_(recruit_list)
55 return can_afford ? text :
"<span color='#ff0000'>" + text +
"</span>";
60 tlistbox& list = find_widget<tlistbox>(&window,
"recruit_list",
false);
62 #ifdef GUI2_EXPERIMENTAL_LISTBOX
69 dialog_callback<tunit_recruit, &tunit_recruit::list_item_clicked>);
73 find_widget<tbutton>(&window,
"show_help",
false),
78 std::map<std::string, string_map> row_data;
81 std::string image_string = recruit->image() +
"~RC(" + recruit->flag_rgb() +
">"
88 wb_gold = whiteb->get_spent_gold_for(
team_.
side());
92 const bool can_afford = recruit->cost() <=
team_.
gold() - wb_gold;
94 const std::string cost_string = std::to_string(recruit->cost());
96 column[
"label"] = image_string;
97 row_data.insert(std::make_pair(
"unit_image", column));
100 column[
"use_markup"] =
"true";
101 row_data.insert(std::make_pair(
"unit_type", column));
104 column[
"use_markup"] =
"true";
105 row_data.insert(std::make_pair(
"unit_cost", column));
115 const int selected_row
116 = find_widget<tlistbox>(&window,
"recruit_list",
false).get_selected_row();
118 if(selected_row == -1) {
122 find_widget<tunit_preview_pane>(&window,
"recruit_details",
false)
134 selected_index_ = find_widget<tlistbox>(&window,
"recruit_list",
false)
play_controller * controller
void show_help(CVideo &video, const std::string &show_topic, int xloc, int yloc)
Open the help browser, show topic with id show_topic.
void post_show(twindow &window)
Actions to be taken after the window has been shown.
std::vector< const unit_type * > & recruit_list_
void connect_signal_notify_modified(tdispatcher &dispatcher, const tsignal_notification_function &signal)
Connects a signal handler for getting a notification upon modification.
REGISTER_DIALOG(label_settings)
void connect_signal_mouse_left_click(tdispatcher &dispatcher, const tsignal_function &signal)
Connects a signal handler for a left mouse button click.
base class of top level items, the only item which needs to store the final canvases to draw on ...
A class inherited from ttext_box that displays its input as stars.
This class stores all the data for a single 'side' (in game nomenclature).
static std::string can_afford_unit(const std::string &text, const bool can_afford)
Dialog is closed with ok button.
void add_row(const string_map &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
Applies the planned unit map for the duration of the struct's life.
void pre_show(twindow &window)
Inherited from tdialog.
std::map< std::string, t_string > string_map
GLenum GLenum GLvoid GLvoid * column
void show_help(twindow &window)
void set_callback_value_change(const std::function< void(twidget &)> &callback)
static std::string get_side_color_index(int side)
void list_item_clicked(twindow &window)
GLsizei const GLcharARB ** string