16 #define GETTEXT_DOMAIN "wesnoth-lib" 33 const unsigned maximum_length)
46 assert(!option_list.empty());
47 assert(chosen_option);
65 label& title = find_widget<label>(&
window,
"title",
false);
75 window.keyboard_capture(&message);
78 label& caption = find_widget<label>(&
window,
"input_caption",
false);
86 window.keyboard_capture(&input);
87 window.set_click_dismiss(
false);
88 window.set_escape_disabled(
true);
101 data[
"icon"][
"label"] =
item.image();
102 data[
"label"][
"label"] =
item.label();
103 data[
"label"][
"use_markup"] =
"true";
104 data[
"description"][
"label"] =
item.description();
105 data[
"description"][
"use_markup"] =
"true";
111 < option_list_.size()) {
117 window.keyboard_capture(&options);
118 window.set_click_dismiss(
false);
119 window.set_escape_disabled(
true);
121 window.add_to_keyboard_chain(&options);
134 = find_widget<text_box>(&
window,
"input",
true).get_value();
163 std::shared_ptr<wml_message_base> dlg;
165 dlg.reset(
new wml_message_left(title, message, left->portrait, left->mirror));
166 }
else if(!left && right) {
167 dlg.reset(
new wml_message_right(title, message, right->portrait, right->mirror));
168 }
else if(right && left) {
169 dlg.reset(
new wml_message_double(title, message, left->portrait, left->mirror, right->portrait, right->mirror));
173 if(input.text_input_was_specified) {
174 dlg->set_input(input.caption, &input.text, input.maximum_length);
177 if(!options.option_list.empty()) {
178 dlg->set_option_list(options.option_list, &options.chosen_option);
182 return dlg->get_retval();
window(const builder_window::window_resolution &definition)
< Needs to be initialized in show.
Parameter pack for message portrait.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
std::string portrait_
Filename of the portrait.
void set_can_wrap(const bool wrap)
std::string title_
The title for the dialog.
void set_variable(const std::string &key, wfl::variant &&value)
std::vector< wml_message_option > option_list_
The list of options the user can choose.
Main class to show messages to the user.
std::string input_caption_
The caption to show for the input text.
Parameter pack for message list input options.
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 label displays a text, the text can be wrapped but no scrollbars are provided.
bool select_row(const unsigned row, const bool select=true)
Selects a row.
Class for a single line text area.
Shows a dialog with the portrait on the left side.
unsigned input_maximum_length_
The maximum length of the input text.
This file contains the settings handling of the widget library.
void set_option_list(const std::vector< wml_message_option > &option_list, int *chosen_option)
Sets the option list.
void set_input(const std::string &caption, std::string *text, const unsigned maximum_length)
Sets the input text variables.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
bool has_input_
Do we need to show an input box?
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.
bool mirror_
Mirror the portrait?
virtual void pre_show(window &window) override
Helper class for message options.
virtual void pre_show(window &window) override
std::string message_
The message to show to the user.
Shows a dialog with two portraits, one on each side.
std::string * input_text_
The text input.
int * chosen_option_
The chosen option.
std::map< std::string, widget_item > widget_data
Shows a dialog with the portrait on the right side.
base class of top level items, the only item which needs to store the final canvases to draw on...
std::pair< std::string, unsigned > item