Struct cursive_extras::TabLayer
source · 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 version
Add a button to close the view
Add a button to close the view
Chainable version
Add buttons to cycle through the tabs
Add buttons to cycle through the tabs
Chainable version
Add a button to remove the current tab
Set the alignment of the buttons
Set the alignment of the buttons
Chainable version
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 version
Add a button to remove the current tab
Chainable version
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 !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)where
V: View,
F: FnMut(&mut V),
fn call_on_all<V, F>(&mut self, sel: &Selector<'_>, callback: F)where V: View, F: FnMut(&mut V),
sel
. Read moresource§fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>where
V: View,
F: FnOnce(&mut V) -> R,
fn call_on<V, F, R>(&mut self, sel: &Selector<'_>, callback: F) -> Option<R>where V: View, F: FnOnce(&mut V) -> R,
sel
. Read moresource§impl<T> IntoBoxedView for Twhere
T: View,
impl<T> IntoBoxedView for Twhere T: View,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere R: Read + ReadEndian<P>, P: Default,
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>where
S: Into<XY<usize>>,
fn fixed_size<S>(self, size: S) -> ResizedView<Self>where S: Into<XY<usize>>,
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>where
S: Into<XY<usize>>,
fn max_size<S>(self, size: S) -> ResizedView<Self>where S: Into<XY<usize>>,
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>where
S: Into<XY<usize>>,
fn min_size<S>(self, size: S) -> ResizedView<Self>where S: Into<XY<usize>>,
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
.