pub struct TabLayer { /* private fields */ }
Expand description
A view similar to TabDialog
but it fills up all the available space
Best used with Cursive::add_fullscreen_layer()
Implementations§
Source§impl TabLayer
impl TabLayer
Add a new button to the view
Add a new button to the view
Chainable variant
Add a button to close the view
Add a button to close the view
Chainable variant
Add buttons to cycle through the tabs
Add buttons to cycle through the tabs
Chainable variant
Add a button to remove the current tab
Add a button to remove the current tab
Chainable variant
Set the alignment of the buttons
Set the alignment of the buttons
Chainable variant
Sourcepub fn set_title_align(&mut self, align: HAlign)
pub fn set_title_align(&mut self, align: HAlign)
Set the alignment of the buttons
Sourcepub fn title_align(self, align: HAlign) -> Self
pub fn title_align(self, align: HAlign) -> Self
Set the alignment of the buttons
Chainable variant
Remove all the buttons
Sourcepub fn cur_view_mut(&mut self) -> Option<&mut BoxedView>
pub fn cur_view_mut(&mut self) -> Option<&mut BoxedView>
Mutable version of cur_view()
Sourcepub fn cur_title(&self) -> &str
pub fn cur_title(&self) -> &str
The current tab title
Returns an empty string if the tab dialog is empty
Sourcepub fn views_mut(&mut self) -> TabIterMut<'_>
pub fn views_mut(&mut self) -> TabIterMut<'_>
Mutable version of views()
Sourcepub fn set_cur_tab(&mut self, id: usize)
pub fn set_cur_tab(&mut self, id: usize)
Set the current tab by ID
Sourcepub fn add_tab<V: View>(&mut self, title: &str, view: V) -> usize
pub fn add_tab<V: View>(&mut self, title: &str, view: V) -> usize
Add a new view tab and returns the ID of the new tab
Sourcepub fn tab<V: View>(self, title: &str, view: V) -> TabLayer
pub fn tab<V: View>(self, title: &str, view: V) -> TabLayer
Add a new view tab
Chainable version
Sourcepub fn remove_tab(&mut self, id: usize)
pub fn remove_tab(&mut self, id: usize)
Delete tab by ID
Trait Implementations§
Source§impl View for TabLayer
impl View for TabLayer
Source§fn draw(&self, printer: &Printer<'_, '_>)
fn draw(&self, printer: &Printer<'_, '_>)
Source§fn layout(&mut self, size: Vec2)
fn layout(&mut self, size: Vec2)
Source§fn take_focus(&mut self, source: Direction) -> Result<EventResult, CannotFocus>
fn take_focus(&mut self, source: Direction) -> Result<EventResult, CannotFocus>
Source§fn on_event(&mut self, event: Event) -> EventResult
fn on_event(&mut self, event: Event) -> EventResult
Source§fn required_size(&mut self, constraint: Vec2) -> Vec2
fn required_size(&mut self, constraint: Vec2) -> Vec2
Source§fn needs_relayout(&self) -> bool
fn needs_relayout(&self) -> bool
Source§fn focus_view(
&mut self,
sel: &Selector<'_>,
) -> Result<EventResult, ViewNotFound>
fn focus_view( &mut self, sel: &Selector<'_>, ) -> Result<EventResult, ViewNotFound>
Source§fn call_on_any(&mut self, sel: &Selector<'_>, cb: AnyCb<'_>)
fn call_on_any(&mut self, sel: &Selector<'_>, cb: AnyCb<'_>)
Auto Trait Implementations§
impl Freeze for TabLayer
impl !RefUnwindSafe for TabLayer
impl Send for TabLayer
impl Sync for TabLayer
impl Unpin for TabLayer
impl !UnwindSafe for TabLayer
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
Source§impl<T> Finder for Twhere
T: View,
impl<T> Finder for Twhere
T: View,
Source§fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)
sel
. Read moreSource§fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>
sel
. Read moreSource§fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
fn call_on_name<V, F, R>(&mut self, name: &str, callback: F) -> Option<R>
call_on
with a view::Selector::Name
.Source§impl<T> IntoBoxedView for Twhere
T: View,
impl<T> IntoBoxedView for Twhere
T: View,
Source§fn into_boxed_view(self) -> Box<dyn View>
fn into_boxed_view(self) -> Box<dyn View>
Box<View>
.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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.Source§impl<T> Resizable for Twhere
T: View,
impl<T> Resizable for Twhere
T: View,
Source§fn resized(
self,
width: SizeConstraint,
height: SizeConstraint,
) -> ResizedView<Self>
fn resized( self, width: SizeConstraint, height: SizeConstraint, ) -> ResizedView<Self>
self
in a ResizedView
with the given size constraints.Source§fn fixed_size<S>(self, size: S) -> ResizedView<Self>
fn fixed_size<S>(self, size: S) -> ResizedView<Self>
self
into a fixed-size ResizedView
.Source§fn fixed_width(self, width: usize) -> ResizedView<Self>
fn fixed_width(self, width: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn fixed_height(self, height: usize) -> ResizedView<Self>
fn fixed_height(self, height: usize) -> ResizedView<Self>
self
into a fixed-width ResizedView
.Source§fn full_screen(self) -> ResizedView<Self>
fn full_screen(self) -> ResizedView<Self>
self
into a full-screen ResizedView
.Source§fn full_width(self) -> ResizedView<Self>
fn full_width(self) -> ResizedView<Self>
self
into a full-width ResizedView
.Source§fn full_height(self) -> ResizedView<Self>
fn full_height(self) -> ResizedView<Self>
self
into a full-height ResizedView
.Source§fn max_size<S>(self, size: S) -> ResizedView<Self>
fn max_size<S>(self, size: S) -> ResizedView<Self>
self
into a limited-size ResizedView
.Source§fn max_width(self, max_width: usize) -> ResizedView<Self>
fn max_width(self, max_width: usize) -> ResizedView<Self>
self
into a limited-width ResizedView
.Source§fn max_height(self, max_height: usize) -> ResizedView<Self>
fn max_height(self, max_height: usize) -> ResizedView<Self>
self
into a limited-height ResizedView
.Source§fn min_size<S>(self, size: S) -> ResizedView<Self>
fn min_size<S>(self, size: S) -> ResizedView<Self>
self
into a ResizedView
at least sized size
.Source§fn min_width(self, min_width: usize) -> ResizedView<Self>
fn min_width(self, min_width: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_width
wide.Source§fn min_height(self, min_height: usize) -> ResizedView<Self>
fn min_height(self, min_height: usize) -> ResizedView<Self>
self
in a ResizedView
at least min_height
tall.Source§impl<T> Scrollable for Twhere
T: View,
impl<T> Scrollable for Twhere
T: View,
Source§fn scrollable(self) -> ScrollView<Self>
fn scrollable(self) -> ScrollView<Self>
self
in a ScrollView
.