Flow
Overview
The flow element, is a composite that lays out its children much like the way text is laid out: lay out each element from left to right, fitting as much elements as possible following each child’s maximum horizontal limit. Once a row is full, move to the next row and do the same until the end of the row is filled. Repeat the procedure until all the elements are laid out. The height of each row is determined by the maximum vertical limit of all the elements to be laid out in that row.
The following graphic depicts a simplified layout scenario for child elements
a
to r
.
The child elements arranged in a flow
composite are automatically re-flowed
when the view size changes.
flow_composite
Create a flow_composite
with an indeterminate (dynamic) number of elements
to have elements laid out using flow
.
Notation
c
-
Instance of type
flow_composite
The flow_composite
is essentially a std::vector<element_ptr>
that the
client uses to manage the composite’s elements. The client is responsible for
the lifetime of the container, c
. You use flow_composite
just as you
would a std::vector
, such as using push_back
to add a child element.
Remember that the items are element_ptr
instances.
flow
Once we have a flow_composite
, we can place its contents in a flow
element.
Semantics
-
Returns instance of
Composite
.
Copyright (c) 2014-2024 Joel de Guzman. All rights reserved. Distributed under the MIT License