pub struct TooltipContent {
pub key: String,
pub text: LocalizedString,
pub more: Option<LocalizedString>,
pub shortcut_label: Option<String>,
pub shortcut_id: Option<&'static str>,
}Expand description
One tooltip content entry.
Every tooltip may optionally carry a long-form “more” body (revealed by the Accordion disclosure inside a sticky rich tooltip) and a keyboard shortcut hint.
A shortcut hint may be supplied two ways: shortcut_label is a
literal override used verbatim, while shortcut_id binds to a
registered shortcut — the tooltip widget reads the effective primary
keystroke from the tree’s
ShortcutRegistry via
ctx.effective_shortcut(id), formats it with format_keystroke, and
refreshes on user rebinds via ctx.shortcut_version(). A
shortcut_label takes precedence over shortcut_id when both are set.
Fields§
§key: StringStable identifier. Referenced from link targets as [label](:key).
text: LocalizedStringPrimary body — rendered through TextWidget with inline markup
enabled, so it may contain further [label](:other-key) links.
more: Option<LocalizedString>Optional long-form content, revealed by the Accordion disclosure
inside a sticky tooltip. Same inline-markup pipeline as text.
shortcut_label: Option<String>Manual shortcut label override (e.g. “Ctrl+Shift+S”). Used
verbatim when set; takes precedence over shortcut_id.
shortcut_id: Option<&'static str>Registered shortcut id — the tooltip renders the effective
primary keystroke from the tree’s
ShortcutRegistry and
tracks user rebinds automatically.
Implementations§
Source§impl TooltipContent
impl TooltipContent
Sourcepub fn new(key: impl Into<String>, text: LocalizedString) -> Self
pub fn new(key: impl Into<String>, text: LocalizedString) -> Self
Build an entry with a primary body and no extras.
Sourcepub fn with_more(self, more: LocalizedString) -> Self
pub fn with_more(self, more: LocalizedString) -> Self
Attach a long-form body revealed by the Accordion disclosure.
Sourcepub fn with_shortcut_label(self, s: impl Into<String>) -> Self
pub fn with_shortcut_label(self, s: impl Into<String>) -> Self
Attach a manual shortcut label override (“Ctrl+Shift+S”,
“Hold ⇧ + drag”, …). Takes precedence over
TooltipContent::for_shortcut.
Sourcepub fn for_shortcut(self, id: &'static str) -> Self
pub fn for_shortcut(self, id: &'static str) -> Self
Bind the tooltip’s trailing chip to a registered shortcut id. The tooltip widget reads the effective primary keystroke from the tree’s shortcut registry and refreshes on user rebinds.
pub fn has_more(&self) -> bool
pub fn has_shortcut(&self) -> bool
Trait Implementations§
Source§impl Clone for TooltipContent
impl Clone for TooltipContent
Auto Trait Implementations§
impl !RefUnwindSafe for TooltipContent
impl !Send for TooltipContent
impl !Sync for TooltipContent
impl !UnwindSafe for TooltipContent
impl Freeze for TooltipContent
impl Unpin for TooltipContent
impl UnsafeUnpin for TooltipContent
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> ErasedDestructor for Twhere
T: 'static,
§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