Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tooltip ¶
type Tooltip struct {
// Contextual gives it a context menu (Context).
elements.Contextual
// contains filtered or unexported fields
}
Tooltip is a stateful tooltip wrapping trigger: hovering trigger with a mouse, or long-pressing it on a touch screen, shows content in a small panel anchored just below it, rendered above everything else via elements.RegisterPortal. After a long-press the tooltip stays for a moment once the finger lifts. Create it once with New and lay it out every frame in trigger's place.
func New ¶
New wraps trigger with a tooltip showing content on hover or long-press. The styles argument is optional: Background and Color style the panel, FontSize its text.
func (*Tooltip) Layout ¶
func (t *Tooltip) Layout(gtx layout.Context) layout.Dimensions
Layout lays out the trigger and, while hovered or long-pressed, queues the tooltip panel as a portal beside it (see Placement).
func (*Tooltip) Placement ¶
Placement chooses the side of the trigger the tooltip shows on: elements.PlaceAuto (the default) shows it below, or above when it wouldn't fit below; PlaceBelow and PlaceAbove keep it on one side.
func (*Tooltip) SetContent ¶
SetContent replaces the tooltip text.