15 #define GETTEXT_DOMAIN "wesnoth-lib"
38 , page_builder_(
nullptr)
49 const std::map<std::string /* widget id */, string_map>&
data)
128 assert(content_grid);
135 tgrid* parent_grid =
nullptr;
137 parent_grid = find_widget<tgrid>(
grid,
id,
false,
false);
140 parent_grid = find_widget<tgrid>(content_grid,
id,
true,
false);
142 parent_grid =
dynamic_cast<tgrid*
>(parent_grid->
parent());
146 widget = parent_grid->
swap_child(
id, widget,
false);
186 DBG_GUI_P <<
"Parsing multipage " <<
id <<
'\n';
188 load_resolutions<tresolution>(cfg);
269 tbuilder_multi_page::tbuilder_multi_page(
const config& cfg)
288 for(
const auto &
column :
row.child_range(
"column"))
291 for(
const auto &
i :
column.attribute_range())
293 data.back()[
i.first] =
i.second;
299 _(
"'list_data' must have "
300 "the same number of columns as the 'list_definition'."));
312 DBG_GUI_G <<
"Window builder: placed multi_page '" <<
id
313 <<
"' with definition '" <<
definition <<
"'.\n";
child_itors child_range(const std::string &key)
Abstract base class for the generator.
virtual void select_item(const unsigned index, const bool select)=0
(De)selects an item.
const tgrid & grid() const
void set_page_builder(tbuilder_grid_ptr page_builder)
twindow * build(CVideo &video, const twindow_builder::tresolution *definition)
Builds a window.
virtual void clear()=0
Deletes all items.
GLuint GLuint GLsizei GLenum type
virtual unsigned get_state() const override
See tcontrol::get_state.
tresolution_definition_ptr config()
virtual int get_selected_item() const =0
Returns the selected item.
virtual tgrid & item(const unsigned index)=0
Gets the grid of an item.
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
const tgrid & page_grid(const unsigned page) const
Returns the grid for the page.
Base class of a resolution, contains the common keys for a resolution.
A class inherited from ttext_box that displays its input as stars.
void init_control(tcontrol *control) const
std::string definition
Parameters for the control.
tresolution(const config &cfg)
static UNUSEDNOWARN std::string _(const char *str)
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
virtual const std::string & get_control_type() const override
See tcontrol::get_control_type.
virtual unsigned get_item_count() const =0
Returns the number of items.
virtual tgrid & create_item(const int index, tbuilder_grid_const_ptr list_builder, const string_map &item_data, const std::function< void(twidget &)> &callback)=0
Creates a new item.
void finalize(const std::vector< string_map > &page_data)
Finishes the building initialization of the widget.
void init_grid(const boost::intrusive_ptr< tbuilder_grid > &grid_builder)
Initializes and builds the grid.
int get_selected_page() const
Returns the selected page.
void add_page(const string_map &item)
Adds single page to the grid.
static size_t id
Ids for the timers.
GLuint GLuint GLsizei count
tmulti_page_definition(const config &cfg)
std::map< std::string, t_string > string_map
virtual void set_self_active(const bool active) override
See tcontainer_::set_self_active.
tbuilder_grid_ptr builder
unsigned get_page_count() const
Returns the number of pages.
GLenum GLenum GLvoid GLvoid * column
tgenerator_ * generator_
Contains a pointer to the generator.
void remove_page(const unsigned page, unsigned count=1)
Removes a page in the multi page.
twidget * swap_child(const std::string &id, twidget *widget, const bool recurse, twidget *new_parent=nullptr)
Exchanges a child in the grid.
virtual void impl_draw_background(surface &frame_buffer, int x_offset, int y_offset) override
See twidget::impl_draw_background.
virtual void create_items(const int index, tbuilder_grid_const_ptr list_builder, const std::vector< string_map > &data, const std::function< void(twidget &)> &callback)=0
Creates one or more new item(s).
void clear()
Removes all pages in the multi page, clearing it.
void select_page(const unsigned page, const bool select=true)
Selectes a page.
A generic container base class.
GLenum GLenum GLvoid * row
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
virtual bool get_active() const override
See tcontrol::get_active.
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
Contains the implementation details for lexical_cast and shouldn't be used directly.
tbuilder_grid_const_ptr page_builder_
Contains the builder for the new items.
virtual void delete_item(const unsigned index)=0
Deletes an item.