15 #define GETTEXT_DOMAIN "wesnoth-lib"
37 , report_text_(report_text)
38 , reportee_empty_(true)
39 , report_reason_empty_(true)
45 std::vector<config> occurrence_location_entries;
46 occurrence_location_entries.emplace_back(
"label",
_(
"Lobby"));
47 occurrence_location_entries.emplace_back(
"label",
_(
"Whisper"));
48 occurrence_location_entries.emplace_back(
"label",
_(
"Game"));
50 find_widget<menu_button>(
"occurrence_location").set_values(occurrence_location_entries);
52 button& ok = find_widget<button>(
"ok");
55 text_box& reportee = find_widget<text_box>(
"reportee");
58 text_box& report_reason = find_widget<text_box>(
"report_reason");
68 const text_box& reportee = find_widget<const text_box>(
"reportee");
69 const text_box& report_reason = find_widget<const text_box>(
"report_reason");
70 const menu_button& occurrence_location = find_widget<const menu_button>(
"occurrence_location");
71 const std::string additional_information = find_widget<const text_box>(
"additional_information").get_value();
73 std::ostringstream report;
74 report <<
"Reporting player '" << reportee.
get_value() <<
"' for reason '" << report_reason.
get_value() <<
"'."
76 if(additional_information.size() > 0)
78 report <<
" Additional information provided: '" << additional_information <<
"'.";
88 button& ok = find_widget<button>(
"ok");
96 button& ok = find_widget<button>(
"ok");
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
mp_report(std::string &report_text_)
static const std::array< std::string, 3 > occurrence_locations
virtual void post_show() override
Actions to be taken after the window has been shown.
void report_reason_changed(const std::string &text)
std::string & report_text_
bool report_reason_empty_
virtual void pre_show() override
Actions to be taken before showing the window.
void reportee_changed(const std::string &text)
std::string get_value() const
void set_text_changed_callback(std::function< void(text_box_base *textbox, const std::string text)> cb)
Set the text_changed callback.
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 set_exit_hook(exit_hook mode, std::function< bool(window &)> func)
Sets the window's exit hook.
@ on_ok
Run hook only if result is OK.
static std::string _(const char *str)
REGISTER_DIALOG(editor_edit_unit)
@ OK
Dialog was closed with the OK button.