16 #define GETTEXT_DOMAIN "wesnoth-lib"
32 #define LOG_SCOPE_HEADER "pane [" + id() + "] " + __func__
33 #define LOG_HEADER LOG_SCOPE_HEADER + ':'
76 if(item.item_grid->get_rectangle().contains(
coordinate)) {
77 return item.item_grid->find_at(
coordinate, must_be_active);
96 return item.item_grid.get();
107 , item_builder_(builder.item_definition)
108 , item_id_generator_(0)
109 , placer_(
placer_base::build(builder.grow_dir, builder.parallel_items))
111 connect_signal<event::REQUEST_PLACEMENT>(
118 const std::map<std::string, std::string>& tags)
124 for(
const auto &
data : item_data)
146 assert(origin.x == 0);
147 assert(origin.y == 0);
180 items_.sort(compare_functor);
205 const bool must_be_active)
const
355 , grow_dir(*
grow_direction::get_enum(cfg[
"grow_direction"].str()))
356 , parallel_items(cfg[
"parallel_items"].to_int())
369 return std::make_unique<pane>(*
this);
A config object defines a single node in a WML file, with access to child nodes.
Main class to show messages to the user.
bool fire(const ui_event event, widget &target)
Fires an event which has no extra parameters.
A pane is a container where new members can be added and removed during run-time.
void place_or_set_origin_children()
Places or moves the children on the pane.
void signal_handler_request_placement(dispatcher &dispatcher, const event::ui_event event, bool &handled)
std::function< bool(const item &, const item &)> compare_functor_t
grid * get_grid(const unsigned id)
Returns a grid in the pane.
bool disable_click_dismiss() const override
See widget::disable_click_dismiss.
std::function< bool(const item &)> filter_functor_t
std::list< item > items_
The items in the pane.
virtual widget * find_at(const point &coordinate, const bool must_be_active) override
See widget::find_at.
pane(const implementation::builder_pane &builder)
std::unique_ptr< placer_base > placer_
Helper to do the placement.
virtual iteration::walker_ptr create_walker() override
See widget::create_walker.
void sort(const compare_functor_t &compare_functor)
Sorts the contents of the pane.
builder_grid_ptr item_builder_
The builer for the items in the list.
virtual point calculate_best_size() const override
See widget::calculate_best_size.
virtual void impl_draw_children() override
See widget::impl_draw_children.
virtual void place(const point &origin, const point &size) override
See widget::place.
unsigned create_item(const widget_data &item_data, const std::map< std::string, std::string > &tags)
Creates a new item.
virtual void request_reduce_width(const unsigned maximum_width) override
See widget::request_reduce_width.
void place_children()
Places the children on the pane.
unsigned item_id_generator_
The id generator for the items.
virtual void layout_initialize(const bool full_initialization) override
See widget::layout_initialize.
void filter(const filter_functor_t &filter_functor)
Filters the contents of the pane.
void set_origin_children()
Moves the children on the pane.
void prepare_placement() const
Updates the placement for the child items.
Base class for the placement helper.
void layout_linked_widgets()
Layouts the linked widgets.
This file contains the definitions for the gui2::event::message class.
static std::string _(const char *str)
Define the common log macros for the gui toolkit.
void point(int x, int y)
Draw a single point.
ui_event
The event sent to the dispatcher.
std::unique_ptr< class walker_base > walker_ptr
std::map< std::string, widget_item > widget_data
Contains the implementation details for lexical_cast and shouldn't be used directly.
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.
std::size_t index(std::string_view str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
typename const_clone< D, S >::pointer const_clone_ptr
The message callbacks hold a reference to a message.
builder_pane(const config &cfg)
virtual std::unique_ptr< widget > build() const override
std::unique_ptr< grid > item_grid
Helper to implement private functions without modifying the header.
static utils::const_clone_ptr< grid, W > get_grid(W pane, const unsigned id)
Implementation for the wrappers for [const] grid* pane::grid(const unsigned id) [const].
static utils::const_clone_ptr< widget, W > find_at(W pane, point coordinate, const bool must_be_active)
Implementation for the wrappers for [const] widget* pane::find_at(const point&, const bool) [const].
The base template for associating string values with enum values.
std::string missing_mandatory_wml_tag(const std::string §ion, const std::string &tag)
Returns a standard message for a missing wml child (tag).
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.