pub struct TabInfo { /* private fields */ }Expand description
Per-tab presentation metadata. Build with TabInfo::new and
fluent setters.
let _info = TabInfo::new()
.title(lit!("Welcome"))
.icon(|| IconWidget::checkmark(16.0))
.closable(true);Implementations§
Source§impl TabInfo
impl TabInfo
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty defaults: no title, no icon, no tooltip, not closable, not pinned, enabled.
Attach a per-tab context menu (right-click the tab header). The
factory receives the click position (tab-local) and a full
[EventContext], and returns Some(menu) to mount or None to
decline (falling through to an ancestor). Cloned per header build.
Sourcepub fn title(self, t: impl Into<LocalizedString>) -> Self
pub fn title(self, t: impl Into<LocalizedString>) -> Self
Set the tab’s title. Accepts tr!(...), a literal string,
or any value implementing Into<LocalizedString>.
None means icon-only (the pinned-tab presentation).
Sourcepub fn icon(self, factory: impl Fn() -> IconWidget + 'static) -> Self
pub fn icon(self, factory: impl Fn() -> IconWidget + 'static) -> Self
Set the leading icon via a factory closure. The closure is
called each time the TabHeader
is built — typically once per tab lifetime, plus any rebuild
triggered by data-source mutations.
Sourcepub fn rich_tooltip(self, key: impl Into<String>) -> Self
pub fn rich_tooltip(self, key: impl Into<String>) -> Self
Attach a rich tooltip resolved from the app-wide tooltip
registry. See Button::rich_tooltip.
Sourcepub fn rich_tooltip_content(self, content: TooltipContent) -> Self
pub fn rich_tooltip_content(self, content: TooltipContent) -> Self
Attach a rich tooltip driven by inline TooltipContent.
Sourcepub fn composite_tooltip<W>(self, factory: impl Fn() -> W + 'static) -> Selfwhere
W: Widget + 'static,
pub fn composite_tooltip<W>(self, factory: impl Fn() -> W + 'static) -> Selfwhere
W: Widget + 'static,
Attach a composite tooltip — third tier, hosting an arbitrary
widget tree. The factory closure is called each time the
tab’s header rebuilds, so the body picks up theme / locale
changes naturally without retaining state across rebuilds.
Sourcepub fn closable(self, b: bool) -> Self
pub fn closable(self, b: bool) -> Self
Whether the tab shows a close button + responds to
middle-click. Default: false.
Sourcepub fn pinned(self, b: bool) -> Self
pub fn pinned(self, b: bool) -> Self
Whether the tab renders in the leading pinned strip
(icon-only, fixed-width, no close button — Firefox / Chrome
convention). Default: false.
Sourcepub fn enabled(self, enabled: impl Into<Prop<bool>>) -> Self
pub fn enabled(self, enabled: impl Into<Prop<bool>>) -> Self
Whether the tab can be activated. Disabled tabs render but
are skipped by keyboard navigation, can’t be clicked, and
don’t get the close button. Default: true.
Forwarded to the arena via ctx.enabled_when(header_id, false)
at build time when false. Ancestor-driven disable (e.g. a
disabled TabBar) ANDs with this flag automatically.
Sourcepub fn focusable_panel(self, b: bool) -> Self
pub fn focusable_panel(self, b: bool) -> Self
Make the tab’s content pane itself focusable, so keyboard users
can press Tab from the selected tab header and land inside
the panel.
Opt in for panels you know contain no focusable descendants —
a static text-only “About” tab, a chart-only metrics tab.
Panels that already host a Button, TextInput, ListView,
or any other interactive widget don’t need this: focus will
flow naturally into the descendant.
ARIA: this implements the tabindex="0" requirement that an
empty tabpanel must be focusable so its content can be read
by screen readers in browse mode. AccessKit has no tabindex
field; the framework advertises Action::Focus on the panel
node to signal focusability to AT. Default: false.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TabInfo
impl !Send for TabInfo
impl !Sync for TabInfo
impl !UnwindSafe for TabInfo
impl Freeze for TabInfo
impl Unpin for TabInfo
impl UnsafeUnpin for TabInfo
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