16 #define GETTEXT_DOMAIN "wesnoth-lib"
31 #define WRN_WML LOG_STREAM(warn, log_wml)
46 if(result.
empty() && source.has_attribute(
"difficulties")) {
48 if(source.has_attribute(
"difficulty_descriptions")) {
59 , campaign_id_(campaign[
"id"])
60 , selected_difficulty_(
"CANCEL")
66 listbox& list = find_widget<listbox>(&
window,
"listbox",
false);
69 unsigned difficulty_count = 0;
75 item[
"label"] =
d[
"image"];
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();
98 if(
d[
"default"].to_bool(
false)) {
108 if(difficulty_count + 1 >= difficulty_max) {
110 }
else if(difficulty_count == 0) {
126 listbox& list = find_widget<listbox>(&
window,
"listbox",
false);
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(window &window) override
Actions to be taken after the window has been shown.
std::string selected_difficulty_
campaign_difficulty(const config &campaign)
virtual void pre_show(window &window) 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.
base class of top level items, the only item which needs to store the final canvases to draw on.
void keyboard_capture(widget *widget)
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 span_color(const color_t &color)
Returns a Pango formatting string using the provided color_t object.
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::pair< std::string, unsigned > item