class
#include <Magnum/Ui/AbstractVisualLayer.h>
Shared Base shared state for visual data layers.
Stores style transition and animation functions.
Derived classes
- class Magnum::Ui::BaseLayer::Shared
- Shared state for the base layer.
- class Magnum::Ui::LineLayer::Shared
- Shared state for the line layer.
- class Magnum::Ui::TextLayer::Shared
- Shared state for the text layer.
Constructors, destructors, conversion operators
Public functions
- auto operator=(const Shared&) -> Shared& deleted
- Copying is not allowed.
- auto operator=(Shared&&) -> Shared& noexcept
- Move assignment.
- auto styleCount() const -> UnsignedInt
- Style count.
- auto dynamicStyleCount() const -> UnsignedInt
- Dynamic style count.
- auto totalStyleCount() const -> UnsignedInt
- Total style count.
- auto styleTransitionToInactiveOut() -> auto
- Style transition to an inactive out state.
- auto styleTransitionToInactiveOver() -> auto
- Style transition to an inactive over state.
- auto styleTransitionToFocusedOut() -> auto
- Style transition to a focused out state.
- auto styleTransitionToFocusedOver() -> auto
- Style transition to a focused over state.
- auto styleTransitionToPressedOut() -> auto
- Style transition to a pressed out state.
- auto styleTransitionToPressedOver() -> auto
- Style transition to a pressed over state.
- auto styleTransitionToDisabled() -> auto
- Style transition to a disabled state.
- auto setStyleTransition(UnsignedInt(*)(UnsignedInt) toInactiveOut, UnsignedInt(*)(UnsignedInt) toInactiveOver, UnsignedInt(*)(UnsignedInt) toFocusedOut, UnsignedInt(*)(UnsignedInt) toFocusedOver, UnsignedInt(*)(UnsignedInt) toPressedOut, UnsignedInt(*)(UnsignedInt) toPressedOver, UnsignedInt(*)(UnsignedInt) toDisabled) -> Shared&
- Set type-erased style transition functions.
-
template<class StyleIndex, StyleIndex(*)(StyleIndex) toInactiveOut, StyleIndex(*)(StyleIndex) toInactiveOver, StyleIndex(*)(StyleIndex) toFocusedOut, StyleIndex(*)(StyleIndex) toFocusedOver, StyleIndex(*)(StyleIndex) toPressedOut, StyleIndex(*)(StyleIndex) toPressedOver, StyleIndex(*)(StyleIndex) toDisabled>auto setStyleTransition() -> Shared&
- Set style transition functions.
- auto setStyleTransition(UnsignedInt(*)(UnsignedInt) toInactive, UnsignedInt(*)(UnsignedInt) toFocused, UnsignedInt(*)(UnsignedInt) toPressed, UnsignedInt(*)(UnsignedInt) toDisabled) -> Shared&
- Set style transition functions without hover state.
-
template<class StyleIndex, StyleIndex(*)(StyleIndex) toInactive, StyleIndex(*)(StyleIndex) toFocused, StyleIndex(*)(StyleIndex) toPressed, StyleIndex(*)(StyleIndex) toDisabled>auto setStyleTransition() -> Shared&
- Set style transition functions.
- auto setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnter, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeave, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent) -> Shared&
- Set style animation functions.
-
template<class StyleIndex, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnter, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeave, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease, AnimationHandle(*)(Animator&animator, StyleIndex style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent>auto setStyleAnimation() -> Shared&
- Set style animation functions.
- auto setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent) -> Shared&
- Set style animation functions without hover state.
-
template<class StyleIndex, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease, AnimationHandle(*)(Animator&animator, StyleIndex style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent>auto setStyleAnimation() -> Shared&
- Set style animation functions without hover state.
- auto setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnterFocusPress, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeaveBlurRelease, AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent) -> Shared&
- Set style animation functions.
-
template<class StyleIndex, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnterFocusPress, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeaveBlurRelease, AnimationHandle(*)(Animator&animator, StyleIndex style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent>auto setStyleAnimation() -> Shared&
- Set style animation functions.
Function documentation
Magnum:: Ui:: AbstractVisualLayer:: Shared:: Shared(Shared&&) noexcept
Move constructor.
Performs a destructive move, i.e. the original object isn't usable afterwards anymore. Note that it's allowed to move the shared instance even after it had been referenced by a layer — internally the layers will appropriately relocate their references as well.
UnsignedInt Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleCount() const
Style count.
Count of styles used by all layer instances referencing this Shared instance. IDs greater than styleCount() are then dynamic styles, with their count specified by dynamicStyleCount().
UnsignedInt Magnum:: Ui:: AbstractVisualLayer:: Shared:: dynamicStyleCount() const
Dynamic style count.
Count of dynamic styles appearing after the initial styleCount() styles, i.e. having IDs greater or equal to styleCount() and less than totalStyleCount(). The dynamic styles are local to every layer instance and are meant to be used mainly for style transition animations.
UnsignedInt Magnum:: Ui:: AbstractVisualLayer:: Shared:: totalStyleCount() const
Total style count.
A sum of styleCount() and dynamicStyleCount(). Styles with IDs less than styleCount() are the shared ones, styles with IDs greater or equal to styleCount() and less than totalStyleCount() are the dynamic ones.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToInactiveOut()
Style transition to an inactive out state.
Is never nullptr
, if not set it returns a pointer to a function that returns the argument unchanged.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToInactiveOver()
Style transition to an inactive over state.
Is never nullptr
, if not set it returns a pointer to a function that returns the argument unchanged.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToFocusedOut()
Style transition to a focused out state.
Is never nullptr
, if not set it returns a pointer to a function that returns the argument unchanged.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToFocusedOver()
Style transition to a focused over state.
Is never nullptr
, if not set it returns a pointer to a function that returns the argument unchanged.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToPressedOut()
Style transition to a pressed out state.
Is never nullptr
, if not set it returns a pointer to a function that returns the argument unchanged.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToPressedOver()
Style transition to a pressed over state.
Is never nullptr
, if not set it returns a pointer to a function that returns the argument unchanged.
auto Magnum:: Ui:: AbstractVisualLayer:: Shared:: styleTransitionToDisabled()
Style transition to a disabled state.
Unlike other transition functions, this one is nullptr
if not set.
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleTransition(UnsignedInt(*)(UnsignedInt) toInactiveOut,
UnsignedInt(*)(UnsignedInt) toInactiveOver,
UnsignedInt(*)(UnsignedInt) toFocusedOut,
UnsignedInt(*)(UnsignedInt) toFocusedOver,
UnsignedInt(*)(UnsignedInt) toPressedOut,
UnsignedInt(*)(UnsignedInt) toPressedOver,
UnsignedInt(*)(UnsignedInt) toDisabled)
Set type-erased style transition functions.
Returns | Reference to self (for method chaining) |
---|
The toInactiveOut
and toInactiveOver
change a non-disabled style index to an inactive one with the pointer outside or over the node, for example when a mouse enters or leaves an area of otherwise inactive (neither focused nor pressed) button, but also when a button is released again or an input is no longer focused.
The toFocusedOut
and toFocusedOver
change a non-disabled style index to a focused one with the pointer outside or over the node. Note that, to reduce the amount of combinations, a pressed state has a priority over focused, so these two transitions are picked only when hovering a focused node or when the pointer is released after a node was focused by a pointer press. These transitions only ever happen for data attached to NodeFlag::
The toPressedOut
and toPressedOver
change a non-disabled style index to a pressed one with the pointer outside or over the node, for example after a pointer was pressed on a hovered button, after an activated but non-hovered button was pressed via a keyboard, but also after a pointer leaves a pressed button, making it no longer hovered or re-enters it, making it hovered again.
The toDisabled
changes a style index to a disabled one, which happens when a NodeFlag::
The style transition happens regardless of any Modifiers being present on the event. If any of the functions is nullptr
, given transition is a no-op, keeping the same index. All transition functions are nullptr
initially.
For correct behavior, the toInactiveOut
, toInactiveOver
, toFocusedOut
, toFocusedOver
, toPressedOut
and toPressedOver
functions should be mutually invertible, e.g. toPressedOver(toInactiveOut(style)) == style
if the style
was a pressed over style to begin with (and both transition functions were defined). The toDisabled
function doesn't have to be, i.e. it can conflate multiple styles into one, as a disabled style is internally never transitioned back to a non-disabled one. If the style doesn't handle hover in any way, for example for touch-only interfaces, you can use setStyleTransition(UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt)) instead, which doesn't make any distinction between the over and out states and uses the same transition function for both.
All functions are passed an index that's less than styleCount() and are expected to return an index that's less than styleCount() as well. Not totalStyleCount() — the style transition functions are not allowed to use the dynamic style indices. Data with a dynamic style index are not transitioned in any way.
Setting (and subsequently changing) the toDisabled
function causes LayerState::
template<class StyleIndex, StyleIndex(*)(StyleIndex) toInactiveOut, StyleIndex(*)(StyleIndex) toInactiveOver, StyleIndex(*)(StyleIndex) toFocusedOut, StyleIndex(*)(StyleIndex) toFocusedOver, StyleIndex(*)(StyleIndex) toPressedOut, StyleIndex(*)(StyleIndex) toPressedOver, StyleIndex(*)(StyleIndex) toDisabled>
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleTransition()
Set style transition functions.
Returns | Reference to self (for method chaining) |
---|
Like setStyleTransition(UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt)), but allows to use a concrete enum type instead of a typeless index. Same as with the type-erased variant, if any of the function template parameters is nullptr
, given transition is a no-op, keeping the same index. Example usage:
enum StyleIndex { … }; StyleIndex styleIndexTransitionToInactiveBlur(StyleIndex index) { … } StyleIndex styleIndexTransitionToInactiveHover(StyleIndex index) { … } StyleIndex styleIndexTransitionToFocusedBlur(StyleIndex index) { … } StyleIndex styleIndexTransitionToFocusedHover(StyleIndex index) { … } StyleIndex styleIndexTransitionToPressedBlur(StyleIndex index) { … } StyleIndex styleIndexTransitionToPressedHover(StyleIndex index) { … } StyleIndex styleIndexTransitionToDisabled(StyleIndex index) { … } … Ui::AbstractVisualLayer::Shared& shared = …; shared.setStyleTransition<StyleIndex, styleIndexTransitionToInactiveBlur, styleIndexTransitionToInactiveHover, styleIndexTransitionToFocusedBlur, styleIndexTransitionToFocusedHover, styleIndexTransitionToPressedBlur, styleIndexTransitionToPressedHover, styleIndexTransitionToDisabled>();
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleTransition(UnsignedInt(*)(UnsignedInt) toInactive,
UnsignedInt(*)(UnsignedInt) toFocused,
UnsignedInt(*)(UnsignedInt) toPressed,
UnsignedInt(*)(UnsignedInt) toDisabled)
Set style transition functions without hover state.
Returns | Reference to self (for method chaining) |
---|
Same as calling setStyleTransition(UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt), UnsignedInt(*)(UnsignedInt)) with toInactive
used for both toInactiveOut
and toInactiveOver
, toFocused
used for both toFocusedOut
and toFocusedOver
and toPressed
used for both toPressedOut
and toPressedOver
. Useful in case the style doesn't handle hover in any way, for example for touch-only interfaces.
template<class StyleIndex, StyleIndex(*)(StyleIndex) toInactive, StyleIndex(*)(StyleIndex) toFocused, StyleIndex(*)(StyleIndex) toPressed, StyleIndex(*)(StyleIndex) toDisabled>
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleTransition()
Set style transition functions.
Returns | Reference to self (for method chaining) |
---|
Same as calling setStyleTransition() with toInactive
used for both toInactiveOut
and toInactiveOver
, toFocused
used for both toFocusedOut
and toFocusedOver
and toPressed
used for both toPressedOut
and toPressedOver
. Useful in case the style doesn't handle hover in any way, for example for touch-only interfaces.
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnter,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeave,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent)
Set style animation functions.
Returns | Reference to self (for method chaining) |
---|
Each of the onEnter
, onLeave
, onFocus
, onBlur
, onPress
and onRelease
functions is called when a corresponding (enter, leave, ...) event happens and a style changes as a result of style transition specified with setStyleTransition(). The function is expected to either create an animation between sourceStyle
and targetStyle
attached to data
and return its handle, or not create any animation and return AnimationHandle::targetStyle
immediately. The functions get the following arguments, in order:
animator
— animator instance that was passed in given layer's BaseLayer::setDefaultStyleAnimator() / TextLayer:: setDefaultStyleAnimator(), its type matching the type accepted by that function sourceStyle
,targetStyle
— source and target style index to animate between, wheretargetStyle
issourceStyle
transitioned by one of the functions passed to setStyleTransition()time
— time at which the event happened, meant to be used as the animation start timedata
— data handle belonging to given layer to attach the animation tocurrentAnimation
— animation handle if givendata
currently has an animated dynamic style belonging toanimator
or AnimatorDataHandle::Null if there's no dynamic style, if the dynamic style doesn't have any associated animation or if the animation doesn't belong to animator
; can be used to perform custom animation blending
The onEnter
and onLeave
functions get called when a style transition happens as a response to pointer enter and leave. If the style doesn't handle hover in any way, for example for touch-only interfaces, you can use setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle)) instead, which lacks the onEnter
and onLeave
arguments.
The onFocus
and onBlur
functions get called when a style transition happens as a response to a NodeFlag::
The onPress
and onRelease
functions get called when a style transition happens in response to pointer press and release.
Finally, after each of those, the persistent
function is called, which accepts just a single style
argument instead of a source and target style. It's meant for creating persistent animations associated with given style
such as blinking cursors or spinners. The function gets the animation created by one of the onEnter
, onLeave
, onFocus
, onBlur
, onPress
or onRelease
called right before in currentAnimation
, if any, which it should remove if it creates its own persistent animation, as currently there's no guarantee about which of them wins when they're both started at the same time.
Setting any function to nullptr
is equivalent to supplying a function that doesn't do anything and returns AnimationHandle::
If the functions return a non-null animation handle, the animation is expected to come from the passed animator
, have targetStyle
(or style
in case of the persistent
animation) as the target style, start at time
, be attached to data
and have neither AnimationFlag::time
is needed for ensuring correct animation order when transitions happen rapidly after each other.
In all cases, the functions get called only if BaseLayer::sourceStyle
and targetStyle
differ. Right now, there's no possibility to animate a transition from and to a disabled state, additionally transitions that happen due to nodes being no longer visible, no longer focusable or no longer accepting events can't be animated either.
template<class StyleIndex, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnter, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeave, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease, AnimationHandle(*)(Animator&animator, StyleIndex style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent>
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleAnimation()
Set style animation functions.
Returns | Reference to self (for method chaining) |
---|
Like setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle)) but allows to use a concrete animator type and a concrete enum type instead of a typeless index. Same as with the type-erased variant, if any of the function template parameters is nullptr
, it's equivalent to a function returning false
without any side effects. Example usage, in this case with BaseLayer and its corresponding BaseLayerStyleAnimator:
enum StyleIndex { … }; Ui::AnimationHandle styleIndexAnimationOnEnter(Ui::BaseLayerStyleAnimator& animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } Ui::AnimationHandle styleIndexAnimationOnLeave(Ui::BaseLayerStyleAnimator& animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } Ui::AnimationHandle styleIndexAnimationOnFocus(Ui::BaseLayerStyleAnimator& animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } Ui::AnimationHandle styleIndexAnimationOnBlur(Ui::BaseLayerStyleAnimator& animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } Ui::AnimationHandle styleIndexAnimationOnPress(Ui::BaseLayerStyleAnimator& animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } Ui::AnimationHandle styleIndexAnimationOnRelease(Ui::BaseLayerStyleAnimator& animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } Ui::AnimationHandle styleIndexAnimationPersistent(Ui::BaseLayerStyleAnimator& animator, StyleIndex style, Nanoseconds time, Ui::LayerDataHandle data, Ui::AnimatorDataHandle currentAnimation) { … } … Ui::BaseLayer::Shared& shared = …; shared.setStyleAnimation<StyleIndex, styleIndexAnimationOnEnter, styleIndexAnimationOnLeave, styleIndexAnimationOnFocus, styleIndexAnimationOnBlur, styleIndexAnimationOnPress, styleIndexAnimationOnRelease, styleIndexAnimationPersistent>();
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent)
Set style animation functions without hover state.
Returns | Reference to self (for method chaining) |
---|
Same as calling setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle)) with onEnter
and onLeave
set to nullptr
. Useful in case the style doesn't handle hover in any way, for example for touch-only interfaces.
template<class StyleIndex, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onFocus, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onBlur, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onPress, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onRelease, AnimationHandle(*)(Animator&animator, StyleIndex style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent>
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleAnimation()
Set style animation functions without hover state.
Returns | Reference to self (for method chaining) |
---|
Same as calling setStyleAnimation() with onEnter
and onLeave
set to nullptr
. Useful in case the style doesn't handle hover in any way, for example for touch-only interfaces.
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnterFocusPress,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt sourceStyle, UnsignedInt targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeaveBlurRelease,
AnimationHandle(*)(AbstractVisualLayerStyleAnimator&animator, UnsignedInt style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent)
Set style animation functions.
Returns | Reference to self (for method chaining) |
---|
Same as calling setStyleAnimation(AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle), AnimationHandle(*)(AbstractVisualLayerStyleAnimator&, UnsignedInt, Nanoseconds, LayerDataHandle, AnimatorDataHandle)) with onEnter
, onFocus
and onPress
being set to onEnterFocusPress
, and onLeave
, onBlur
, onRelease
set to onLeaveBlurRelease
. Useful in case there are only two kinds of animations, for example a more immediate one for the former set of events and a slower one for the latter.
template<class StyleIndex, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onEnterFocusPress, AnimationHandle(*)(Animator&animator, StyleIndex sourceStyle, StyleIndex targetStyle, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) onLeaveBlurRelease, AnimationHandle(*)(Animator&animator, StyleIndex style, Nanoseconds time, LayerDataHandle data, AnimatorDataHandle currentAnimation) persistent>
Shared& Magnum:: Ui:: AbstractVisualLayer:: Shared:: setStyleAnimation()
Set style animation functions.
Returns | Reference to self (for method chaining) |
---|
Same as calling setStyleAnimation() with onEnter
, onFocus
and onPress
being set to onEnterFocusPress
, and onLeave
, onBlur
, onRelease
set to onLeaveBlurRelease
. Useful in case there are only two kinds of animations, for example a more immediate one for the former set of events and a slower one for the latter.