16 #define GETTEXT_DOMAIN "wesnoth-lib" 33 #define WRN_WML LOG_STREAM(warn, log_wml) 48 if(result.
empty() && source.has_attribute(
"difficulties")) {
50 if(source.has_attribute(
"difficulty_descriptions")) {
61 , campaign_id_(campaign[
"id"])
62 , selected_difficulty_(
"CANCEL")
68 listbox& list = find_widget<listbox>(&
window,
"listbox",
false);
69 window.keyboard_capture(&list);
75 item[
"label"] =
d[
"image"];
76 data.emplace(
"icon", item);
78 item[
"use_markup"] =
"true";
80 std::ostringstream ss;
83 if(!d[
"description"].empty()) {
84 if (d[
"auto_markup"].to_bool(
true) ==
false) {
85 ss <<
"\n" << d[
"description"].str();
86 }
else if (!d[
"old_markup"].to_bool()) {
93 item[
"label"] = ss.str();
94 data.emplace(
"label", item);
98 if(d[
"default"].to_bool(
false)) {
112 listbox& list = find_widget<listbox>(&
window,
"listbox",
false);
window(const builder_window::window_resolution &definition)
< Needs to be initialized in show.
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
config & child(config_key_type key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
Interfaces for manipulating version numbers of engine, add-ons, etc.
bool is_campaign_completed(const std::string &campaign_id)
child_itors child_range(config_key_type key)
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.
bool select_last_row(const bool select=true)
Does exactly as advertised: selects the list's last row.
int get_selected_row() const
Returns the first selected row.
void append_children(const config &cfg)
Adds children from cfg.
Definitions for the interface to Wesnoth Markup Language (WML).
std::string span_color(const color_t &color)
Returns a Pango formatting string using the provided color_t object.
std::map< std::string, t_string > widget_item
std::string deprecated_message(const std::string &elem_name, DEP_LEVEL level, const version_info &version, const std::string &detail)
widget * find(const std::string &id, const bool must_be_active) override
See widget::find.
std::string selected_difficulty_
config generate_difficulty_config(const config &source)
Helper function to convert old difficulty markup.
static lg::log_domain log_wml("wml")
int get_retval() const
Returns the cached window exit code.
Abstract base class for all modal dialogs.
Standard logging facilities (interface).
std::map< std::string, widget_item > widget_data
Dialog was closed with the OK button.
A config object defines a single node in a WML file, with access to child nodes.
base class of top level items, the only item which needs to store the final canvases to draw on...
campaign_difficulty(const config &campaign)
virtual void pre_show(window &window) override
Actions to be taken before showing the window.
virtual void post_show(window &window) override
Actions to be taken after the window has been shown.
std::pair< std::string, unsigned > item