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

Base for visual data layers.

Provides style management and style changing depending on primary & non-fallthrough input events for builtin visual layers like BaseLayer or TextLayer.

Base classes

class AbstractLayer new in Git master
Base for data layers.

Derived classes

class BaseLayer new in Git master
Base layer.
class TextLayer new in Git master
Text layer.

Public types

class Shared
Base shared state for visual data layers.

Constructors, destructors, conversion operators

AbstractVisualLayer(const AbstractVisualLayer&) deleted
Copying is not allowed.
AbstractVisualLayer(AbstractVisualLayer&&) noexcept
Move constructor.

Public functions

auto operator=(const AbstractVisualLayer&) -> AbstractVisualLayer& deleted
Copying is not allowed.
auto operator=(AbstractVisualLayer&&) -> AbstractVisualLayer& noexcept
Move assignment.
auto shared() -> Shared&
Shared state used by this layer.
auto shared() const -> const Shared&
auto style(DataHandle handle) const -> UnsignedInt
Type-erased data style index.
template<class StyleIndex>
auto style(DataHandle handle) const -> StyleIndex
Data style index in a concrete enum type.
auto style(LayerDataHandle handle) const -> UnsignedInt
Type-erased data style index assuming it belongs to this layer.
template<class StyleIndex>
auto style(LayerDataHandle handle) const -> StyleIndex
Data style index in a concrete enum type assuming it belongs to this layer.
void setStyle(DataHandle handle, UnsignedInt style)
Set data style index.
template<class StyleIndex>
void setStyle(DataHandle handle, StyleIndex style)
Set data style index in a concrete enum type.
void setStyle(LayerDataHandle handle, UnsignedInt style)
Set data style index assuming it belongs to this layer.
template<class StyleIndex>
void setStyle(LayerDataHandle handle, StyleIndex style)
Set data style index in a concrete enum type assuming it belongs to this layer.
void setTransitionedStyle(const AbstractUserInterface& ui, DataHandle handle, UnsignedInt style)
Set data style index, potentially transitioning it based on user interface state.
template<class StyleIndex>
void setTransitionedStyle(const AbstractUserInterface& ui, DataHandle handle, StyleIndex style)
Set data style index in a concrete enum type, potentially transitioning it based on user interface state.
void setTransitionedStyle(const AbstractUserInterface& ui, LayerDataHandle handle, UnsignedInt style)
Set data style index assuming it belongs to this layer, potentially transitioning it based on user interface state.
template<class StyleIndex>
void setTransitionedStyle(const AbstractUserInterface& ui, LayerDataHandle handle, StyleIndex style)
Set data style index in a concrete enum type assuming it belongs to this layer, potentially transitioning it based on user interface state.
auto dynamicStyleUsedCount() const -> UnsignedInt
Count of used dynamic styles.
auto allocateDynamicStyle(AnimationHandle animation = AnimationHandle::Null) -> Containers::Optional<UnsignedInt>
Allocate a dynamic style index.
auto dynamicStyleAnimation(UnsignedInt id) const -> AnimationHandle
Animation associated with a dynamic style.
void recycleDynamicStyle(UnsignedInt id)
Recycle a dynamic style index.

Function documentation

Magnum::Ui::AbstractVisualLayer::AbstractVisualLayer(AbstractVisualLayer&&) noexcept

Move constructor.

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

Shared& Magnum::Ui::AbstractVisualLayer::shared()

Shared state used by this layer.

Reference to the instance passed to BaseLayerGL::BaseLayerGL(LayerHandle, Shared&) or TextLayerGL::TextLayerGL(LayerHandle, Shared&).

const Shared& Magnum::Ui::AbstractVisualLayer::shared() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

UnsignedInt Magnum::Ui::AbstractVisualLayer::style(DataHandle handle) const

Type-erased data style index.

Expects that handle is valid. The index is guaranteed to be less than Shared::totalStyleCount().

template<class StyleIndex>
StyleIndex Magnum::Ui::AbstractVisualLayer::style(DataHandle handle) const

Data style index in a concrete enum type.

Expects that handle is valid. The index is guaranteed to be less than Shared::totalStyleCount().

UnsignedInt Magnum::Ui::AbstractVisualLayer::style(LayerDataHandle handle) const

Type-erased data style index assuming it belongs to this layer.

