pub struct TabViewState {
pub selected_index: usize,
pub total_tabs: usize,
pub scroll_offset: usize,
pub tab_bar_focused: bool,
pub focus_id: FocusId,
pub focused: bool,
}Expand description
State for the tab view component
Fields§
§selected_index: usizeCurrently selected tab index
total_tabs: usizeTotal number of tabs
scroll_offset: usizeScroll offset for overflow tabs
tab_bar_focused: boolWhether the tab bar has focus (vs content)
focus_id: FocusIdFocus ID for focus management
focused: boolWhether this component has focus
Implementations§
Source§impl TabViewState
impl TabViewState
Sourcepub fn with_focus_id(total_tabs: usize, focus_id: FocusId) -> Self
pub fn with_focus_id(total_tabs: usize, focus_id: FocusId) -> Self
Create a new tab view state with a specific focus ID
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Select the next tab
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Select the previous tab
Sourcepub fn select_first(&mut self)
pub fn select_first(&mut self)
Select the first tab
Sourcepub fn select_last(&mut self)
pub fn select_last(&mut self)
Select the last tab
Sourcepub fn toggle_focus(&mut self)
pub fn toggle_focus(&mut self)
Toggle focus between tab bar and content
Sourcepub fn ensure_visible(&mut self, visible_count: usize)
pub fn ensure_visible(&mut self, visible_count: usize)
Ensure the selected tab is visible within the viewport
Trait Implementations§
Source§impl Clone for TabViewState
impl Clone for TabViewState
Source§fn clone(&self) -> TabViewState
fn clone(&self) -> TabViewState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TabViewState
impl Debug for TabViewState
Source§impl Default for TabViewState
impl Default for TabViewState
Source§impl Focusable for TabViewState
impl Focusable for TabViewState
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Returns true if this component currently has focus.
Source§fn set_focused(&mut self, focused: bool)
fn set_focused(&mut self, focused: bool)
Set the focus state of this component.
Source§fn focused_style(&self) -> Style
fn focused_style(&self) -> Style
Returns the style to use when this component has focus. Read more
Source§fn unfocused_style(&self) -> Style
fn unfocused_style(&self) -> Style
Returns the style to use when this component does not have focus. Read more
Source§fn current_style(&self) -> Style
fn current_style(&self) -> Style
Returns the current style based on focus state. Read more
Auto Trait Implementations§
impl Freeze for TabViewState
impl RefUnwindSafe for TabViewState
impl Send for TabViewState
impl Sync for TabViewState
impl Unpin for TabViewState
impl UnwindSafe for TabViewState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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