16 #define GETTEXT_DOMAIN "wesnoth-lib"
63 load_resolutions<resolution>(cfg);
73 auto child =
VALIDATE_WML_CHILD(cfg,
"grid",
_(
"Missing required grid for scrollbar panel"));
74 grid = std::make_shared<builder_grid>(child);
82 builder_scrollbar_panel::builder_scrollbar_panel(
const config& cfg)
84 , vertical_scrollbar_mode(
86 , horizontal_scrollbar_mode(
92 VALIDATE(grid_definition,
_(
"No list defined."));
93 grid_ = std::make_shared<builder_grid>(*grid_definition);
99 auto panel = std::make_unique<scrollbar_panel>(*
this);
104 DBG_GUI_G <<
"Window builder: placed scrollbar_panel '" <<
id
105 <<
"' with definition '" <<
definition <<
"'.";
111 panel->finalize_setup();
114 grid* content_grid =
panel->content_grid();
115 assert(content_grid);
117 const unsigned rows =
grid_->rows;
118 const unsigned cols =
grid_->cols;
122 for(
unsigned x = 0; x < rows; ++x) {
124 for(
unsigned y = 0; y < cols; ++y) {
128 grid_->col_grow_factor[y]);
131 auto widget =
grid_->widgets[x * cols + y]->build();
135 grid_->flags[x * cols + y],
136 grid_->border_size[x * cols + y]);
A config object defines a single node in a WML file, with access to child nodes.
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Euivalent to mandatory_child, but returns an empty optional if the nth child was not found.
void init_grid(const builder_grid &grid_builder)
Initializes and builds the grid.
void set_row_grow_factor(const unsigned row, const unsigned factor)
Sets the grow factor for a row.
void set_column_grow_factor(const unsigned column, const unsigned factor)
Sets the grow factor for a column.
void set_rows_cols(const unsigned rows, const unsigned cols)
Wrapper to set_rows and set_cols.
void set_child(std::unique_ptr< widget > widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
Sets a child in the grid.
A panel is a visible container to hold multiple widgets.
static std::string _(const char *str)
scrollbar_mode get_scrollbar_mode(const std::string &scrollbar_mode)
Returns the scrollbar mode flags.
Contains the implementation details for lexical_cast and shouldn't be used directly.
This file contains the settings handling of the widget library.
Base class of a resolution, contains the common keys for a resolution.
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_WML_CHILD(cfg, key, message)
#define VALIDATE(cond, message)
The macro to use for the validation of WML.