pub struct TabWidget {
pub tabs: Vec<String>,
pub active: usize,
pub content: Vec<String>,
pub scroll: usize,
}Expand description
Tab widget
Fields§
§tabs: Vec<String>Tab titles
active: usizeActive tab index
content: Vec<String>Tab content
scroll: usizeScroll offset for tab bar
Implementations§
Source§impl TabWidget
impl TabWidget
Sourcepub fn add_tab_with_content(
&mut self,
title: impl Into<String>,
content: impl Into<String>,
)
pub fn add_tab_with_content( &mut self, title: impl Into<String>, content: impl Into<String>, )
Add a tab with content
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Select next tab
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Select previous tab
Sourcepub fn select_tab(&mut self, index: usize)
pub fn select_tab(&mut self, index: usize)
Select tab by index
Sourcepub fn active_tab(&self) -> Option<&String>
pub fn active_tab(&self) -> Option<&String>
Get active tab title
Sourcepub fn active_content(&self) -> Option<&String>
pub fn active_content(&self) -> Option<&String>
Get active tab content
Sourcepub fn set_active_content(&mut self, content: impl Into<String>)
pub fn set_active_content(&mut self, content: impl Into<String>)
Set content for active tab
Sourcepub fn close_active_tab(&mut self)
pub fn close_active_tab(&mut self)
Close active tab
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TabWidget
impl RefUnwindSafe for TabWidget
impl Send for TabWidget
impl Sync for TabWidget
impl Unpin for TabWidget
impl UnwindSafe for TabWidget
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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