container
s<container> <type>grid</type> <name>bottom-container</name> </container> <!-- ... --> <layout type="grid" id="bottom-container"> <creator>bottom-container-creator</creator> <!-- ... --> </layout> /* ----- */ x::w::uielements elements; elements.layout_creators.emplace("bottom-container-creator", [] (const x::w::gridlayoutmanager &layoutmanager) { // ... }); layout_manager->generate("dialog", generators, elements); x::w::container bottom_container=elements.get_element("bottom-container"); x::w::gridlayoutmanager bottom_container_lm=elements.get_layoutmanager("bottom-container");
A container
creates a new container
widget. Its name
serves a dual purpose:
It gives the layout
with the same
id
as the
container
's
name
.
The
type
s must match.
This specifies the new container's layout and creates the
widget in the container.
After generate
()ing the widgets,
get_element
() returns the new
x::w::container
, and
get_layoutmanager
() returns the new
layout manager.
container
creates a container and then
generate
()s the new container from
another
layout
in the theme file, whose
id
is
name
.
type
must be one of the supported layout
types, and must match the
layout
's
type
.
container
is
equivalent to invoking a
name
-d
element
callback, and having the callback
create a new container with the appropriate layout manager,
and then generate
()ing its contents
from the layout specified by the
name
value (which serves the same
dual purpose as the element
element).
The name
d layout must exist in the
theme file, even if nothing needs to be generated in the new
container, it gets created with no initial contents.
The layout
is empty, in this case.
A container
element also has other
optional values that depend on its type
that initialize the container.
layout
s
An optional
creator
value
specifies a creator callback in
x::w::uielements
's
layout_creators
map.
The callback receives two parameters: the new container object
and the new layout manager object. The creators gets invoked from
the new container's creator lambda, as part of
generate
()ing the new container's contents from
the specified
layout
.