[][src]Struct cursive_tabs::TabPanel

pub struct TabPanel<K: Hash + Eq + Display + Copy + 'static> { /* fields omitted */ }

The TabPanel is an ease of use wrapper around a TabView and its TabBar. Additionally the TabBar in the Panel can be horizontally aligned, by default it is set to be left aligned.

Example

use cursive_tabs::TabPanel;
use cursive::views::TextView;
use cursive::align::HAlign;

let mut tabs = TabPanel::new()
      .with_tab("First", TextView::new("First"))
      .with_tab("Second", TextView::new("Second"))
      .with_bar_alignment(HAlign::Center);

A TabView is also usable separately, so if you prefer the tabs without the TabBar and Panel around have a look at TabView.

Methods

impl<K: Hash + Eq + Copy + Display + 'static> TabPanel<K>[src]

pub fn new() -> Self[src]

Returns a new instance of a TabPanel. Alignment is set by default to left, to change this use set_bar_alignment to change to any other HAlign provided by cursive.

pub fn active_tab(&self) -> Option<K>[src]

Returns the current active tab of the TabView. Note: Calls active_tab on the enclosed TabView.

pub fn set_active_tab(&mut self, id: K) -> Result<(), ()>[src]

Non-consuming variant to set the active tab in the TabView. Note: Calls set_active_tab on the enclosed TabView.

pub fn with_active_tab(self, id: K) -> Result<Self, ()>[src]

Consuming & Chainable variant to set the active tab in the TabView. Note: Calls set_active_tab on the enclosed TabView.

Be careful! Failure in this case means the panel get dropped this has to with some trait restrictions in cursive, at the moment just avoid using the chainable variant if you are unsure that the operation will succeed.

pub fn add_tab<T: View>(&mut self, id: K, view: T)[src]

Non-consuming variant to add new tabs to the TabView. Note: Calls add_tab on the enclosed TabView.

pub fn with_tab<T: View>(self, id: K, view: T) -> Self[src]

Consuming & Chainable variant to add a new tab. Note: Calls add_tab on the enclosed TabView.

pub fn remove_tab(&mut self, id: K) -> Result<(), ()>[src]

Remove a tab of the enclosed TabView.

pub fn next(&mut self)[src]

Proceeds to the next view in order of addition.

pub fn prev(&mut self)[src]

Go back to the previous view in order of addition.

pub fn with_bar_alignment(self, align: HAlign) -> Self[src]

Consumable & Chainable variant to set the bar alignment.

pub fn set_bar_alignment(&mut self, align: HAlign)[src]

Non-consuming variant to set the bar alignment.

pub fn tab_order(&self) -> Vec<K>[src]

Returns the current order of tabs as an Vector with the keys of the views.

Trait Implementations

impl<K: Hash + Eq + Copy + Display + 'static> View for TabPanel<K>[src]

Auto Trait Implementations

impl<K> !Send for TabPanel<K>

impl<K> Unpin for TabPanel<K> where
    K: Unpin

impl<K> !Sync for TabPanel<K>

impl<K> !UnwindSafe for TabPanel<K>

impl<K> !RefUnwindSafe for TabPanel<K>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> View for T where
    T: ViewWrapper
[src]

impl<T> Finder for T where
    T: View
[src]

impl<T> Scrollable for T where
    T: View
[src]

impl<T> Identifiable for T where
    T: View
[src]

impl<T> With for T[src]

impl<T> Boxable for T where
    T: View
[src]

impl<T> AnyView for T where
    T: View
[src]

fn as_any(&self) -> &(dyn Any + 'static)[src]

Downcast self to a Any.

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

Downcast self to a mutable Any.

impl<T> IntoBoxedView for T where
    T: View
[src]

impl<T> Erased for T