Magnum::Ui::SnapLayouter class new in Git master

Snap layouter.

The actual layout creation is done through the AbstractSnapLayout helper, or its derived BasicSnapLayout template and the SnapLayout typedef restricting it to a concrete user interface instance.

Base classes

class AbstractLayouter new in Git master
Base for layouters.

Constructors, destructors, conversion operators

SnapLayouter(LayouterHandle handle) explicit
Constructor.
SnapLayouter(const SnapLayouter&) deleted
Copying is not allowed.
SnapLayouter(SnapLayouter&&) noexcept
Move constructor.

Public functions

auto operator=(const SnapLayouter&) -> SnapLayouter& deleted
Copying is not allowed.
auto operator=(SnapLayouter&&) -> SnapLayouter& noexcept
Move assignment.
auto padding() const -> Vector4
Left, top, right and bottom padding inside a node.
auto setPadding(const Vector4& padding) -> SnapLayouter&
Set different left, top, right and bottom padding inside a node.
auto setPadding(const Vector2& padding) -> SnapLayouter&
Set different horizontal and vertical padding inside a node.
auto setPadding(Float padding) -> SnapLayouter&
Set padding inside a node.
auto margin() const -> Vector2
Horizontal and vertical margin between nodes.
auto setMargin(const Vector2& margin) -> SnapLayouter&
Set different horizontal and vertical marging between nodes.
auto setMargin(Float margin) -> SnapLayouter&
Set margin between nodes.
auto snap(LayoutHandle handle) const -> Snaps
Layout snap.
auto snap(LayouterDataHandle handle) const -> Snaps
Layout snap assuming it belongs to this layouter.
auto target(LayoutHandle handle) const -> NodeHandle
Layout target node.
auto target(LayouterDataHandle handle) const -> NodeHandle
Layout target node assuming it belongs to this layouter.
void remove(LayoutHandle handle)
Remove a layout.
void remove(LayouterDataHandle handle)
Remove a layout assuming it belongs to this layer.

Friends

auto snap(AbstractUserInterface&, SnapLayouter&, Snaps, NodeHandle, const Vector2&, const Vector2&, NodeFlags) -> AbstractAnchor new in Git master
Create a node layouted with SnapLayouter with custom offset.

Function documentation

Magnum::Ui::SnapLayouter::SnapLayouter(LayouterHandle handle) explicit

Constructor.

Parameters
handle Layouter handle returned from AbstractUserInterface::createLayouter()

Magnum::Ui::SnapLayouter::SnapLayouter(SnapLayouter&&) noexcept

Move constructor.

Performs a destructive move, i.e. the original object isn't usable afterwards anymore.

SnapLayouter& Magnum::Ui::SnapLayouter::setPadding(const Vector4& padding)

Set different left, top, right and bottom padding inside a node.

Returns Reference to self (for method chaining)

Applied globally to all layouts, i.e. when this value changes, all existing layouts will have their padding changed as well. Use setMargin() to set margin between nodes. Initially the padding is {0.0f, 0.0f, 0.0f, 0.0f}.

Calling this function causes LayouterState::NeedsUpdate to be set.

SnapLayouter& Magnum::Ui::SnapLayouter::setPadding(const Vector2& padding)

Set different horizontal and vertical padding inside a node.

Returns Reference to self (for method chaining)

Same as calling setPadding(const Vector4&) with the left, right and top, bottom components being the same.

SnapLayouter& Magnum::Ui::SnapLayouter::setPadding(Float padding)

Set padding inside a node.

Returns Reference to self (for method chaining)

Same as calling setPadding(const Vector4&) with all values being the same.

SnapLayouter& Magnum::Ui::SnapLayouter::setMargin(const Vector2& margin)

Set different horizontal and vertical marging between nodes.

Returns Reference to self (for method chaining)

Applied globally to all layouts, i.e. when this value changes, all existing layouts will have their margin changed as well. Use setPadding() to set padding inside of a node. Initially the margin is {0.0f, 0.0f}.

Calling this function causes LayouterState::NeedsUpdate to be set.

SnapLayouter& Magnum::Ui::SnapLayouter::setMargin(Float margin)

Set margin between nodes.

Returns Reference to self (for method chaining)

Same as calling setMargin(const Vector2&) with both values being the same.

Snaps Magnum::Ui::SnapLayouter::snap(LayoutHandle handle) const

Layout snap.

Expects that handle is valid. Note that if target() is NodeHandle::Null, Snap::Inside is implicitly considered to be included as well, even if not part of the actual value.

Similarly to node() and target(), the snap cannot be changed after creation as it could break internal constraints.

Snaps Magnum::Ui::SnapLayouter::snap(LayouterDataHandle handle) const

Layout snap assuming it belongs to this layouter.

Like snap(LayoutHandle) const but without checking that handle indeed belongs to this layouter. See its documentation for more information.

NodeHandle Magnum::Ui::SnapLayouter::target(LayoutHandle handle) const

Layout target node.

Expects that handle is valid. Returns NodeHandle::Null if the layout is positioned relative to the whole user interface. Note that the returned handle may be invalid if AbstractUserInterface::removeNode() was called on it or its parent nodes and AbstractUserInterface::update() hasn't been called since.

Similarly to node() and snap(), the target cannot be changed after creation as it could break internal constraints.

NodeHandle Magnum::Ui::SnapLayouter::target(LayouterDataHandle handle) const

Layout target node assuming it belongs to this layouter.

Like target(LayoutHandle) const but without checking that handle indeed belongs to this layouter. See its documentation for more information.

void Magnum::Ui::SnapLayouter::remove(LayoutHandle handle)

Remove a layout.

Delegates to AbstractLayouter::remove(LayoutHandle).

void Magnum::Ui::SnapLayouter::remove(LayouterDataHandle handle)

Remove a layout assuming it belongs to this layer.

Delegates to AbstractLayouter::remove(LayouterDataHandle).

AbstractAnchor snap(AbstractUserInterface&, SnapLayouter&, Snaps, NodeHandle, const Vector2&, const Vector2&, NodeFlags) new in Git master

Create a node layouted with SnapLayouter with custom offset.

Compared to snap(AbstractUserInterface&, SnapLayouter&, Snaps, NodeHandle, const Vector2&, NodeFlags) the offset is added to the offset calculated by the layout.