pub struct Tooltip { /* private fields */ }Expand description
A transient plain or rich Material tooltip, or a persistent rich tooltip with caller-owned visibility.
Implementations§
Source§impl Tooltip
impl Tooltip
Sourcepub fn plain(
id: impl Into<ElementId>,
trigger: impl IntoElement,
text: impl Into<SharedString>,
) -> Self
pub fn plain( id: impl Into<ElementId>, trigger: impl IntoElement, text: impl Into<SharedString>, ) -> Self
Creates a plain tooltip anchored to trigger with the given descriptive text.
Sourcepub fn rich(
id: impl Into<ElementId>,
trigger: impl IntoElement,
title: impl Into<SharedString>,
text: impl Into<SharedString>,
) -> Self
pub fn rich( id: impl Into<ElementId>, trigger: impl IntoElement, title: impl Into<SharedString>, text: impl Into<SharedString>, ) -> Self
Creates a rich tooltip anchored to trigger with a title and body text.
Sourcepub fn shortcut(self, text: impl Into<SharedString>) -> Self
pub fn shortcut(self, text: impl Into<SharedString>) -> Self
Appends a subtle formatted desktop shortcut hint beside plain tooltip text or in a rich tooltip header/body while keeping the constructor’s text as the accessible description.
Sourcepub fn action(
self,
label: impl Into<SharedString>,
focus: &FocusHandle,
callback: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn action( self, label: impl Into<SharedString>, focus: &FocusHandle, callback: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Adds a text button to a rich tooltip.
Sourcepub fn title_content(self, content: impl IntoElement) -> Self
pub fn title_content(self, content: impl IntoElement) -> Self
Replaces the rich tooltip title with custom content.
Sourcepub fn body_content(self, content: impl IntoElement) -> Self
pub fn body_content(self, content: impl IntoElement) -> Self
Replaces the tooltip body text with custom content while keeping the constructor text as the accessible description.
Sourcepub fn action_content(self, content: impl IntoElement) -> Self
pub fn action_content(self, content: impl IntoElement) -> Self
Replaces the standard action with caller-authored interactive content.
Sourcepub fn link(
self,
label: impl Into<SharedString>,
callback: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn link( self, label: impl Into<SharedString>, callback: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Adds a semantic link. The callback owns the destination and navigation.
Sourcepub fn show_delay(self, delay: Duration) -> Self
pub fn show_delay(self, delay: Duration) -> Self
Overrides the pointer hover delay before showing a transient tooltip (default 500 ms).
Sourcepub fn hide_delay(self, delay: Duration) -> Self
pub fn hide_delay(self, delay: Duration) -> Self
Overrides the pointer leave grace delay before hiding a transient tooltip (default 200 ms).
Sourcepub fn track_focus(self, focus: &FocusHandle) -> Self
pub fn track_focus(self, focus: &FocusHandle) -> Self
Uses the trigger’s focus handle for keyboard activation and restoration.
Sourcepub fn focus_target(self, focus: &FocusHandle) -> Self
pub fn focus_target(self, focus: &FocusHandle) -> Self
Uses the caller’s first focus target inside the tooltip.
Sourcepub fn focusable(self, focusable: bool) -> Self
pub fn focusable(self, focusable: bool) -> Self
Moves focus to the tooltip when it opens. The default preserves focus.
Sourcepub fn enable_user_input(self, enable: bool) -> Self
pub fn enable_user_input(self, enable: bool) -> Self
Enables automatic trigger input for the chosen visibility mode.
Sourcepub fn persistent(self, state: &Entity<TooltipState>) -> Self
pub fn persistent(self, state: &Entity<TooltipState>) -> Self
Uses caller-owned visibility for a persistent rich tooltip.
Sourcepub fn on_dismiss_request(
self,
callback: impl Fn(&mut Window, &mut App) + 'static,
) -> Self
pub fn on_dismiss_request( self, callback: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Handles Escape or a persistent tooltip’s outside press. A persistent tooltip with a handler closes when the owner accepts the request.
Sourcepub fn placement(self, placement: TooltipPlacement) -> Self
pub fn placement(self, placement: TooltipPlacement) -> Self
Sets the preferred side relative to the trigger (default TooltipPlacement::Above).
Sourcepub fn offset(self, offset: Pixels) -> Self
pub fn offset(self, offset: Pixels) -> Self
Gap between the trigger and surface in logical pixels.
Sourcepub fn positioner(
self,
positioner: impl Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner + 'static,
) -> Self
pub fn positioner( self, positioner: impl Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner + 'static, ) -> Self
Replaces the standard placement with a positioner built from the trigger bounds, viewport size, and direction. The host applies viewport margins.
Sourcepub fn caret(self, caret: TooltipCaret) -> Self
pub fn caret(self, caret: TooltipCaret) -> Self
Renders a pointer caret pointing toward the trigger.
Sourcepub fn max_width(self, width: Pixels) -> Self
pub fn max_width(self, width: Pixels) -> Self
Overrides the maximum width of the tooltip surface in logical pixels.
Sourcepub fn shape(self, shape: CornerShape) -> Self
pub fn shape(self, shape: CornerShape) -> Self
Overrides the corner shape of the tooltip surface.
Sourcepub fn colors(self, colors: TooltipColors) -> Self
pub fn colors(self, colors: TooltipColors) -> Self
Overrides the tooltip’s container, content, title, and action colors.
Sourcepub fn tonal_elevation(self, elevation: Elevation) -> Self
pub fn tonal_elevation(self, elevation: Elevation) -> Self
Sets the tonal elevation used to tint the tooltip surface.
Sourcepub fn shadow_elevation(self, elevation: Elevation) -> Self
pub fn shadow_elevation(self, elevation: Elevation) -> Self
Overrides the shadow elevation cast by the tooltip surface.
Trait Implementations§
Source§impl IntoElement for Tooltip
impl IntoElement for Tooltip
Source§type Element = ViewElement<Tooltip>
type Element = ViewElement<Tooltip>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for Tooltip
impl RenderOnce for Tooltip
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for Tooltip
impl !Send for Tooltip
impl !Sync for Tooltip
impl !UnwindSafe for Tooltip
impl Forget for Tooltip
impl Freeze for Tooltipwhere
NonZero<u32>: Freeze,
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const ArcInner<Path> is !null: Freeze,
PhantomData<ArcInner<Path>>: Freeze,
*const str is !null: Freeze,
PhantomData<&'static str>: Freeze,
*const ArcInner<ElementId> is !null: Freeze,
PhantomData<ArcInner<ElementId>>: Freeze,
*mut dyn ElementObject: Freeze,
*const RcInner<Cell<bool>> is !null: Freeze,
PhantomData<RcInner<Cell<bool>>>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
*const RcInner<dyn Fn(&mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut Window, &mut App)>>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(TooltipState) -> TooltipState>: Freeze,
*const dyn Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner is !null: Freeze,
PhantomData<dyn Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner>: Freeze,
*const dyn Fn(Bounds<Pixels>, TooltipPlacement) -> Option<Path> is !null: Freeze,
PhantomData<dyn Fn(Bounds<Pixels>, TooltipPlacement) -> Option<Path>>: Freeze,
impl Move for Tooltip
impl Unpin for Tooltipwhere
NonZero<u32>: Unpin,
&'static str: Unpin,
Arc<str>: Unpin,
Arc<Path>: Unpin,
*const str is !null: Unpin,
Arc<ElementId>: Unpin,
*mut dyn ElementObject: Unpin,
Rc<Cell<bool>>: Unpin,
Arc<RwLock<RawRwLock, FocusMap>>: Unpin,
Rc<dyn Fn(&mut Window, &mut App)>: Unpin,
*const (): Unpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Unpin,
Box<dyn Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner>: Unpin,
Box<dyn Fn(Bounds<Pixels>, TooltipPlacement) -> Option<Path>>: Unpin,
impl UnsafeUnpin for Tooltipwhere
NonZeroU32Inner: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const ArcInner<Path> is !null: UnsafeUnpin,
PhantomData<ArcInner<Path>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<&'static str>: UnsafeUnpin,
*const ArcInner<ElementId> is !null: UnsafeUnpin,
PhantomData<ArcInner<ElementId>>: UnsafeUnpin,
*mut dyn ElementObject: UnsafeUnpin,
*const RcInner<Cell<bool>> is !null: UnsafeUnpin,
PhantomData<RcInner<Cell<bool>>>: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut Window, &mut App)>>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(TooltipState) -> TooltipState>: UnsafeUnpin,
*const dyn Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner is !null: UnsafeUnpin,
PhantomData<dyn Fn(Bounds<Pixels>, Size<Pixels>, Direction) -> TooltipPositioner>: UnsafeUnpin,
*const dyn Fn(Bounds<Pixels>, TooltipPlacement) -> Option<Path> is !null: UnsafeUnpin,
PhantomData<dyn Fn(Bounds<Pixels>, TooltipPlacement) -> Option<Path>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(
self,
text: impl Into<SharedString>,
) -> ObservedText<Self::Element>
fn test_alt_text( self, text: impl Into<SharedString>, ) -> ObservedText<Self::Element>
Self::test_text for an image’s alternative text, which
stands in for what the element draws.