16 #define GETTEXT_DOMAIN "wesnoth-lib"
26 #define LOG_SCOPE_HEADER \
27 "tcontainer(" + get_control_type() + ") [" + id() + "] " + __func__
28 #define LOG_HEADER LOG_SCOPE_HEADER + ':'
38 connect_signal<event::REQUEST_PLACEMENT>(
62 if(
static_cast<int>(maximum_width) -
border_space().x < grid_size.x) {
68 size.x = maximum_width;
78 if(
static_cast<int>(maximum_width) -
border_space().x < grid_size.x) {
84 size.x = maximum_width;
99 if(
static_cast<int>(maximum_height) -
border_space().y < grid_size.y) {
104 size.y = maximum_height;
114 if(
static_cast<int>(maximum_height) -
border_space().y < grid_size.y) {
119 size.y = maximum_height;
161 result.x += border_size.x;
163 if(default_size.x != 0 && result.x < default_size.x) {
164 result.x = default_size.x;
168 result.y += border_size.y;
170 if(default_size.y != 0 && result.y < default_size.y) {
171 result.y = default_size.y;
213 const bool must_be_active)
219 const bool must_be_active)
const
227 return result ? result :
grid_.
find(
id, must_be_active);
231 const bool must_be_active)
const
234 return result ? result :
grid_.
find(
id, must_be_active);
259 return std::make_unique<gui2::iteration::container>(*
this);
bool disable_click_dismiss() const override
See widget::disable_click_dismiss.
void reduce_height(const unsigned maximum_height)
Tries to reduce the height of a container.
virtual iteration::walker_ptr create_walker() override
See widget::create_walker.
container_base(const implementation::builder_styled_widget &builder, const std::string &control_type)
virtual void set_self_active(const bool active)=0
Helper for set_active.
virtual void request_reduce_width(const unsigned maximum_width) override
See widget::request_reduce_width.
virtual void request_reduce_height(const unsigned maximum_height) override
See widget::request_reduce_height.
virtual void layout_initialize(const bool full_initialization) override
See widget::layout_initialize.
virtual void set_active(const bool active) override
See styled_widget::set_active.
virtual bool can_wrap() const override
See widget::can_wrap.
virtual SDL_Rect get_client_rect() const
Returns the client rect.
virtual point calculate_best_size() const override
See widget::calculate_best_size.
virtual void demand_reduce_width(const unsigned maximum_width) override
See widget::demand_reduce_width.
virtual void layout_children() override
See widget::layout_children.
void reduce_width(const unsigned maximum_width)
Tries to reduce the width of a container.
widget * find(const std::string_view id, const bool must_be_active) override
See widget::find.
virtual widget * find_at(const point &coordinate, const bool must_be_active) override
See widget::find_at.
grid grid_
The grid which holds the child objects.
virtual void set_origin(const point &origin) override
See widget::set_origin.
virtual void place(const point &origin, const point &size) override
See widget::place.
virtual void set_visible_rectangle(const SDL_Rect &rectangle) override
See widget::set_visible_rectangle.
void inject_linked_groups()
virtual void demand_reduce_height(const unsigned maximum_height) override
See widget::demand_reduce_height.
void init_grid(const builder_grid &grid_builder)
Initializes and builds the grid.
virtual bool has_widget(const widget &widget) const override
See widget::has_widget.
virtual void impl_draw_children() override
See widget::impl_draw_children.
virtual point border_space() const
Returns the space used by the border.
void set_active(const bool active)
Activates all children.
virtual bool has_widget(const widget &widget) const override
See widget::has_widget.
bool disable_click_dismiss() const override
See widget::disable_click_dismiss.
virtual void place(const point &origin, const point &size) override
See widget::place.
void reduce_height(const unsigned maximum_height)
Tries to reduce the height of a container.
virtual void set_visible_rectangle(const SDL_Rect &rectangle) override
See widget::set_visible_rectangle.
void reduce_width(const unsigned maximum_width)
Tries to reduce the width of a container.
unsigned int get_rows() const
virtual widget * find_at(const point &coordinate, const bool must_be_active) override
See widget::find_at.
widget * find(const std::string_view id, const bool must_be_active) override
See widget::find.
unsigned int get_cols() const
virtual void set_origin(const point &origin) override
See widget::set_origin.
virtual void demand_reduce_height(const unsigned maximum_height) override
See widget::demand_reduce_height.
virtual bool can_wrap() const override
See widget::can_wrap.
virtual void layout_children() override
See widget::layout_children.
virtual void layout_initialize(const bool full_initialization) override
See widget::layout_initialize.
virtual void request_reduce_width(const unsigned maximum_width) override
See widget::request_reduce_width.
virtual void request_reduce_height(const unsigned maximum_height) override
See widget::request_reduce_height.
virtual void demand_reduce_width(const unsigned maximum_width) override
See widget::demand_reduce_width.
void init_linked_size_group(const std::string &id, const bool fixed_width, const bool fixed_height)
Initializes a linked size group.
Define the common log macros for the gui toolkit.
#define log_scope2(domain, description)
void point(int x, int y)
Draw a single point.
std::unique_ptr< class walker_base > walker_ptr
lg::log_domain log_gui_general("gui/general")
lg::log_domain log_gui_layout("gui/layout")
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
std::size_t size(std::string_view str)
Length in characters of a UTF-8 string.
virtual std::unique_ptr< widget > build() const override
Inherited from builder_widget.
An abstract description of a rectangle with integer coordinates.