15 #define GETTEXT_DOMAIN "wesnoth-lib"
22 #ifdef GUI2_EXPERIMENTAL_LISTBOX
36 const unsigned maximum_length)
49 assert(!option_list.empty());
50 assert(chosen_option);
70 tlabel& title = find_widget<tlabel>(&window,
"title",
false);
80 window.keyboard_capture(&message);
83 tlabel& caption = find_widget<tlabel>(&window,
"input_caption",
false);
91 window.keyboard_capture(&input);
92 window.set_click_dismiss(
false);
93 window.set_escape_disabled(
true);
100 tlistbox&
options = find_widget<tlistbox>(&window,
"input_list",
true);
103 std::map<std::string, string_map>
data;
106 data[
"icon"][
"label"] = item.image();
107 data[
"label"][
"label"] = item.label();
108 data[
"label"][
"use_markup"] =
"true";
109 data[
"description"][
"label"] = item.description();
110 data[
"description"][
"use_markup"] =
"true";
116 < option_list_.size()) {
122 window.keyboard_capture(&options);
123 window.set_click_dismiss(
false);
124 window.set_escape_disabled(
true);
126 window.add_to_keyboard_chain(&options);
139 = find_widget<ttext_box>(&window,
"input",
true).get_value();
143 *
chosen_option_ = find_widget<tlistbox>(&window,
"input_list",
true)
154 const
std::
string& title,
156 const
std::
string& portrait,
158 const
bool has_input,
159 const
std::
string& input_caption,
160 std::
string* input_text,
161 const
unsigned maximum_length,
174 dlg->set_input(input_caption, input_text, maximum_length);
177 if(!option_list.empty()) {
178 dlg->set_option_list(option_list, chosen_option);
182 return dlg->get_retval();
void post_show(twindow &window)
Inherited from tdialog.
void set_can_wrap(const bool wrap)
GLenum GLenum GLenum input
bool has_input_
Do we need to show an input box?
bool select_row(const unsigned row, const bool select=true)
Selectes a row.
REGISTER_DIALOG(label_settings)
virtual void set_label(const t_string &label)
Class for a single line text area.
std::string portrait_
Filename of the portrait.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
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.
int * chosen_option_
The chosen option.
virtual void set_use_markup(bool use_markup)
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.
void set_restore(const bool restore)
std::vector< twml_message_option > option_list_
The list of options the user can choose.
Helper class for message options.
void set_input(const std::string &caption, std::string *text, const unsigned maximum_length)
Sets the input text variables.
unsigned input_maximum_length_
The maximum length of the input text.
int show_wml_message(const bool left_side, CVideo &video, const std::string &title, const std::string &message, const std::string &portrait, const bool mirror, const bool has_input, const std::string &input_caption, std::string *input_text, const unsigned maximum_length, const std::vector< twml_message_option > &option_list, int *chosen_option)
Helper function to show a portrait.
Shows a dialog with the portrait on the left side.
Shows a dialog with the portrait on the right side.
std::vector< tcanvas > & canvas()
std::string * input_text_
The text input.
bool mirror_
Mirror the portrait?
std::string input_caption_
The caption to show for the input text.
Base class for all visible items.
std::string title_
The title for the dialog.
GLsizei GLenum GLuint GLuint GLsizei char * message
std::string message_
The message to show to the user.
void set_option_list(const std::vector< twml_message_option > &option_list, int *chosen_option)
Sets the option list.
void pre_show(twindow &window)
Inherited from tdialog.
GLsizei const GLcharARB ** string