pub struct TooltipTrigger { /* private fields */ }Expand description
The trigger side of a managed tooltip, for a component that owns its own hover listener (GPUI allows one per element).
Record the trigger’s bounds with track_bounds,
forward the hover listener to hovered, and call
pressed on mouse down. In a window with no registered
overlay use native as GPUI’s tooltip builder instead.
Button shows the intended use.
Implementations§
Source§impl TooltipTrigger
impl TooltipTrigger
Sourcepub fn new(
owner: ElementId,
placement: Option<Placement>,
build: impl Fn(&mut App) -> AnyView + 'static,
) -> Self
pub fn new( owner: ElementId, placement: Option<Placement>, build: impl Fn(&mut App) -> AnyView + 'static, ) -> Self
A trigger owned by the element owner, building build when shown.
The owner id is stable across frames, and only the trigger that
asked for the tooltip hides it on leave.
Sourcepub fn text(
owner: ElementId,
placement: Option<Placement>,
text: SharedString,
) -> Self
pub fn text( owner: ElementId, placement: Option<Placement>, text: SharedString, ) -> Self
A trigger for a Tooltip with text.
Sourcepub fn track_bounds(
&self,
) -> impl Fn(Bounds<Pixels>, &mut Window, &mut App) + 'static
pub fn track_bounds( &self, ) -> impl Fn(Bounds<Pixels>, &mut Window, &mut App) + 'static
The prepaint callback that records the trigger’s bounds.
Auto Trait Implementations§
impl !RefUnwindSafe for TooltipTrigger
impl !Send for TooltipTrigger
impl !Sync for TooltipTrigger
impl !UnwindSafe for TooltipTrigger
impl Freeze for TooltipTrigger
impl Unpin for TooltipTrigger
impl UnsafeUnpin for TooltipTrigger
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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> ⓘ
Converts
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> ⓘ
Converts
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 more