16 #define GETTEXT_DOMAIN "wesnoth-lib"
32 , width_(builder.width_)
33 , height_(builder.height_)
42 if(content_size.x >
size.x) {
47 if(content_size.y >
size.y) {
56 if(content_size.x >
size.x) {
88 VALIDATE(width > 0 || height > 0,
_(
"Invalid size."));
90 return point(width, height);
98 load_resolutions<resolution>(cfg);
112 grid = std::make_shared<builder_grid>(*child);
117 builder_size_lock::builder_size_lock(
const config& cfg)
119 , width_(cfg[
"width"])
120 , height_(cfg[
"height"])
129 auto widget = std::make_unique<size_lock>(*
this);
131 DBG_GUI_G <<
"Window builder: placed fixed size widget '" <<
id <<
"' with definition '" <<
definition <<
"'.";
134 assert(conf !=
nullptr);
136 widget->init_grid(*conf->grid);
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.
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
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.
void reduce_height(const unsigned maximum_height)
Tries to reduce the height of a container.
void set_rows_cols(const unsigned rows, const unsigned cols)
void reduce_width(const unsigned maximum_width)
Tries to reduce the width of a container.
virtual void place(const point &origin, const point &size) override
See widget::place.
void set_child(std::unique_ptr< widget > widget, const unsigned row, const unsigned col, const unsigned flags, const unsigned border_size)
static const unsigned HORIZONTAL_GROW_SEND_TO_CLIENT
static const unsigned VERTICAL_GROW_SEND_TO_CLIENT
typed_formula< unsigned > width_
void place(const point &origin, const point &size) override
See widget::place.
typed_formula< unsigned > height_
void finalize(const builder_widget &widget_builder)
Finishes the building initialization of the widget.
void layout_children() override
See widget::layout_children.
widget * widget_
Points to the actual widget.
point calculate_best_size() const override
See widget::calculate_best_size.
static std::string _(const char *str)
Defines the exception classes for the layout algorithm.
void point(int x, int y)
Draw a single point.
void get_screen_size_variables(wfl::map_formula_callable &variable)
Gets a formula object with the screen size.
builder_widget_ptr create_widget_builder(const config &cfg)
Create a widget builder.
Contains the implementation details for lexical_cast and shouldn't be used directly.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
virtual std::unique_ptr< widget > build() const override
builder_widget_const_ptr content_
Exception thrown when the width has been modified during resizing.
std::vector< state_definition > state
resolution(const config &cfg)
size_lock_definition(const config &cfg)
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.