Skip to main content

TabInfo

Struct TabInfo 

Source
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

Source

pub fn new() -> Self

Empty defaults: no title, no icon, no tooltip, not closable, not pinned, enabled.

Source

pub fn context_menu( self, f: impl Fn(Point, &mut EventContext<'_>) -> Option<Box<dyn Widget>> + 'static, ) -> Self

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.

Source

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).

Source

pub fn no_title(self) -> Self

Untitled — useful for icon-only tabs even when not pinned.

Source

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.

Source

pub fn tooltip(self, t: impl Into<LocalizedString>) -> Self

Tooltip text shown on hover. If unset and the tab is pinned, the framework promotes title to the tooltip — pinned tabs render icon-only and otherwise have no way for the user to identify them.

Source

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.

Source

pub fn rich_tooltip_content(self, content: TooltipContent) -> Self

Attach a rich tooltip driven by inline TooltipContent.

Source

pub fn composite_tooltip<W>(self, factory: impl Fn() -> W + 'static) -> Self
where 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.

Source

pub fn closable(self, b: bool) -> Self

Whether the tab shows a close button + responds to middle-click. Default: false.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for TabInfo

Source§

fn clone(&self) -> TabInfo

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TabInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TabInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: 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.
§

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.
§

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.
§

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.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more