TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::TooltipManager Class Reference

Decides which element's tooltip shows: the hovered one after a delay, or at once for focus moved by the keyboard. More...

#include <gui_controls/gui_tooltip_manager.h>

Public Member Functions

void BeginFrame (ID currentHoveredID, ID currentFocusedID, float elapsedTimeSecs, bool hasMouseMove, bool hasMousePress, bool hasKeyboard, bool hasScroll, bool menuIsOpen, bool buttonHeld=false)
 Updates the target from this frame's hover, focus and input; call before OnGUI.
ID GetActiveTargetID () const
 The element the tooltip is for: the hovered one, or the focused one after a Tab.
void SetTargetAncestors (std::vector< ID > ancestors)
 The elements that take the active target's states (PropagatesDescendantState); a tooltip on any of them shows too.
bool ShouldShow (ID targetID)
 True when the tooltip for targetID should be shown this frame: it is the active target or one around it, and no other tooltip was shown this frame, so a control's own tooltip (declared first) wins over its container's.
void EndFrame ()
 Call after OnGUI. Hides the tooltip if nothing declared it this frame.
bool IsVisible () const
 True while a tooltip is shown.

Public Attributes

float delaySeconds = 0.5f
 hover time before a tooltip shows
float warmSeconds = 0.5f
 after a tooltip was shown, the next shows at once for this long
float hideSeconds = 0.1f
 a tooltip stays this long after its target is left

Detailed Description

Decides which element's tooltip shows: the hovered one after a delay, or at once for focus moved by the keyboard.

Moving on from one tooltip to the next shows the next at once; leaving one keeps it a moment. Presses, keys, scrolling and open menus dismiss it, and none shows while a mouse button is held (a drag).

Member Function Documentation

◆ BeginFrame()

void tachyon::TooltipManager::BeginFrame ( ID currentHoveredID,
ID currentFocusedID,
float elapsedTimeSecs,
bool hasMouseMove,
bool hasMousePress,
bool hasKeyboard,
bool hasScroll,
bool menuIsOpen,
bool buttonHeld = false )

Updates the target from this frame's hover, focus and input; call before OnGUI.

◆ GetActiveTargetID()

ID tachyon::TooltipManager::GetActiveTargetID ( ) const
inline

The element the tooltip is for: the hovered one, or the focused one after a Tab.

◆ SetTargetAncestors()

void tachyon::TooltipManager::SetTargetAncestors ( std::vector< ID > ancestors)
inline

The elements that take the active target's states (PropagatesDescendantState); a tooltip on any of them shows too.

Call after BeginFrame.

◆ ShouldShow()

bool tachyon::TooltipManager::ShouldShow ( ID targetID)

True when the tooltip for targetID should be shown this frame: it is the active target or one around it, and no other tooltip was shown this frame, so a control's own tooltip (declared first) wins over its container's.

A true result declares it, keeping it visible.

◆ EndFrame()

void tachyon::TooltipManager::EndFrame ( )

Call after OnGUI. Hides the tooltip if nothing declared it this frame.

◆ IsVisible()

bool tachyon::TooltipManager::IsVisible ( ) const
inline

True while a tooltip is shown.

Member Data Documentation

◆ delaySeconds

float tachyon::TooltipManager::delaySeconds = 0.5f

hover time before a tooltip shows

◆ warmSeconds

float tachyon::TooltipManager::warmSeconds = 0.5f

after a tooltip was shown, the next shows at once for this long

◆ hideSeconds

float tachyon::TooltipManager::hideSeconds = 0.1f

a tooltip stays this long after its target is left


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