Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.WindowFrameTooltip Class Reference

Represents a tooltip element that displays contextual information for UI elements. The tooltip can be styled dynamically based on the current theme and supports fade-in and fade-out animations. More...

Inheritance diagram for GWG.WindowFramework.WindowFrameTooltip:
Collaboration diagram for GWG.WindowFramework.WindowFrameTooltip:

Public Member Functions

 WindowFrameTooltip ()
 Initializes a new instance of the WindowFrameTooltip class. Sets up the tooltip's default styles and registers theme update callbacks.
void CancelFadeAndRestore ()
 Cancels any scheduled fade-out or dismissal and smoothly restores the tooltip to full opacity.
void Close ()
 Closes the tooltip and applies fade-out animation if enabled.
void CloseNow ()
 Immediately closes the tooltip by pausing its associated task, resetting it, and updating the tooltip's visibility and opacity styles to make it hidden.
void Show (VisualElement target)
 Displays the tooltip near the specified target element. Positions the tooltip based on hints in the target's tooltip text.
void Show (VisualElement target, Vector2? pointerPosition)
 Displays the tooltip near the specified target element or pointer position. Positions the tooltip accurately while ensuring it stays within the visible screen area.

Properties

VisualElement CurrentTarget [get]
 Gets the VisualElement target for which the tooltip is currently displayed or scheduled.
bool IsOpen [get]
 Gets whether a target exists, visibility is Visible and current opacity is greater than zero.

Private Member Functions

void AttachTargetListeners (VisualElement target)
void DetachTargetListeners ()
void FadeInTooltip ()
void FadeOutTooltip ()
void OnAttachToPanel (AttachToPanelEvent evt)
void OnDetachFromPanel (DetachFromPanelEvent evt)
void OnTargetDetached (DetachFromPanelEvent evt)
void UpdatePosition (VisualElement target, char hint, Vector2? pointerPosition)
void UpdateTheme (List< StyleSheet > sheets, List< StyleSheet > oldTheme)
 Updates tooltip sheet references when the controller publishes a theme change.

Static Private Member Functions

static string GetElementIdentifier (VisualElement element)
 Produces a human and machine-readable identifier for any VisualElement, falling back to class names or type when name is empty.

Private Attributes

float _currentOpacity = 0f
VisualElement _currentTarget
IVisualElementScheduledItem _fadeTask
Label _label
IVisualElementScheduledItem _showTask
EventCallback< DetachFromPanelEvent > _targetDetachCallback
TooltipFadeType _tooltipFadeType

Detailed Description

Represents a tooltip element that displays contextual information for UI elements. The tooltip can be styled dynamically based on the current theme and supports fade-in and fade-out animations.

Controller-managed contextual tooltip with scheduled measurement and fade behavior.

Not currently registered as a UXML custom element. Show/Close use the existing controller/root and target lifecycle; the tooltip does not own application target resources.

Constructor & Destructor Documentation

◆ WindowFrameTooltip()

GWG.WindowFramework.WindowFrameTooltip.WindowFrameTooltip ( )
inline

Initializes a new instance of the WindowFrameTooltip class. Sets up the tooltip's default styles and registers theme update callbacks.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ AttachTargetListeners()

void GWG.WindowFramework.WindowFrameTooltip.AttachTargetListeners ( VisualElement target)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CancelFadeAndRestore()

void GWG.WindowFramework.WindowFrameTooltip.CancelFadeAndRestore ( )
inline

Cancels any scheduled fade-out or dismissal and smoothly restores the tooltip to full opacity.

If the tooltip is currently waiting out its hide delay or is in the middle of a fade-out animation, calling this method cancels the scheduled hide operation and fades the tooltip back up to full opacity.

// Cancel pending tooltip fade-out and restore full visibility
The WindowFrameController is the central management component for the Window Framework system....
Definition WindowFrameController.cs:77
static WindowFrameTooltip WindowFrameTooltip
Gets or sets the static tooltip system instance.
Definition WindowFrameController.cs:823
void CancelFadeAndRestore()
Cancels any scheduled fade-out or dismissal and smoothly restores the tooltip to full opacity.
Definition WindowFrameTooltip.cs:495
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Close()

void GWG.WindowFramework.WindowFrameTooltip.Close ( )
inline

Closes the tooltip and applies fade-out animation if enabled.

Begins the tooltip hiding sequence. If the tooltip is currently mid-fade or not fully opaque, it transitions immediately to fading out without extra delay. When fully visible, it waits for the configured WindowFrameController.TooltipFadeDelay before starting the smooth fade-out. If fade animations are disabled, the tooltip is hidden immediately.

// Gracefully dismiss tooltip with fade animation
void Close()
Closes the tooltip and applies fade-out animation if enabled.
Definition WindowFrameTooltip.cs:573
Here is the call graph for this function:

◆ CloseNow()

void GWG.WindowFramework.WindowFrameTooltip.CloseNow ( )
inline

Immediately closes the tooltip by pausing its associated task, resetting it, and updating the tooltip's visibility and opacity styles to make it hidden.

Bypasses any hide delay or fade animations to instantly make the tooltip invisible and reset its opacity. Ideal for scenarios like pointer clicks, window dragging, or context menu activations.

// Instantly hide tooltip without animation
void CloseNow()
Immediately closes the tooltip by pausing its associated task, resetting it, and updating the tooltip...
Definition WindowFrameTooltip.cs:668
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DetachTargetListeners()

