16 #define GETTEXT_DOMAIN "wesnoth-lib"
30 #define WRN_WML LOG_STREAM(warn, log_wml)
45 if(result.
empty() && source.has_attribute(
"difficulties")) {
47 if(source.has_attribute(
"difficulty_descriptions")) {
58 , campaign_id_(campaign[
"id"])
59 , selected_difficulty_(
"CANCEL")
65 listbox& list = find_widget<listbox>(
"listbox");
68 unsigned difficulty_count = 0;
74 item[
"label"] =
d[
"image"];
75 data.emplace(
"icon", item);
77 item[
"use_markup"] =
"true";
79 std::ostringstream ss;
82 if(!
d[
"description"].empty()) {
83 if (
d[
"auto_markup"].to_bool(
true) ==
false) {
84 ss <<
"\n" <<
d[
"description"].str();
85 }
else if (!
d[
"old_markup"].to_bool()) {
92 item[
"label"] = ss.str();
93 data.emplace(
"label", item);
97 if(
d[
"default"].to_bool(
false)) {
107 if(difficulty_count + 1 >= difficulty_max) {
109 }
else if(difficulty_count == 0) {
125 listbox& list = find_widget<listbox>(
"listbox");
static lg::log_domain log_wml("wml")
A config object defines a single node in a WML file, with access to child nodes.
config & mandatory_child(config_key_type key, int n=0)
Returns the nth child with the given key, or throws an error if there is none.
std::size_t child_count(config_key_type key) const
child_itors child_range(config_key_type key)
void append_children(const config &cfg)
Adds children from cfg.
virtual void post_show() override
Actions to be taken after the window has been shown.
std::string selected_difficulty_
campaign_difficulty(const config &campaign)
virtual void pre_show() override
Actions to be taken before showing the window.
Abstract base class for all modal dialogs.
int get_retval() const
Returns the cached window exit code.
bool select_last_row(const bool select=true)
Does exactly as advertised: selects the list's last row.
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.
int get_selected_row() const
Returns the first selected row.
void keyboard_capture(widget *widget)
bool is_campaign_completed(const std::string &campaign_id)
Definitions for the interface to Wesnoth Markup Language (WML).
std::string deprecated_message(const std::string &elem_name, DEP_LEVEL level, const version_info &version, const std::string &detail)
Interfaces for manipulating version numbers of engine, add-ons, etc.
Standard logging facilities (interface).
std::string victory_laurel_hardest
std::string victory_laurel
std::string victory_laurel_easy
config generate_difficulty_config(const config &source)
Helper function to convert old difficulty markup.
REGISTER_DIALOG(editor_edit_unit)
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
@ OK
Dialog was closed with the OK button.
std::string tag(const std::string &tag_name, Args &&... contents)
std::string span_color(const color_t &color, Args &&... data)