Hook point for show/hide transitions on Surfaces. More...
#include <phosphor-layer/include/PhosphorLayer/ISurfaceAnimator.h>
Public Types | |
| using | CompletionCallback = std::function< void()> |
| Invoked when a show/hide animation completes. | |
Public Member Functions | |
| ISurfaceAnimator ()=default | |
| virtual | ~ISurfaceAnimator ()=default |
| virtual void | beginShow (Surface *surface, QQuickItem *rootItem, CompletionCallback onComplete)=0 |
Begin a show transition for surface. | |
| virtual void | beginHide (Surface *surface, QQuickItem *rootItem, CompletionCallback onComplete)=0 |
Begin a hide transition for surface. | |
| virtual void | cancel (Surface *surface)=0 |
Interrupt any in-flight animation for surface. | |
Hook point for show/hide transitions on Surfaces.
Primary animation authoring happens in the consumer's QML — Behavior on opacity { NumberAnimation { duration: 150 } } is almost always the right answer for fade-in/out. This interface exists for cases the QML side cannot cover:
Most consumers pass nullptr and animate entirely within QML. The default implementation (NoOpSurfaceAnimator) does exactly that — it exists so code paths can always call through the interface without null-checking.
All hooks are called on the GUI thread.
Implementations must call onComplete exactly once per hook invocation. Failing to do so will strand the Surface in a transient visibility state and eventually trigger a warning + forced transition.
| using PhosphorLayer::ISurfaceAnimator::CompletionCallback = std::function<void()> |
Invoked when a show/hide animation completes.
The animator must call this exactly once per beginShow/beginHide call. Safe to invoke synchronously for no-op animators.
|
default |
|
virtualdefault |
|
pure virtual |
Begin a hide transition for surface.
The Surface is transitioning Shown → Hidden. The animator should fade/slide the content, then invoke onComplete. The library does not delay window->hide() waiting for this — the current contract is "animate for visual polish, but the surface is considered hidden
the moment hide() is called".
Implemented in PhosphorAnimationLayer::SurfaceAnimator, and PhosphorLayer::NoOpSurfaceAnimator.
|
pure virtual |
Begin a show transition for surface.
The Surface has just become visible (Hidden → Shown). The animator can mutate rootItem (opacity, scale, y-offset) and drive an animation. Invoke onComplete when the transition finishes; the library uses this as a no-op today but a future version may defer compositor sync until the completion signal arrives.
Implemented in PhosphorAnimationLayer::SurfaceAnimator, and PhosphorLayer::NoOpSurfaceAnimator.
|
pure virtual |
Interrupt any in-flight animation for surface.
Called when the Surface is destroyed or the animation is superseded by an opposite transition (show-while-hiding).
Implemented in PhosphorAnimationLayer::SurfaceAnimator, and PhosphorLayer::NoOpSurfaceAnimator.