15 #define GETTEXT_DOMAIN "wesnoth-lib"
39 , report_text_(report_text)
40 , reportee_empty_(true)
41 , report_reason_empty_(true)
47 std::vector<config> occurrence_location_entries;
48 occurrence_location_entries.emplace_back(
"label",
_(
"Lobby"));
49 occurrence_location_entries.emplace_back(
"label",
_(
"Whisper"));
50 occurrence_location_entries.emplace_back(
"label",
_(
"Game"));
52 find_widget<menu_button>(&win,
"occurrence_location",
false).set_values(occurrence_location_entries);
54 button& ok = find_widget<button>(&win,
"ok",
false);
57 text_box& reportee = find_widget<text_box>(&win,
"reportee",
false);
60 text_box& report_reason = find_widget<text_box>(&win,
"report_reason",
false);
70 const text_box& reportee = find_widget<const text_box>(&
window,
"reportee",
false);
71 const text_box& report_reason = find_widget<const text_box>(&
window,
"report_reason",
false);
72 const menu_button& occurrence_location = find_widget<const menu_button>(&
window,
"occurrence_location",
false);
73 const std::string additional_information = find_widget<const text_box>(&
window,
"additional_information",
false).get_value();
75 std::ostringstream report;
76 report <<
"Reporting player '" << reportee.
get_value() <<
"' for reason '" << report_reason.
get_value() <<
"'."
78 if(additional_information.size() > 0)
80 report <<
" Additional information provided: '" << additional_information <<
"'.";
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
window * get_window()
Returns a pointer to the dialog's window.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
mp_report(std::string &report_text_)
static const std::array< std::string, 3 > occurrence_locations
void report_reason_changed(const std::string &text)
std::string & report_text_
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
bool report_reason_empty_
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.
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 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)
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
@ OK
Dialog was closed with the OK button.