[][src]Struct cursive_tabs::TabView

pub struct TabView<K: Hash> { /* fields omitted */ }

Main struct which manages views

Methods

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

pub fn new() -> Self[src]

Returns a new TabView

Example

let mut tabs = TabView::new();

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

Returns the currently active tab Id.

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

Set the currently active (visible) tab. If the tab id is not known, an error is returned and no action is performed.

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

Set the currently active (visible) tab. If the tab id is not known, an error is returned and no action is performed.

This is the consumable variant.

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

Add a new tab to the tab view. The new tab will be set active and will be the visible tab for this tab view.

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

Add a new tab to the tab view. The new tab will be set active and will be the visible tab for this tab view.

This is the consumable variant.

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

Removes a tab with the given id from the TabView. If the removed tab is active at the moment, the TabView will unfocus it and the focus needs to be set manually afterwards, or a new view has to be inserted.

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

Returns the current order of keys in a vector. When you're implementing your own tab bar, be aware that this is the current tab bar and is only a copy of the original order, modification will not be transferred and future updates in the original not displayed.

pub fn next(&mut self)[src]

Set the active tab to the next tab in order.

pub fn prev(&mut self)[src]

Set the active tab to the previous tab in order.

pub fn set_bar_rx(&mut self, rx: Receiver<K>)[src]

Set the receiver for keys to be changed to

pub fn set_active_key_tx(&mut self, tx: Sender<K>)[src]

Set the sender for the key switched to

Trait Implementations

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

Auto Trait Implementations

impl<K> !Send for TabView<K>

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

impl<K> !Sync for TabView<K>

impl<K> !UnwindSafe for TabView<K>

impl<K> !RefUnwindSafe for TabView<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