Skip to main content

Module tooltip

Module tooltip 

Expand description

Tooltip primitive — a small label revealed after a short hover delay.

on_hover_enter/on_hover_leave/tick drive the timing state so the primitive is unit-testable without a winit event loop or a wall clock.

Structs§

Tooltip
TooltipHost
One controller owned by crate::app::App — not one tooltip widget per control — is what makes tooltips work for every widget exposing Widget::tooltip with zero per-app wiring, and guarantees at most one chip on screen. Timing is wall-clock through an injected now: Instant, so it’s unit-testable.

Enums§

TooltipSide
Which side of its control a tooltip prefers. A control in a row has its neighbours beside it, so its chip goes below; one in a vertical rail has them above and below, so its chip goes beside it, where it hides none of them.

Constants§

DEFAULT_DELAY
HOVER_DWELL
Middle of the 400-600ms comfort band: shows help promptly on a deliberate hover without firing on a pointer merely passing through.

Functions§

chip_paint_bounds
Every pixel draw_chip can paint for a chip at rect: the chip, its edge and snapping, and the floating shadow under it.
chip_rect
Preferred placement is centred just below the anchor; flips above if that would spill past the bottom edge, and clamps to the bottom edge if neither side has room. Clamped horizontally too, so a control at the far edge gets a chip that hugs it instead of painting off-screen.
chip_rect_on
chip_rect on the preferred side of the anchor.
chip_size
The chip’s size for label: wrapped Caption text plus the chip’s pads.
chip_size_in_viewport
Measure the complete hint at the width its viewport can actually hold.
draw_chip
The floating material every floating surface is made of (blurred where the renderer runs the backdrop pass, the opaque panel ground otherwise), with the panel edge, at the control radius: a tooltip is a small floating Panel, not a card.
draw_hover_tooltip
Composes chip_size, chip_rect and draw_chip — the one call TooltipHost uses to render a tooltip.
draw_hover_tooltip_on
draw_hover_tooltip on the side of its anchor the control prefers.
hover_chip_rect_on
Where draw_hover_tooltip_on places the chip for label.