Skip to main content

TabView

Struct TabView 

Source
pub struct TabView {
Show 21 fields pub key: Option<KeyRef>, pub tab_items: Vec<TabViewItem>, pub selected_index: Option<usize>, pub selection_changed: TabViewSelectionChanged, pub tab_width_mode: TabViewWidthMode, pub close_button_overlay_mode: TabViewCloseButtonOverlayMode, pub tab_strip_header: Option<WidgetRef>, pub tab_strip_footer: Option<WidgetRef>, pub is_add_tab_button_visible: bool, pub add_tab_button_click: Option<Listener>, pub tab_close_requested: Option<TabViewTabCloseRequested>, pub can_drag_tabs: bool, pub can_reorder_tabs: bool, pub allow_drop_tabs: bool, pub tab_reorder_requested: Option<TabViewReorderRequested>, pub tab_drag_feedback_builder: Option<TabViewDragFeedbackBuilder>, pub tab_drag_starting: Option<TabViewTabDragStarting>, pub tab_drag_completed: Option<TabViewTabDragCompleted>, pub tab_dropped_outside: Option<TabViewTabDroppedOutside>, pub tab_strip_drag_over: Option<TabViewTabStripDragOver>, pub tab_strip_drop: Option<TabViewTabStripDrop>,
}
Expand description

A tab strip and selected content presenter, with source width and keyboard behavior.

Fields§

§key: Option<KeyRef>

Identity retained when the surrounding widget tree rebuilds.

§tab_items: Vec<TabViewItem>

Tabs in collection order; ids must be unique and stable across moves.

§selected_index: Option<usize>

Index selected by the owner, or no selection.

§selection_changed: TabViewSelectionChanged

Requests selection changes from pointer, keyboard and collection reconciliation.

§tab_width_mode: TabViewWidthMode

How the available strip width is allocated to headers.

§close_button_overlay_mode: TabViewCloseButtonOverlayMode

When closable tabs expose their close button.

§tab_strip_header: Option<WidgetRef>

Optional content before the first tab.

§tab_strip_footer: Option<WidgetRef>

Optional content following the add button, stretched into remaining space.

§is_add_tab_button_visible: bool

Whether the add-tab button is displayed.

§add_tab_button_click: Option<Listener>

Raised when the add-tab button activates; adding the tab remains the owner’s choice.

§tab_close_requested: Option<TabViewTabCloseRequested>

Raised for close-button, middle-click and Ctrl+F4 close requests.

§can_drag_tabs: bool

Allows drag events and drops into another tab strip; defaults to false.

§can_reorder_tabs: bool

Enables pointer and Alt+Shift+arrow reordering; defaults to true.

§allow_drop_tabs: bool

Allows drops onto this tab strip; defaults to true.

§tab_reorder_requested: Option<TabViewReorderRequested>

Requests the owner move an item, preserving the selected identity.

§tab_drag_feedback_builder: Option<TabViewDragFeedbackBuilder>

Builds an independent visual subtree for native drag feedback.

The feedback must not reuse GlobalKeys or externally owned focus nodes from the live header.

§tab_drag_starting: Option<TabViewTabDragStarting>

Raised before an externally enabled drag starts; set cancel to prevent it.

§tab_drag_completed: Option<TabViewTabDragCompleted>

Raised after an externally enabled drag ends.

§tab_dropped_outside: Option<TabViewTabDroppedOutside>

Raised when an externally enabled drag finishes without an accepted drop.

§tab_strip_drag_over: Option<TabViewTabStripDragOver>

Decides whether an incoming drag is accepted; the owner sets accepted.

§tab_strip_drop: Option<TabViewTabStripDrop>

Receives accepted cross-strip drops; ownership transfer remains the owner’s responsibility.

Implementations§

Source§

impl TabView

Source

pub fn can_drag_tabs(self, value: bool) -> Self

Controls whether drag events and cross-strip transfers are enabled.

Source

pub fn can_reorder_tabs(self, value: bool) -> Self

Controls pointer and Alt+Shift+arrow reordering within this strip.

Source

pub fn allow_drop_tabs(self, value: bool) -> Self

Controls whether incoming pointer drops can be accepted.

Source

