Struct TooltipHost
pub struct TooltipHost { /* private fields */ }Expand description
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.
Implementations§
§impl TooltipHost
impl TooltipHost
pub fn new() -> TooltipHost
pub fn with_dwell(self, dwell: Duration) -> TooltipHost
pub fn on_pointer(
&mut self,
target: Option<(Rect, String)>,
now: Instant,
) -> bool
pub fn on_pointer( &mut self, target: Option<(Rect, String)>, now: Instant, ) -> bool
Re-hovering the same region keeps the accumulated dwell (so a
jittering pointer still reveals); moving to a different region
restarts it. Returns true when the caller should request a redraw.
pub fn refresh(&mut self, target: Option<(Rect, String)>)
pub fn refresh(&mut self, target: Option<(Rect, String)>)
What the region under a shown tooltip says now: a new label for the same region replaces the shown one without restarting the dwell; the region gone or moved hides it.
pub fn dismiss(&mut self) -> bool
pub fn dismiss(&mut self) -> bool
Returns whether anything was showing/pending, so the caller can request a redraw to clear the chip.
pub fn visible(&self) -> Option<(&str, Rect)>
pub fn visible(&self) -> Option<(&str, Rect)>
The label is the raw string the region exposed; the caller resolves
i18n and renders via draw_hover_tooltip.
pub fn needs_frame(&self) -> bool
Trait Implementations§
§impl Debug for TooltipHost
impl Debug for TooltipHost
§impl Default for TooltipHost
impl Default for TooltipHost
§fn default() -> TooltipHost
fn default() -> TooltipHost
Auto Trait Implementations§
impl Freeze for TooltipHost
impl RefUnwindSafe for TooltipHost
impl Send for TooltipHost
impl Sync for TooltipHost
impl Unpin for TooltipHost
impl UnsafeUnpin for TooltipHost
impl UnwindSafe for TooltipHost
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more