16 #define GETTEXT_DOMAIN "wesnoth-lib"
30 #define ERR_WML LOG_STREAM(err, log_wml)
43 const std::string_view
id,
44 const bool must_be_active)
47 if(!stack.find_in_all_layers_) {
48 return stack.container_base::find(
id, must_be_active);
51 for(
unsigned i = 0;
i < stack.get_layer_count(); ++
i) {
52 if(W* res = stack.get_layer_grid(
i)->find(
id, must_be_active)) {
57 return stack.container_base::find(
id, must_be_active);
65 , find_in_all_layers_(false)
67 const auto conf = cast_config_to<stacked_widget_definition>();
79 for(
const auto& layer_builder : builder.
stack) {
117 for(
unsigned int i = 0;
i < num_layers; ++
i) {
118 const bool selected = display_condition(
i);
140 for(
unsigned int i = 0;
i < num_layers; ++
i) {
203 return stacked_widget_implementation::find<widget>(*
this,
id, must_be_active);
208 return stacked_widget_implementation::find<const widget>(*
this,
id, must_be_active);
218 load_resolutions<resolution>(cfg);
231 grid = std::make_shared<builder_grid>(*child);
239 builder_stacked_widget::builder_stacked_widget(
const config& cfg)
245 stack.emplace_back(layer);
251 auto widget = std::make_unique<stacked_widget>(*
this);
252 DBG_GUI_G <<
"Window builder: placed stacked widget '" <<
id <<
"' with definition '" <<
definition <<
"'.";
A config object defines a single node in a WML file, with access to child nodes.
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
child_itors child_range(config_key_type key)
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Equivalent to mandatory_child, but returns an empty optional if the nth child was not found.
A generic container base class.
const grid & get_grid() const
void init_grid(const builder_grid &grid_builder)
Initializes and builds the grid.
virtual void select_item(const unsigned index, const bool select)=0
(De)selects an item.
virtual grid & item(const unsigned index)=0
Gets the grid of an item.
virtual unsigned get_item_count() const =0
Returns the number of items.
static std::unique_ptr< generator_base > build(const bool has_minimum, const bool has_maximum, const placement placement, const bool select)
Create a new generator.
virtual bool is_selected(const unsigned index) const =0
Returns whether the item is selected.
Basic template class to generate new items.
grid & create_item(const int index, const builder_grid &list_builder, const widget_item &item_data, const std::function< void(widget &)> &callback) override
Inherited from generator_base.
virtual void layout_children() override
See widget::layout_children.
static std::string _(const char *str)
std::map< std::string, t_string > widget_item
void swap_grid(grid *g, grid *content_grid, std::unique_ptr< widget > widget, const std::string &id)
Swaps an item in a grid for another one.
Contains the implementation details for lexical_cast and shouldn't be used directly.
typename const_clone< D, S >::reference const_clone_ref
std::vector< state_definition > state
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
#define VALIDATE(cond, message)
The macro to use for the validation of WML.