16 #define GETTEXT_DOMAIN "wesnoth-lib"
31 #define LOG_SCOPE_HEADER get_control_type() + " [" + id() + "] " + __func__
32 #define LOG_HEADER LOG_SCOPE_HEADER + ':'
45 const std::string_view
id,
46 const bool must_be_active)
48 for(
unsigned i = 0;
i < stack.get_tab_count(); ++
i) {
49 auto* tab_grid = stack.get_tab_grid(
i);
54 if(W* res = tab_grid->find(
id, must_be_active)) {
59 return stack.container_base::find(
id, must_be_active);
69 const auto conf = cast_config_to<tab_container_definition>();
80 for(
const auto& builder_entry : builder.
builders) {
84 grid* parent_grid = find_widget<grid>(
"_content_grid",
false,
true);
147 return tab_container_implementation::find<widget>(*
this,
id, must_be_active);
152 return tab_container_implementation::find<const widget>(*
this,
id, must_be_active);
162 load_resolutions<resolution>(
cfg);
173 grid = std::make_shared<builder_grid>(child);
181 builder_tab_container::builder_tab_container(
const config&
cfg)
187 {
"image", {{
"label", tab[
"image"].str()}} },
188 {
"name", {{
"label", tab[
"name"].t_str()}} }
191 if(tab.has_child(
"data")) {
192 auto builder = std::make_shared<builder_grid>(tab.mandatory_child(
"data"));
201 auto widget = std::make_unique<tab_container>(*
this);
202 DBG_GUI_G <<
"Window builder: placed tab_container '" <<
id
203 <<
"' with definition '" <<
definition <<
"'.";
A config object defines a single node in a WML file, with access to child nodes.
child_itors child_range(std::string_view key)
bool has_child(std::string_view key) const
Determine whether a config has a child or not.
A generic container base class.
const grid & get_grid() const
virtual void place(const point &origin, const point &size) override
See widget::place.
void init_grid(const builder_grid &grid_builder)
Initializes and builds the grid.
void connect_signal(const F &func, const queue_position position=back_child)
Adds a callback to the appropriate queue based on event type.
bool fire(const ui_event event, widget &target)
Fires an event which has no extra parameters.
virtual void select_item(const unsigned index, const bool select)=0
(De)selects an item.
static std::unique_ptr< generator_base > build(const bool has_minimum, const bool has_maximum, const placement placement, const bool select)
Create a new generator.
Basic template class to generate new items.
grid & create_item(const int index, const builder_grid &list_builder, const widget_item &item_data, const std::function< void(widget &)> &callback) override
Inherited from generator_base.
std::unique_ptr< widget > swap_child(const std::string &id, std::unique_ptr< widget > w, const bool recurse, widget *new_parent=nullptr)
Exchanges a child in the grid.
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
bool select_row(const unsigned row, const bool select=true)
Selects a row.
state_t state_
Current state of the widget.
virtual unsigned get_state() const override
Returns the id of the state.
generator_base * generator_
Contains a pointer to the generator.
virtual bool get_active() const override
Gets the active state of the styled_widget.
virtual widget * find(const std::string_view id, const bool must_be_active) override
See widget::find.
void add_tab_entry(const widget_data &row)
unsigned get_tab_count() const
virtual void set_self_active(const bool active) override
Helper for set_active.
bool can_wrap() const override
See widget::can_wrap.
void select_tab(unsigned index)
listbox & get_internal_list()
Get the listbox inside which the tabs are shown.
tab_container(const implementation::builder_tab_container &builder)
unsigned get_active_tab_index()
static std::string _(const char *str)
Define the common log macros for the gui toolkit.
std::map< std::string, widget_item > widget_data
std::map< std::string, t_string > widget_item
Contains the implementation details for lexical_cast and shouldn't be used directly.
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 >::reference const_clone_ref
This file contains the settings handling of the widget library.
virtual std::unique_ptr< widget > build() const override
std::vector< widget_data > list_items
std::vector< std::shared_ptr< builder_grid > > builders
std::vector< state_definition > state
resolution(const config &cfg)
tab_container_definition(const config &cfg)
static W * find(utils::const_clone_ref< tab_container, W > stack, const std::string_view id, const bool must_be_active)
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)