Like style(DataHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

template<class StyleIndex>
StyleIndex Magnum::Ui::AbstractVisualLayer::style(LayerDataHandle handle) const

Data style index in a concrete enum type assuming it belongs to this layer.

Like style(DataHandle) const but without checking that handle indeed belongs to this layer. See its documentation for more information.

void Magnum::Ui::AbstractVisualLayer::setStyle(DataHandle handle, UnsignedInt style)

Set data style index.

Expects that handle is valid and style is less than Shared::totalStyleCount().

Calling this function causes LayerState::NeedsDataUpdate to be set.

template<class StyleIndex>
void Magnum::Ui::AbstractVisualLayer::setStyle(DataHandle handle, StyleIndex style)

Set data style index in a concrete enum type.

Casts style to UnsignedInt and delegates to setStyle(DataHandle, UnsignedInt).

void Magnum::Ui::AbstractVisualLayer::setStyle(LayerDataHandle handle, UnsignedInt style)

Set data style index assuming it belongs to this layer.

Like setStyle(DataHandle, UnsignedInt) but without checking that handle indeed belongs to this layer. See its documentation for more information.

template<class StyleIndex>
void Magnum::Ui::AbstractVisualLayer::setStyle(LayerDataHandle handle, StyleIndex style)

Set data style index in a concrete enum type assuming it belongs to this layer.

Casts style to UnsignedInt and delegates to setStyle(LayerDataHandle, UnsignedInt).

void Magnum::Ui::AbstractVisualLayer::setTransitionedStyle(const AbstractUserInterface& ui, DataHandle handle, UnsignedInt style)

Set data style index, potentially transitioning it based on user interface state.

Like setStyle(), but if handle is assigned to a node that's referenced from AbstractUserInterface::currentPressedNode(), currentHoveredNode() or currentFocusedNode(), applies style transition functions set in Shared::setStyleTransition() to it first. Expects that handle is valid and style is less than Shared::styleCount(). Not Shared::totalStyleCount() — the style transition functions are not allowed to use the dynamic style indices.

Calling this function causes LayerState::NeedsDataUpdate to be set.

template<class StyleIndex>
void Magnum::Ui::AbstractVisualLayer::setTransitionedStyle(const AbstractUserInterface& ui, DataHandle handle, StyleIndex style)

Set data style index in a concrete enum type, potentially transitioning it based on user interface state.

Casts style to UnsignedInt and delegates to setTransitionedStyle(const AbstractUserInterface&, DataHandle, UnsignedInt).

void Magnum::Ui::AbstractVisualLayer::setTransitionedStyle(const AbstractUserInterface& ui, LayerDataHandle handle, UnsignedInt style)

Set data style index assuming it belongs to this layer, potentially transitioning it based on user interface state.

Like setTransitionedStyle(const AbstractUserInterface&, DataHandle, UnsignedInt) but without checking that handle indeed belongs to this layer. See its documentation for more information.

template<class StyleIndex>
void Magnum::Ui::AbstractVisualLayer::setTransitionedStyle(const AbstractUserInterface& ui, LayerDataHandle handle, StyleIndex style)

Set data style index in a concrete enum type assuming it belongs to this layer, potentially transitioning it based on user interface state.

Casts style to UnsignedInt and delegates to setTransitionedStyle(const AbstractUserInterface&, LayerDataHandle, UnsignedInt).

UnsignedInt Magnum::Ui::AbstractVisualLayer::dynamicStyleUsedCount() const

Count of used dynamic styles.

Always at most Shared::dynamicStyleCount(). If equal to Shared::dynamicStyleCount(), a call to allocateDynamicStyle() will return Containers::NullOpt.

Containers::Optional<UnsignedInt> Magnum::Ui::AbstractVisualLayer::allocateDynamicStyle(AnimationHandle animation = AnimationHandle::Null)

Allocate a dynamic style index.

The returned index can be used to set properties of a dynamic style using BaseLayer::setDynamicStyle() / TextLayer::setDynamicStyle(). When added to Shared::styleCount(), it can be passed as a style index to setStyle() or BaseLayer::create() / TextLayer::create() / TextLayer::createGlyph().

When not used anymore, the index should be passed to recycleDynamicStyle() to make it available for allocation again. If there are no free dynamic styles left, returns Containers::NullOpt.

If the dynamic style is driven by an animation, its handle can be passed to the animation argument to retrieve later with dynamicStyleAnimation(). No validation is performed on the handle, it can be arbitrary. However, if the animation belongs to an animator that's set with BaseLayer::setDefaultStyleAnimator() / TextLayer::setDefaultStyleAnimator(), style transitions in response to events will treat data using given dynamic style as if they had the style set to AbstractVisualLayerStyleAnimator::targetStyle(), instead of leaving them untouched. Which means that for example, if there's an animation that has a hovered style as the target, and a press happens, it'll trigger a transition the hovered style to a pressed one, instead of leaving the dynamic style untouched.

AnimationHandle Magnum::Ui::AbstractVisualLayer::dynamicStyleAnimation(UnsignedInt id) const

Animation associated with a dynamic style.

Expects that id is less than Shared::dynamicStyleCount(). If allocateDynamicStyle() was called with a null handle, wasn't called with id yet or recycleDynamicStyle() was called for id since, returns AnimationHandle::Null. The returned handle isn't guaranteed to be valid if non-null.

void Magnum::Ui::AbstractVisualLayer::recycleDynamicStyle(UnsignedInt id)

Recycle a dynamic style index.

Expects that id is less than Shared::dynamicStyleCount(), that it was returned from allocateDynamicStyle() earlier and that recycleDynamicStyle() hasn't been called on the allocated id yet. Animation handle associated with id is reset to AnimationHandle::Null after calling this function.