void GWG.WindowFramework.WindowFrameTooltip.DetachTargetListeners ( )
inlineprivate
Here is the caller graph for this function:

◆ FadeInTooltip()

void GWG.WindowFramework.WindowFrameTooltip.FadeInTooltip ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FadeOutTooltip()

void GWG.WindowFramework.WindowFrameTooltip.FadeOutTooltip ( )
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetElementIdentifier()

string GWG.WindowFramework.WindowFrameTooltip.GetElementIdentifier ( VisualElement element)
inlinestaticprivate

Produces a human and machine-readable identifier for any VisualElement, falling back to class names or type when name is empty.

Here is the caller graph for this function:

◆ OnAttachToPanel()

void GWG.WindowFramework.WindowFrameTooltip.OnAttachToPanel ( AttachToPanelEvent evt)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnDetachFromPanel()

void GWG.WindowFramework.WindowFrameTooltip.OnDetachFromPanel ( DetachFromPanelEvent evt)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTargetDetached()

void GWG.WindowFramework.WindowFrameTooltip.OnTargetDetached ( DetachFromPanelEvent evt)
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Show() [1/2]

void GWG.WindowFramework.WindowFrameTooltip.Show ( VisualElement target)
inline

Displays the tooltip near the specified target element. Positions the tooltip based on hints in the target's tooltip text.

Parameters
targetThe UI element to display the tooltip for.

Evaluates positioning hints within the target's tooltip text (e.g., 'T:', 'B:', 'L:', 'R:'). Positions the tooltip relative to the target element and applies configured show delays and fade transitions.

var button = new Button { tooltip = "T:Click here to submit" };
void Show(VisualElement target)
Displays the tooltip near the specified target element. Positions the tooltip based on hints in the t...
Definition WindowFrameTooltip.cs:234
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Show() [2/2]

void GWG.WindowFramework.WindowFrameTooltip.Show ( VisualElement target,
Vector2? pointerPosition )
inline

Displays the tooltip near the specified target element or pointer position. Positions the tooltip accurately while ensuring it stays within the visible screen area.

Parameters
targetThe UI element to display the tooltip for.
pointerPositionOptional pointer position for cursor-relative placement.

Computes screen-aware positioning using parent-local coordinate transformation. Flips vertically or horizontally if the tooltip would otherwise exceed container boundaries, and applies smooth frame-based fading according to the active TooltipFadeType. When transitioning from a currently open tooltip on a different element, overrides the hover timer and fade-in animation, immediately displaying the tooltip at full opacity over the new element.

var button = new Button { tooltip = "B:Options menu" };
Vector2 mousePos = evt.mousePosition;
Here is the call graph for this function:

◆ UpdatePosition()

void GWG.WindowFramework.WindowFrameTooltip.UpdatePosition ( VisualElement target,
char hint,
Vector2? pointerPosition )
inlineprivate
Here is the caller graph for this function:

◆ UpdateTheme()

void GWG.WindowFramework.WindowFrameTooltip.UpdateTheme ( List< StyleSheet > sheets,
List< StyleSheet > oldTheme )
inlineprivate

Updates tooltip sheet references when the controller publishes a theme change.

Parameters
sheetsNew composed sheets, or null to add none.
oldThemePublished previous sheets. Nonempty lists are removed individually.

The existing empty oldTheme branch clears the entire tooltip stylesheet set. This differs from the WindowFrame managed-assignment contract and is an audit finding, not recommended consumer code. Documentation work does not silently change that branch.

Here is the caller graph for this function:

Field Documentation

◆ _currentOpacity

float GWG.WindowFramework.WindowFrameTooltip._currentOpacity = 0f
private

◆ _currentTarget

VisualElement GWG.WindowFramework.WindowFrameTooltip._currentTarget
private

◆ _fadeTask

IVisualElementScheduledItem GWG.WindowFramework.WindowFrameTooltip._fadeTask
private

◆ _label

Label GWG.WindowFramework.WindowFrameTooltip._label
private

◆ _showTask

IVisualElementScheduledItem GWG.WindowFramework.WindowFrameTooltip._showTask
private

◆ _targetDetachCallback

EventCallback<DetachFromPanelEvent> GWG.WindowFramework.WindowFrameTooltip._targetDetachCallback
private

◆ _tooltipFadeType

TooltipFadeType GWG.WindowFramework.WindowFrameTooltip._tooltipFadeType
private

Property Documentation

◆ CurrentTarget

VisualElement GWG.WindowFramework.WindowFrameTooltip.CurrentTarget
get

Gets the VisualElement target for which the tooltip is currently displayed or scheduled.

Tracks the element currently owning the active tooltip. Returns null when the tooltip is closed.

{
// Tooltip is active for myButton
}
VisualElement CurrentTarget
Gets the VisualElement target for which the tooltip is currently displayed or scheduled.
Definition WindowFrameTooltip.cs:88

◆ IsOpen

bool GWG.WindowFramework.WindowFrameTooltip.IsOpen
get

Gets whether a target exists, visibility is Visible and current opacity is greater than zero.

Pending cold-start requests at zero opacity return false even though CurrentTarget is set. This is an appearance-state query, not a scheduler-completion or input-interactivity guarantee.

{
Debug.Log("Tooltip is currently open");
}
bool IsOpen
Gets whether a target exists, visibility is Visible and current opacity is greater than zero.
Definition WindowFrameTooltip.cs:105