16 #define GETTEXT_DOMAIN "wesnoth-lib" 33 #define LOG_SCOPE_HEADER "pane [" + id() + "] " + __func__ 34 #define LOG_HEADER LOG_SCOPE_HEADER + ':' 64 if(pane->widget::find_at(coordinate, must_be_active) != pane) {
68 for(
auto&
item : pane->items_) {
77 if(
item.item_grid->get_rectangle().contains(coordinate)) {
78 return item.item_grid->find_at(coordinate, must_be_active);
95 for(
auto&
item : pane->items_) {
97 return item.item_grid.get();
108 , item_builder_(builder.item_definition)
109 , item_id_generator_(0)
112 connect_signal<event::REQUEST_PLACEMENT>(
119 const std::map<std::string, std::string>& tags)
125 for(
const auto &
data : item_data)
148 assert(origin.x == 0);
149 assert(origin.y == 0);
182 items_.sort(compare_functor);
209 const bool must_be_active)
const 340 DBG_GUI_E << LOG_HEADER <<
' ' <<
event <<
" handled.";
347 DBG_GUI_E << LOG_HEADER <<
' ' <<
event <<
" failed to handle.";
357 builder_pane::builder_pane(
const config& cfg)
359 , grow_dir(*
grow_direction::get_enum(cfg[
"grow_direction"].str()))
360 , parallel_items(cfg[
"parallel_items"])
373 return std::make_unique<pane>(*this);
Define the common log macros for the gui toolkit.
Base class for the placement helper.
std::unique_ptr< class walker_base > walker_ptr
grid * get_grid(const unsigned id)
Returns a grid in the pane.
std::unique_ptr< grid > item_grid
ui_event
The event sent to the dispatcher.
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].
Main class to show messages to the user.
void filter(const filter_functor_t &filter_functor)
Filters the contents of the pane.
New lexcical_cast header.
std::list< item > items_
The items in the pane.
virtual void layout_initialize(const bool full_initialization) override
See widget::layout_initialize.
std::function< bool(const item &)> filter_functor_t
void sort(const compare_functor_t &compare_functor)
Sorts the contents of the pane.
std::unique_ptr< placer_base > placer_
Helper to do the placement.
void signal_handler_request_placement(dispatcher &dispatcher, const event::ui_event event, bool &handled)
static std::string _(const char *str)
void set_origin_children()
Moves the children on the pane.
void place_children()
Places the children on the pane.
The message callbacks hold a reference to a message.
virtual iteration::walker_ptr create_walker() override
See widget::create_walker.
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]...
std::size_t size(const std::string &str)
Length in characters of a UTF-8 string.
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
bool disable_click_dismiss() const override
See widget::disable_click_dismiss.
The base template for associating string values with enum values.
virtual point calculate_best_size() const override
See widget::calculate_best_size.
void prepare_placement() const
Updates the placement for the child items.
This file contains the definitions for the gui2::event::message class.
virtual void request_reduce_width(const unsigned maximum_width) override
See widget::request_reduce_width.
typename const_clone< D, S >::pointer const_clone_ptr
A pane is a container where new members can be added and removed during run-time. ...
virtual std::unique_ptr< widget > build() const override
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::function< bool(const item &, const item &)> compare_functor_t
virtual void place(const point &origin, const point &size) override
See widget::place.
Helper to implement private functions without modifying the header.
pane(const implementation::builder_pane &builder)
Contains the SDL_Rect helper code.
virtual void impl_draw_children() override
See widget::impl_draw_children.
unsigned create_item(const widget_data &item_data, const std::map< std::string, std::string > &tags)
Creates a new item.
bool fire(const ui_event event, widget &target)
Fires an event which has no extra parameters.
builder_grid_ptr item_builder_
The builer for the items in the list.
void point(int x, int y)
Draw a single point.
std::map< std::string, widget_item > widget_data
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
unsigned item_id_generator_
The id generator for the items.
map_location coordinate
Contains an x and y coordinate used for starting positions in maps.
A config object defines a single node in a WML file, with access to child nodes.
virtual widget * find_at(const point &coordinate, const bool must_be_active) override
See widget::find_at.
void place_or_set_origin_children()
Places or moves the children on the pane.
Contains the implementation details for lexical_cast and shouldn't be used directly.
void layout_linked_widgets()
Layouts the linked widgets.
std::pair< std::string, unsigned > item