AbstractSnapLayout class new in Git master
#include <Magnum/Ui/SnapLayout.h>
Base for layouts using SnapLayouter.
A non-owning wrapper of an AbstractUserInterface and SnapLayouter reference, NodeHandle and a LayoutHandle, convertible to an AbstractAnchor to construct widget instances with. The BasicSnapLayout template and the SnapLayout typedef then restrict the type to a concrete user interface instance.
Converting instances of BasicSnapLayout / SnapLayout to BasicSnapLayoutColumn, BasicSnapLayoutRow / SnapLayoutColumn, SnapLayoutRow and other typedefs specialize the layout for concrete placement rules. Equivalent effect can be achieved by calling setChildSnap() and setFlags() / addFlags() / clearFlags() on the unspecialized BasicSnapLayout / SnapLayout.
Derived classes
-
template<class UserInterface>class BasicSnapLayout new in Git master
- Layout using SnapLayouter.
Public static functions
- static auto snapRoot(AbstractUserInterface& ui, SnapLayouter& layouter, Snaps snap, const Vector2& nodeSize = {}, NodeFlags nodeFlags = {}, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout
- Create an explicitly snapped root layout.
- static auto snapRoot(AbstractUserInterface& ui, SnapLayouter& layouter, Snaps snap, const Vector2& nodeSize, SnapLayoutFlags layoutFlags) -> AbstractSnapLayout
Constructors, destructors, conversion operators
- AbstractSnapLayout(SnapLayouter& layouter, const AbstractAnchor& anchor) explicit
- Construct with creating or reusing layout on an existing node.
- AbstractSnapLayout(AbstractUserInterface& ui, SnapLayouter& layouter, NodeHandle node) explicit
- Construct with creating or reusing layout on an existing node.
- AbstractSnapLayout(AbstractUserInterface& ui, SnapLayouter& layouter, LayoutHandle layout) explicit
- Construct from an existing layout handle.
- AbstractSnapLayout(AbstractUserInterface& ui, SnapLayouter& layouter, LayouterDataHandle layout) explicit
- operator NodeHandle() const
- operator LayoutHandle() const
- operator AbstractAnchor() const
- Widget positioning anchor.
Public functions
- auto ui() const -> AbstractUserInterface&
- User interface instance.
- auto layouter() const -> SnapLayouter&
- Layouter instance.
- auto node() const -> NodeHandle
- Node handle.
- auto layout() const -> LayoutHandle
- Layout handle.
- auto flags() const -> SnapLayoutFlags
- Layout flags.
- auto setFlags(SnapLayoutFlags flags) -> AbstractSnapLayout&
- Set layout flags.
- auto addFlags(SnapLayoutFlags flags) -> AbstractSnapLayout&
- Add layout flags.
- auto clearFlags(SnapLayoutFlags flags) -> AbstractSnapLayout&
- Clear layout flags.
- auto childSnap() const -> Snaps
- Snap for child layouts.
- auto setChildSnap(Snaps snap) -> AbstractSnapLayout&
- Set snap for child layouts.
-
auto child(const Vector2& nodeSize = {},
NodeFlags nodeFlags = {},
LayoutHandle layoutBefore = LayoutHandle::
Null, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout - Create a child layout.
- auto child(const Vector2& nodeSize, LayoutHandle layoutBefore, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout
- auto child(const Vector2& nodeSize, NodeFlags nodeFlags, SnapLayoutFlags layoutFlags) -> AbstractSnapLayout
- auto child(const Vector2& nodeSize, SnapLayoutFlags layoutFlags) -> AbstractSnapLayout
- auto child(const Vector2& nodeSize, NodeFlags nodeFlags, LayouterDataHandle layoutBefore, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout
- Create a child layout, ordered before given layout assuming the layout belongs to the same layouter.
- auto child(const Vector2& nodeSize, LayouterDataHandle layoutBefore, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout
- auto snapChild(Snaps snap, const Vector2& nodeSize = {}, NodeFlags nodeFlags = {}, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout
- Create an explicitly snapped child layout.
- auto snapChild(Snaps snap, const Vector2& nodeSize, SnapLayoutFlags layoutFlags) -> AbstractSnapLayout
- auto snapSibling(Snaps snap, const Vector2& nodeSize = {}, NodeFlags nodeFlags = {}, SnapLayoutFlags layoutFlags = {}) -> AbstractSnapLayout
- Create an explicitly snapped sibling layout.
- auto snapSibling(Snaps snap, const Vector2& nodeSize, SnapLayoutFlags layoutFlags) -> AbstractSnapLayout
Function documentation
static AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: snapRoot(AbstractUserInterface& ui,
SnapLayouter& layouter,
Snaps snap,
const Vector2& nodeSize = {},
NodeFlags nodeFlags = {},
SnapLayoutFlags layoutFlags = {})
Create an explicitly snapped root layout.
| Parameters | |
|---|---|
| ui | User interface instance |
| layouter | Layouter instance |
| snap | How to snap to the ui |
| nodeSize | Child node size |
| nodeFlags | Child node flags |
| layoutFlags | Layout flags |
| Returns | New layout instance |
Creates a root node and assigns it a layout explicitly snapped to the user interface itself. Expects that layouter is part of ui.
Use snapChild() on an AbstractSnapLayout instance to create an explicitly snapped child node and snapSibling() to create an explicitly snapped sibling, use child() to add a child layout positioned according to SnapLayouter::
Calls AbstractUserInterface::
static AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: snapRoot(AbstractUserInterface& ui,
SnapLayouter& layouter,
Snaps snap,
const Vector2& nodeSize,
SnapLayoutFlags layoutFlags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: AbstractSnapLayout:: AbstractSnapLayout(SnapLayouter& layouter,
const AbstractAnchor& anchor) explicit
Construct with creating or reusing layout on an existing node.
| Parameters | |
|---|---|
| layouter | Layouter instance |
| anchor | Anchor to which to assign the layout |
Expects that layouter is part of the same user interface as anchor. If the node in anchor already has a layout from layouter assigned, uses it, otherwise adds a new one to it. To add a layout to an existing node with full control over its properties use the SnapLayouter::
Calls SnapLayouter::
Magnum:: Ui:: AbstractSnapLayout:: AbstractSnapLayout(AbstractUserInterface& ui,
SnapLayouter& layouter,
NodeHandle node) explicit
Construct with creating or reusing layout on an existing node.
| Parameters | |
|---|---|
| ui | User interface instance |
| layouter | Layouter instance |
| node | Node to which to assign the layout |
Expects that layouter is part of ui and node is valid. If the node already has a layout from layouter assigned, uses it, otherwise adds a new one to it. To add a layout to an existing node with full control over its properties use the SnapLayouter::
Calls SnapLayouter::
Magnum:: Ui:: AbstractSnapLayout:: AbstractSnapLayout(AbstractUserInterface& ui,
SnapLayouter& layouter,
LayoutHandle layout) explicit
Construct from an existing layout handle.
| Parameters | |
|---|---|
| ui | User interface instance |
| layouter | Layouter instance |
| layout | Layout handle |
Expects that layouter is part of ui and layout is a valid handle coming from layouter.
Magnum:: Ui:: AbstractSnapLayout:: AbstractSnapLayout(AbstractUserInterface& ui,
SnapLayouter& layouter,
LayouterDataHandle layout) explicit
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: AbstractSnapLayout:: operator NodeHandle() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Magnum:: Ui:: AbstractSnapLayout:: operator LayoutHandle() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
NodeHandle Magnum:: Ui:: AbstractSnapLayout:: node() const
Node handle.
Guaranteed to be never NodeHandle::
LayoutHandle Magnum:: Ui:: AbstractSnapLayout:: layout() const
Layout handle.
Guaranteed to be never LayoutHandle::
AbstractSnapLayout& Magnum:: Ui:: AbstractSnapLayout:: setFlags(SnapLayoutFlags flags)
Set layout flags.
| Returns | Reference to self (for method chaining) |
|---|
Initially, a layout has the flags that were passed to snapRoot(), snapChild(), snapSibling() or child(), which are by default none. The BasicSnapLayoutColumn, BasicSnapLayoutColumnLeft, BasicSnapLayoutColumnRight, BasicSnapLayoutColumnFill, BasicSnapLayoutRow, BasicSnapLayoutRowTop, BasicSnapLayoutRowBottom and BasicSnapLayoutRowFill subclasses implicitly add SnapLayoutFlag::
Calls SnapLayouter::
AbstractSnapLayout& Magnum:: Ui:: AbstractSnapLayout:: addFlags(SnapLayoutFlags flags)
Add layout flags.
Calls setFlags() with the existing flags ORed with flags. Useful for preserving previously set flags.
AbstractSnapLayout& Magnum:: Ui:: AbstractSnapLayout:: clearFlags(SnapLayoutFlags flags)
Clear layout flags.
Calls setFlags() with the existing flags ANDed with the inverse of flags. Useful for removing a subset of previously set flags.
AbstractSnapLayout& Magnum:: Ui:: AbstractSnapLayout:: setChildSnap(Snaps snap)
Set snap for child layouts.
| Returns | Reference to self (for method chaining) |
|---|
Default is Snap::
- Bottom for BasicSnapLayoutColumn
- BottomLeft|InsideX for BasicSnapLayoutColumnLeft
- BottomRight|InsideX for BasicSnapLayoutColumnRight
- Bottom|FillX for BasicSnapLayoutColumnFill
- Right for BasicSnapLayoutRow
- TopRight|InsideY for BasicSnapLayoutRowTop
- BottomRight|InsideY for BasicSnapLayoutRowBottom
- Right|FillY for BasicSnapLayoutRowFill
Calls SnapLayouter::
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: child(const Vector2& nodeSize = {},
NodeFlags nodeFlags = {},
LayoutHandle layoutBefore = LayoutHandle:: Null,
SnapLayoutFlags layoutFlags = {})
Create a child layout.
| Parameters | |
|---|---|
| nodeSize | Child node size |
| nodeFlags | Child node flags |
| layoutBefore | Child layout to order before or LayoutHandle:: |
| layoutFlags | Layout flags |
| Returns | New layout instance |
Creates a node that's a child of node() and assigns a layout to it. The child layout is positioned according to childSnap(). Use snapChild() to snap a child layout explicitly, use snapSibling() to create an explicitly snapped sibling instead of a child.
The BasicSnapLayout subclass and its various typedefs such as SnapLayout return a concrete layout instance.
Calls AbstractUserInterface::
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: child(const Vector2& nodeSize,
LayoutHandle layoutBefore,
SnapLayoutFlags layoutFlags = {})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: child(const Vector2& nodeSize,
NodeFlags nodeFlags,
SnapLayoutFlags layoutFlags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: child(const Vector2& nodeSize,
SnapLayoutFlags layoutFlags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: child(const Vector2& nodeSize,
NodeFlags nodeFlags,
LayouterDataHandle layoutBefore,
SnapLayoutFlags layoutFlags = {})
Create a child layout, ordered before given layout assuming the layout belongs to the same layouter.
Like child(const Vector2&, NodeFlags, LayoutHandle, SnapLayoutFlags) but without checking that layoutBefore indeed belongs to layouter(). See its documentation for more information.
Calls AbstractUserInterface::
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: child(const Vector2& nodeSize,
LayouterDataHandle layoutBefore,
SnapLayoutFlags layoutFlags = {})
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: snapChild(Snaps snap,
const Vector2& nodeSize = {},
NodeFlags nodeFlags = {},
SnapLayoutFlags layoutFlags = {})
Create an explicitly snapped child layout.
| Parameters | |
|---|---|
| snap | How to snap |
| nodeSize | Child node size |
| nodeFlags | Child node flags |
| layoutFlags | Layout flags |
| Returns | New layout instance |
Creates a node that's a child of node(), and assigns a layout explicitly snapped to it. Use snapSibling() to create an explicitly snapped sibling instead of a child, use child() to add a child layout positioned implicitly according to childSnap().
The BasicSnapLayout subclass and its various typedefs such as SnapLayout return a concrete layout instance.
Calls AbstractUserInterface::
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: snapChild(Snaps snap,
const Vector2& nodeSize,
SnapLayoutFlags layoutFlags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: snapSibling(Snaps snap,
const Vector2& nodeSize = {},
NodeFlags nodeFlags = {},
SnapLayoutFlags layoutFlags = {})
Create an explicitly snapped sibling layout.
| Parameters | |
|---|---|
| snap | How to snap |
| nodeSize | Child node size |
| nodeFlags | Child node flags |
| layoutFlags | Layout flags |
| Returns | New layout instance |
Creates a node with the same parent as node(), and assigns a layout explicitly snapped to it. Use snapChild() to create an explicitly snapped child instead of a sibling, use child() to add a child layout positioned implicitly according to childSnap().
The BasicSnapLayout subclass and its various typedefs such as SnapLayout return a concrete layout instance.
Calls AbstractUserInterface::
AbstractSnapLayout Magnum:: Ui:: AbstractSnapLayout:: snapSibling(Snaps snap,
const Vector2& nodeSize,
SnapLayoutFlags layoutFlags)
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.