16 #define GETTEXT_DOMAIN "wesnoth-lib"
31 const unsigned maximum_length)
44 assert(!option_list.empty());
45 assert(chosen_option);
63 label& title = find_widget<label>(&
window,
"title",
false);
76 label& caption = find_widget<label>(&
window,
"input_caption",
false);
93 listbox& options = find_widget<listbox>(&
window,
"input_list",
true);
99 data[
"icon"][
"label"] =
item.image();
100 data[
"label"][
"label"] =
item.label();
101 data[
"label"][
"use_markup"] =
"true";
102 data[
"description"][
"label"] =
item.description();
103 data[
"description"][
"use_markup"] =
"true";
132 = find_widget<text_box>(&
window,
"input",
true).get_value();
161 std::shared_ptr<wml_message_base> dlg;
164 }
else if(!left && right) {
166 }
else if(right && left) {
171 if(input.text_input_was_specified) {
172 dlg->set_input(input.caption, &input.text, input.maximum_length);
175 if(!options.option_list.empty()) {
176 dlg->set_option_list(options.option_list, &options.chosen_option);
180 return dlg->get_retval();
void set_variable(const std::string &key, wfl::variant &&value)
Main class to show messages to the user.
std::string * input_text_
The text input.
std::string portrait_
Filename of the portrait.
std::string message_
The message to show to the user.
void set_input(const std::string &caption, std::string *text, const unsigned maximum_length)
Sets the input text variables.
bool has_input_
Do we need to show an input box?
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
unsigned input_maximum_length_
The maximum length of the input text.
bool mirror_
Mirror the portrait?
int * chosen_option_
The chosen option.
std::string input_caption_
The caption to show for the input text.
void set_option_list(const std::vector< wml_message_option > &option_list, int *chosen_option)
Sets the option list.
std::string title_
The title for the dialog.
std::vector< wml_message_option > option_list_
The list of options the user can choose.
virtual void pre_show(window &window) override
Shows a dialog with two portraits, one on each side.
std::string second_portrait_
virtual void pre_show(window &window) override
Shows a dialog with the portrait on the left side.
Helper class for message options.
Shows a dialog with the portrait on the right side.
void set_can_wrap(const bool wrap)
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.
bool select_row(const unsigned row, const bool select=true)
Selects a row.
virtual void set_value(const std::string &text)
The set_value is virtual for the password_box class.
void set_maximum_length(const std::size_t maximum_length)
A widget that allows the user to input text in single line.
base class of top level items, the only item which needs to store the final canvases to draw on.
void keyboard_capture(widget *widget)
void add_to_keyboard_chain(widget *widget)
Adds the widget to the keyboard chain.
void set_escape_disabled(const bool escape_disabled)
Disable the escape key.
void set_click_dismiss(const bool click_dismiss)
int show_wml_message(const std::string &title, const std::string &message, const wml_message_portrait *left, const wml_message_portrait *right, const wml_message_options &options, const wml_message_input &input)
Helper function to show a portrait.
REGISTER_DIALOG(editor_edit_unit)
std::map< std::string, widget_item > widget_data
std::pair< std::string, unsigned > item
Parameter pack for message list input options.
Parameter pack for message portrait.