15 #define GETTEXT_DOMAIN "wesnoth-lib"
25 #ifdef GUI2_EXPERIMENTAL_LISTBOX
89 = find_widget<ttree_view>(&window,
"campaign_tree",
false);
101 = find_widget<tmulti_page>(&window,
"campaign_details",
false);
103 engine_.set_current_level(choice);
106 const int selected_row
107 = find_widget<tlistbox>(&window,
"campaign_list",
false)
111 = find_widget<tmulti_page>(&window,
"campaign_details",
false);
114 engine_.set_current_level(selected_row);
120 settings_dlg.
show(video);
128 = find_widget<ttree_view>(&window,
"campaign_tree",
false);
135 window.keyboard_capture(&tree);
138 std::map<std::string, string_map> tree_group_item;
141 = find_widget<tmulti_page>(&window,
"campaign_details",
false);
149 tree_group_field[
"label"] = campaign[
"icon"];
150 tree_group_item[
"icon"] = tree_group_field;
152 tree_group_field[
"label"] = campaign[
"name"];
153 tree_group_item[
"name"] = tree_group_field;
155 tree_group_field[
"label"] = campaign[
"completed"].to_bool() ?
"misc/laurel.png" :
"misc/blank-hex.png";
156 tree_group_item[
"victory"] = tree_group_field;
158 tree.
add_node(
"campaign", tree_group_item).
set_id(std::to_string(
id++));
162 std::map<std::string, string_map> detail_page;
164 detail_item[
"label"] = campaign[
"description"];
165 detail_item[
"use_markup"] =
"true";
167 if(!campaign[
"description_alignment"].empty()) {
168 detail_item[
"text_alignment"] = campaign[
"description_alignment"];
171 detail_page.insert(std::make_pair(
"description", detail_item));
173 detail_item[
"label"] = campaign[
"image"];
174 detail_page.insert(std::make_pair(
"image", detail_item));
180 tree_group_field[
"label"] =
"Modifications";
181 tree_group_item[
"tree_view_node_label"] = tree_group_field;
187 tree_group_item.clear();
190 bool active =
std::find(enabled.begin(), enabled.end(), mod->id) != enabled.end();
192 tree_group_field[
"label"] = mod->name;
193 tree_group_item[
"checkb"] = tree_group_field;
207 = find_widget<ttree_view>(&window,
"campaign_tree",
false,
false)) {
213 tlistbox& list = find_widget<tlistbox>(&window,
"campaign_list",
false);
214 #ifdef GUI2_EXPERIMENTAL_LISTBOX
225 window.keyboard_capture(&list);
229 = find_widget<tmulti_page>(&window,
"campaign_details",
false);
237 std::map<std::string, string_map> list_item_item;
239 list_item[
"label"] = campaign[
"icon"];
240 list_item_item.insert(std::make_pair(
"icon", list_item));
242 list_item[
"label"] = campaign[
"name"];
243 list_item_item.insert(std::make_pair(
"name", list_item));
251 if(widget && !campaign[
"completed"].to_bool()) {
257 std::map<std::string, string_map> detail_page;
259 detail_item[
"label"] = campaign[
"description"];
260 detail_item[
"use_markup"] =
"true";
261 detail_page.insert(std::make_pair(
"description", detail_item));
263 detail_item[
"label"] = campaign[
"image"];
264 detail_page.insert(std::make_pair(
"image", detail_item));
272 tbutton* advanced_settings_button =
273 find_widget<tbutton>(&window,
"advanced_settings",
false,
false);
274 if(advanced_settings_button) {
284 = find_widget<ttree_view>(&window,
"campaign_tree",
false);
295 "checkbox_deterministic",
296 false).get_value_bool();
300 choice_ = find_widget<tlistbox>(&window,
"campaign_list",
false)
303 "checkbox_deterministic",
304 false).get_value_bool();
void set_current_mod_index(const size_t index)
bool new_widgets
Do we wish to use the new library or not.
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
GLenum GLsizei const GLuint GLboolean enabled
const std::vector< extras_metadata_ptr > & get_const_extras_by_type(const MP_EXTRA extra_type) const
bool show(CVideo &video, const unsigned auto_close_time=0)
Shows the window.
void connect_signal_notify_modified(tdispatcher &dispatcher, const tsignal_notification_function &signal)
Connects a signal handler for getting a notification upon modification.
REGISTER_DIALOG(label_settings)
std::vector< level_ptr > get_levels_by_type_unfiltered(level::TYPE type) const
ttree_view_node * selected_item()
virtual void set_label(const t_string &label)
To lexical_cast(From value)
Lexical cast converts one type to another.
ttree_view_node & add_child(const std::string &id, const std::map< std::string, string_map > &data, const int index=-1)
Adds a child item to the list of child nodes.
int choice_
The chosen campaign.
bool toggle_current_mod(bool force=false)
base class of top level items, the only item which needs to store the final canvases to draw on ...
ttree_view_node & add_node(const std::string &id, const std::map< std::string, string_map > &data)
A class inherited from ttext_box that displays its input as stars.
bool deterministic_
whether the player checked the "Deterministic" checkbox.
void set_selection_change_callback(std::function< void(twidget &)> callback)
void pre_show(twindow &window)
Inherited from tdialog.
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
unsigned get_item_count() const
Returns the number of items in the listbox.
void add_row(const string_map &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
void add_page(const string_map &item)
Adds single page to the grid.
static size_t id
Ids for the timers.
void post_show(twindow &window)
Inherited from tdialog.
std::vector< std::string > & active_mods()
void mod_toggled(int id, twidget &)
std::map< std::string, t_string > string_map
void show_settings(CVideo &video)
void select_page(const unsigned page, const bool select=true)
Selectes a page.
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
ng::create_engine & engine_
bool find(E event, F functor)
Tests whether an event handler is available.
void set_modifications(const std::vector< std::string > &value, bool mp)
void set_callback_value_change(const std::function< void(twidget &)> &callback)
twidget * find(const std::string &id, const bool must_be_active) override
See twidget::find.
A config object defines a single node in a WML file, with access to child nodes.
void campaign_selected(twindow &window)
Called when another campaign is selected.
void dialog_callback(twidget &caller)
Template for dialog callbacks.
t_string missing_widget(const std::string &id)
Returns a default error message if a mandatory widget is omitted.
const tgrid * get_row_grid(const unsigned row) const
Returns the grid of the wanted row.