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

#include <tooltip_window.hpp>

Public Types

enum class  Phase { idle , pending , showing , hiding }

Public Member Functions

 TooltipWindow ()=default
void show (std::string text, Point anchor)
 Begin showing a tooltip near anchor.
void move_to (Point anchor)
 Update the anchor position.
void hide ()
 Begin fade-out.
void cancel_pending ()
 Cancel any pending hover-delay without showing.
bool tick (float dt)
 Advance time.
bool visible () const
 True once the tooltip is past the hover-delay (showing or hiding).
bool pending () const
Phase phase () const
float opacity () const
Point position () const
const std::string & text () const
Point last_anchor () const
void set_hover_delay (float seconds)
 Time in seconds the pointer must hover before the tooltip appears.
float hover_delay () const
void set_fade_duration (float seconds)
 Fade-in / fade-out duration in seconds.
float fade_duration () const
void set_auto_hide (float seconds)
 When > 0, the tooltip auto-hides this many seconds after it becomes visible.
float auto_hide () const
void set_cursor_offset (Point offset)
 Pixel offset applied to anchor when computing the tooltip's rendered position.
Point cursor_offset () const

Public Attributes

std::function< void(Phase)> on_phase_change
 Optional observer fired on every phase transition.

Member Enumeration Documentation

◆ Phase

Enumerator
idle 

Nothing showing, no pending show.

pending 

Hover-delay timer running, not yet visible.

showing 

Visible (possibly still fading in).

hiding 

Fade-out in progress.

Constructor & Destructor Documentation

◆ TooltipWindow()

pulp::view::TooltipWindow::TooltipWindow ( )
default

Member Function Documentation

◆ auto_hide()

float pulp::view::TooltipWindow::auto_hide ( ) const
inline

◆ cancel_pending()

void pulp::view::TooltipWindow::cancel_pending ( )
inline

Cancel any pending hover-delay without showing.

Cheap "user moved off the target before the tooltip appeared" path.

◆ cursor_offset()

Point pulp::view::TooltipWindow::cursor_offset ( ) const
inline

◆ fade_duration()

float pulp::view::TooltipWindow::fade_duration ( ) const
inline

◆ hide()

void pulp::view::TooltipWindow::hide ( )
inline

Begin fade-out.

No-op when already idle/hiding. From pending (never appeared) jumps straight to idle without a fade.

◆ hover_delay()

float pulp::view::TooltipWindow::hover_delay ( ) const
inline

◆ last_anchor()

Point pulp::view::TooltipWindow::last_anchor ( ) const
inline

◆ move_to()

void pulp::view::TooltipWindow::move_to ( Point anchor)
inline

Update the anchor position.

Useful while the pointer is moving over the same target — the tooltip follows it. No-op when idle.

◆ opacity()

float pulp::view::TooltipWindow::opacity ( ) const
inline

◆ pending()

bool pulp::view::TooltipWindow::pending ( ) const
inline

◆ phase()

Phase pulp::view::TooltipWindow::phase ( ) const
inline

◆ position()

Point pulp::view::TooltipWindow::position ( ) const
inline

◆ set_auto_hide()

void pulp::view::TooltipWindow::set_auto_hide ( float seconds)
inline

When > 0, the tooltip auto-hides this many seconds after it becomes visible.

Default 0 (no auto-hide; the caller drives hide() on mouse-leave).

◆ set_cursor_offset()

void pulp::view::TooltipWindow::set_cursor_offset ( Point offset)
inline

Pixel offset applied to anchor when computing the tooltip's rendered position.

Default (12, 18) — below + right of cursor.

◆ set_fade_duration()

void pulp::view::TooltipWindow::set_fade_duration ( float seconds)
inline

Fade-in / fade-out duration in seconds.

Honored by MotionPreferences via the embedded ValueAnimation. Default 0.12s.

◆ set_hover_delay()

void pulp::view::TooltipWindow::set_hover_delay ( float seconds)
inline

Time in seconds the pointer must hover before the tooltip appears.

Default 0.6s.

◆ show()

void pulp::view::TooltipWindow::show ( std::string text,
Point anchor )
inline

Begin showing a tooltip near anchor.

Anchor is in whatever coordinate space the host wants (typically window-local or screen-local — TooltipWindow stores it verbatim).

The tooltip is not immediately visible: it waits hover_delay() seconds (default 0.6s) before fading in. Calling show() again with the same anchor is a no-op; calling it with a different anchor while pending resets the timer; calling it while already showing updates the anchor (move_to behavior).

◆ text()

const std::string & pulp::view::TooltipWindow::text ( ) const
inline

◆ tick()

bool pulp::view::TooltipWindow::tick ( float dt)
inline

Advance time.

Drives hover-delay, fade animations, and auto-hide. Returns true while any work remains (delay running, animation running, or visible+auto_hide armed).

◆ visible()

bool pulp::view::TooltipWindow::visible ( ) const
inline

True once the tooltip is past the hover-delay (showing or hiding).

Hosts should paint when this is true and opacity > 0.

Member Data Documentation

◆ on_phase_change

std::function<void(Phase)> pulp::view::TooltipWindow::on_phase_change

Optional observer fired on every phase transition.


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