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: TabViewSelectionChangedRequests selection changes from pointer, keyboard and collection reconciliation.
tab_width_mode: TabViewWidthModeHow the available strip width is allocated to headers.
When closable tabs expose their close button.
tab_strip_header: Option<WidgetRef>Optional content before the first tab.
Optional content following the add button, stretched into remaining space.
Whether the add-tab button is displayed.
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: boolAllows drag events and drops into another tab strip; defaults to false.
can_reorder_tabs: boolEnables pointer and Alt+Shift+arrow reordering; defaults to true.
allow_drop_tabs: boolAllows 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
impl TabView
Sourcepub fn can_drag_tabs(self, value: bool) -> Self
pub fn can_drag_tabs(self, value: bool) -> Self
Controls whether drag events and cross-strip transfers are enabled.
Sourcepub fn can_reorder_tabs(self, value: bool) -> Self
pub fn can_reorder_tabs(self, value: bool) -> Self
Controls pointer and Alt+Shift+arrow reordering within this strip.
Sourcepub fn allow_drop_tabs(self, value: bool) -> Self
pub fn allow_drop_tabs(self, value: bool) -> Self
Controls whether incoming pointer drops can be accepted.
Sourcepub fn tab_reorder_requested(
self,
callback: impl Fn(&mut App, TabViewReorderRequestedEventArgs) + 'static,
) -> Self
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.
Sourcepub fn tab_drag_feedback_builder(
self,
builder: impl Fn(&mut App, &TabViewItem, f64) -> WidgetRef + 'static,
) -> Self
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.
Sourcepub fn tab_drag_starting(
self,
callback: impl Fn(&mut App, &mut TabViewTabDragStartingEventArgs) + 'static,
) -> Self
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.
Sourcepub fn tab_drag_completed(
self,
callback: impl Fn(&mut App, TabViewTabDragCompletedEventArgs) + 'static,
) -> Self
pub fn tab_drag_completed( self, callback: impl Fn(&mut App, TabViewTabDragCompletedEventArgs) + 'static, ) -> Self
Receives completion of an externally enabled drag.
Sourcepub fn tab_dropped_outside(
self,
callback: impl Fn(&mut App, TabViewItem) + 'static,
) -> Self
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.
Sourcepub fn tab_strip_drag_over(
self,
callback: impl Fn(&mut App, &mut TabViewTabStripDropEventArgs) + 'static,
) -> Self
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.
Sourcepub fn tab_strip_drop(
self,
callback: impl Fn(&mut App, TabViewTabStripDropEventArgs) + 'static,
) -> Self
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
impl TabView
Sourcepub fn new(
items: Vec<TabViewItem>,
selected_index: Option<usize>,
selection_changed: impl Fn(&mut App, Option<usize>) + 'static,
) -> Self
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.
Sourcepub fn tab_width_mode(self, mode: TabViewWidthMode) -> Self
pub fn tab_width_mode(self, mode: TabViewWidthMode) -> Self
Selects Equal, SizeToContent or Compact header allocation.
Sets close-button visibility policy.
Sourcepub fn tab_strip_header<K>(self, child: impl IntoWidget<K>) -> Self
pub fn tab_strip_header<K>(self, child: impl IntoWidget<K>) -> Self
Supplies the leading strip content.
Supplies the trailing strip content.
Controls visibility of the add-tab button.
Receives activation of the add-tab button.
Sourcepub fn tab_close_requested(self, callback: TabViewTabCloseRequested) -> Self
pub fn tab_close_requested(self, callback: TabViewTabCloseRequested) -> Self
Receives requests to close individual tabs.
Sourcepub fn selected_item(&self) -> Option<&TabViewItem>
pub fn selected_item(&self) -> Option<&TabViewItem>
Returns the selected item if its index is in range.
Trait Implementations§
Source§impl StatefulWidget for TabView
impl StatefulWidget for TabView
Source§type State = TabViewState
type State = TabViewState
Source§fn create_state(&self) -> Self::State
fn create_state(&self) -> Self::State
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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 as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 TabViewwhere
*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 TabViewwhere
Rc<dyn Key>: Unpin,
*const u8 is !null: Unpin,
Rc<dyn Widget>: Unpin,
Rc<dyn Fn(&mut App)>: Unpin,
NonZero<u32>: Unpin,
*const (): Unpin,
Rc<dyn Fn(&mut App, Option<usize>)>: Unpin,
Rc<dyn Fn(&mut App, TabViewTabCloseRequestedEventArgs)>: Unpin,
Rc<dyn Fn(&mut App, TabViewReorderRequestedEventArgs)>: Unpin,
Rc<dyn Fn(&mut App, &TabViewItem, f64) -> Rc<dyn Widget>>: Unpin,
Rc<dyn Fn(&mut App, &mut TabViewTabDragStartingEventArgs)>: Unpin,
Rc<dyn Fn(&mut App, TabViewTabDragCompletedEventArgs)>: Unpin,
Rc<dyn Fn(&mut App, TabViewItem)>: Unpin,
Rc<dyn Fn(&mut App, &mut TabViewTabStripDropEventArgs)>: Unpin,
Rc<dyn Fn(&mut App, TabViewTabStripDropEventArgs)>: Unpin,
impl UnsafeUnpin for TabViewwhere
*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> 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,
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.