pub fn tab_reorder_requested( self, callback: impl Fn(&mut App, TabViewReorderRequestedEventArgs) + 'static, ) -> Self

Receives a move request; the owner must reorder its collection and reconcile selection.

Source

pub fn tab_drag_feedback_builder( self, builder: impl Fn(&mut App, &TabViewItem, f64) -> WidgetRef + 'static, ) -> Self

Supplies independent feedback for custom headers with keys or externally owned state.

Source

pub fn tab_drag_starting( self, callback: impl Fn(&mut App, &mut TabViewTabDragStartingEventArgs) + 'static, ) -> Self

Receives a cancelable event before an externally enabled drag starts.

Source

pub fn tab_drag_completed( self, callback: impl Fn(&mut App, TabViewTabDragCompletedEventArgs) + 'static, ) -> Self

Receives completion of an externally enabled drag.

Source

pub fn tab_dropped_outside( self, callback: impl Fn(&mut App, TabViewItem) + 'static, ) -> Self

Receives a drag that ended without an accepted in-window target.

Source

pub fn tab_strip_drag_over( self, callback: impl Fn(&mut App, &mut TabViewTabStripDropEventArgs) + 'static, ) -> Self

Allows the destination owner to accept an incoming item.

Source

pub fn tab_strip_drop( self, callback: impl Fn(&mut App, TabViewTabStripDropEventArgs) + 'static, ) -> Self

Transfers an accepted cross-strip payload to the destination owner.

Source§

impl TabView

Source

pub fn new( items: Vec<TabViewItem>, selected_index: Option<usize>, selection_changed: impl Fn(&mut App, Option<usize>) + 'static, ) -> Self

Creates tabs with owner-managed selection, matching the kit’s other value controls.

Source

pub fn key(self, key: KeyRef) -> Self

Sets the identity retained across rebuilds.

Source

pub fn tab_width_mode(self, mode: TabViewWidthMode) -> Self

Selects Equal, SizeToContent or Compact header allocation.

Source

pub fn close_button_overlay_mode( self, mode: TabViewCloseButtonOverlayMode, ) -> Self

Sets close-button visibility policy.

Source

pub fn tab_strip_header<K>(self, child: impl IntoWidget<K>) -> Self

Supplies the leading strip content.

Supplies the trailing strip content.

Source

pub fn is_add_tab_button_visible(self, value: bool) -> Self

Controls visibility of the add-tab button.

Source

pub fn add_tab_button_click(self, callback: Listener) -> Self

Receives activation of the add-tab button.

Source

pub fn tab_close_requested(self, callback: TabViewTabCloseRequested) -> Self

Receives requests to close individual tabs.

Source

pub fn selected_item(&self) -> Option<&TabViewItem>

Returns the selected item if its index is in range.

Trait Implementations§

Source§

impl Clone for TabView

Source§

fn clone(&self) -> Self

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 TabView

Source§

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

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

impl StatefulWidget for TabView

Source§

type State = TabViewState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> Self::State

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for TabView

§

impl !Send for TabView

§

impl !Sync for TabView

§

impl !UnwindSafe for TabView

§

impl Forget for TabView

§

impl Freeze for TabView
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const u8 is !null: Freeze, PhantomData<TabViewItem>: Freeze, *const RcInner<dyn Fn(&mut App, Option<usize>)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, Option<usize>)>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, *const RcInner<dyn Fn(&mut App, TabViewTabCloseRequestedEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, TabViewTabCloseRequestedEventArgs)>>: Freeze, *const RcInner<dyn Fn(&mut App, TabViewReorderRequestedEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, TabViewReorderRequestedEventArgs)>>: Freeze, *const RcInner<dyn Fn(&mut App, &TabViewItem, f64) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &TabViewItem, f64) -> Rc<dyn Widget>>>: Freeze, *const RcInner<dyn Fn(&mut App, &mut TabViewTabDragStartingEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &mut TabViewTabDragStartingEventArgs)>>: Freeze, *const RcInner<dyn Fn(&mut App, TabViewTabDragCompletedEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, TabViewTabDragCompletedEventArgs)>>: Freeze, *const RcInner<dyn Fn(&mut App, TabViewItem)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, TabViewItem)>>: Freeze, *const RcInner<dyn Fn(&mut App, &mut TabViewTabStripDropEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &mut TabViewTabStripDropEventArgs)>>: Freeze, *const RcInner<dyn Fn(&mut App, TabViewTabStripDropEventArgs)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, TabViewTabStripDropEventArgs)>>: Freeze,

§

impl Move for TabView

§

impl Unpin for TabView

§

impl UnsafeUnpin for TabView
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<TabViewItem>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, Option<usize>)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, Option<usize>)>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn Fn(&mut App, TabViewTabCloseRequestedEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, TabViewTabCloseRequestedEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, TabViewReorderRequestedEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, TabViewReorderRequestedEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &TabViewItem, f64) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &TabViewItem, f64) -> Rc<dyn Widget>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &mut TabViewTabDragStartingEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &mut TabViewTabDragStartingEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, TabViewTabDragCompletedEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, TabViewTabDragCompletedEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, TabViewItem)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, TabViewItem)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &mut TabViewTabStripDropEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &mut TabViewTabStripDropEventArgs)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, TabViewTabStripDropEventArgs)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, TabViewTabStripDropEventArgs)>>: UnsafeUnpin,

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

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

Source§

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

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

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

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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<T> Upcast<T> for T

Source§

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