#include <Magnum/Ui/SnapLayouter.h>
template<class UserInterface>
BasicSnapLayout class new in Git master
Templated base for SnapLayouter layout creation helpers.
Restricts AbstractAnchor to a concrete user interface instance. See the base class documentation for more information.
Base classes
- class AbstractSnapLayout new in Git master
- Base for SnapLayouter layout creation helpers.
Constructors, destructors, conversion operators
- BasicSnapLayout(UserInterface& ui, SnapLayouter& layouter, Snaps snapFirst, NodeHandle target, Snaps snapNext) explicit
- Constructor.
- BasicSnapLayout(UserInterface& ui, Snaps snapFirst, NodeHandle target, Snaps snapNext) explicit
- Construct using the default SnapLayouter.
- BasicSnapLayout(const BasicSnapLayout&) deleted
- Copying is not allowed.
- BasicSnapLayout(BasicSnapLayout&&) defaulted noexcept
- Move constructor.
Public functions
- auto operator=(const BasicSnapLayout&) -> BasicSnapLayout& deleted
- Copying is not allowed.
- auto operator=(BasicSnapLayout&&) -> BasicSnapLayout& defaulted noexcept
- Move assignment.
- auto ui() const -> UserInterface&
- User interface instance the nodes are created in.
- auto operator()(const Vector2& size, NodeFlags flags = {}) -> BasicAnchor<UserInterface>
- Create a layouted node.
- auto operator()(const Vector2& offset, const Vector2& size, NodeFlags flags = {}) -> BasicAnchor<UserInterface>
- Create a layouted node with custom offset.
Function documentation
template<class UserInterface _1>
Magnum:: Ui:: BasicSnapLayout<_1>:: BasicSnapLayout(UserInterface& ui,
SnapLayouter& layouter,
Snaps snapFirst,
NodeHandle target,
Snaps snapNext) explicit
Constructor.
Parameters | |
---|---|
ui | User interface instance |
layouter | Layouter instance |
snapFirst | How to snap the first layout |
target | Target to which to snap the first layout |
snapNext | How to snap the next layouts |
The snapFirst
is used for creating the first ever layout, relative to target
. After that, the following layouts are all snapped to the previous created one according to snapNext
.
Since it makes little sense to layout multiple root nodes relative to each other, the target
is expected to be a valid non-null handle. If snapFirst
snaps inside of the node, the target
is used as a parent of the newly created nodes, if snapFirst
snaps outside of the node, the parent of target
is used as a parent of the newly created nodes, in which case target
is also expected to not be a root node.
Layouting a root node relative to the user interface itself is possible with snap(AbstractUserInterface&, SnapLayouter&, Snaps, const Vector2&, const Vector2&, NodeFlags) and overloads.
template<class UserInterface _1>
Magnum:: Ui:: BasicSnapLayout<_1>:: BasicSnapLayout(UserInterface& ui,
Snaps snapFirst,
NodeHandle target,
Snaps snapNext) explicit
Construct using the default SnapLayouter.
Delegates to BasicSnapLayout(UserInterface&, SnapLayouter&, Snaps, NodeHandle, Snaps) with the instance coming from UserInterface::
template<class UserInterface _1>
BasicAnchor<UserInterface> Magnum:: Ui:: BasicSnapLayout<_1>:: operator()(const Vector2& size,
NodeFlags flags = {})
Create a layouted node.
Parameters | |
---|---|
size | Desired node size |
flags | Flags to create the node with |
Returns | Anchor containing the new node and associated layout |
Creates a node parented to parent() with an associated layout. The size
is ignored in horizontal / vertical direction if the layout is snapped to the whole width / height of the target node. Calls AbstractUserInterface::
template<class UserInterface _1>
BasicAnchor<UserInterface> Magnum:: Ui:: BasicSnapLayout<_1>:: operator()(const Vector2& offset,
const Vector2& size,
NodeFlags flags = {})
Create a layouted node with custom offset.
Compared to operator()(const Vector2&, NodeFlags) the offset
is added to the offset calculated by the layout.