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);
78 label& caption = find_widget<label>(&
window,
"input_caption",
false);
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";
134 = find_widget<text_box>(&
window,
"input",
true).get_value();
163 std::shared_ptr<wml_message_base> dlg;
166 }
else if(!left && right) {
168 }
else if(right && left) {
173 if(input.text_input_was_specified) {
174 dlg->set_input(input.caption, &input.text, input.maximum_length);
178 dlg->set_option_list(
options.option_list, &
options.chosen_option);
182 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.
A label displays a text, the text can be wrapped but no scrollbars are provided.
void set_can_wrap(const bool wrap)
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)
Class for a single line text area.
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)
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
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.
std::map< std::string, widget_item > widget_data
std::pair< std::string, unsigned > item
This file contains the settings handling of the widget library.
Parameter pack for message list input options.
Parameter pack for message portrait.