Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::HoverCursorTracker Class Reference

Remembers the pointer position and the style last handed to the platform. More...

#include <hover_cursor.hpp>

Public Member Functions

void set_pointer (Point p)
 Record that the pointer is over the surface at p (root coordinates).
void clear_pointer ()
 The pointer left the surface.
bool has_pointer () const
Point pointer () const
void note_published (View::CursorStyle style)
 Record a style the host just pushed to the platform itself, so the next poll does not push the same style again.
View::CursorStyle published () const
 The style last pushed to the platform, or default_ before any push.
std::optional< View::CursorStyle > poll_resolved (View::CursorStyle style)
 Change detection over a style the caller resolved itself.
std::optional< View::CursorStyle > poll (View &root)
 Re-resolve at the remembered pointer position and report a change.

Detailed Description

Remembers the pointer position and the style last handed to the platform.

A host calls set_pointer / clear_pointer from its enter/move/exit handlers, note_published whenever it pushes a style through its own pointer-driven path, and poll once per rendered frame. poll yields a style only when it differs from the last published one, so the platform call happens on change rather than on every frame.

Member Function Documentation

◆ clear_pointer()

void pulp::view::HoverCursorTracker::clear_pointer ( )
inline

The pointer left the surface.

Also drops the published style, so the first resolve after the pointer returns always publishes.

◆ has_pointer()

bool pulp::view::HoverCursorTracker::has_pointer ( ) const
inline

◆ note_published()

void pulp::view::HoverCursorTracker::note_published ( View::CursorStyle style)
inline

Record a style the host just pushed to the platform itself, so the next poll does not push the same style again.

◆ pointer()

Point pulp::view::HoverCursorTracker::pointer ( ) const
inline

◆ poll()

std::optional< View::CursorStyle > pulp::view::HoverCursorTracker::poll ( View & root)

Re-resolve at the remembered pointer position and report a change.

nullopt when no pointer is over the surface or the style is unchanged. This is the stationary-pointer path: it takes no event and no new coordinates, so a content change alone can move the cursor.

◆ poll_resolved()

std::optional< View::CursorStyle > pulp::view::HoverCursorTracker::poll_resolved ( View::CursorStyle style)

Change detection over a style the caller resolved itself.

Hosts that layer an overlay or inspector override on top of the hit-test answer resolve the final style and route it through here. Returns the style when it differs from the last published one, nullopt otherwise, and records a returned style as published.

◆ published()

View::CursorStyle pulp::view::HoverCursorTracker::published ( ) const
inline

The style last pushed to the platform, or default_ before any push.

◆ set_pointer()

void pulp::view::HoverCursorTracker::set_pointer ( Point p)
inline

Record that the pointer is over the surface at p (root coordinates).


The documentation for this class was generated from the following file: