[−][src]Struct cursive_tabs::TabView
Main struct which manages views
Methods
impl<K: Hash + Eq + Copy + 'static> TabView<K>
[src]
pub fn new() -> Self
[src]
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]
fn draw(&self, printer: &Printer)
[src]
fn layout(&mut self, size: Vec2)
[src]
fn required_size(&mut self, req: Vec2) -> Vec2
[src]
fn on_event(&mut self, evt: Event) -> EventResult
[src]
fn take_focus(&mut self, src: Direction) -> bool
[src]
fn call_on_any<'a>(&mut self, slt: &Selector, cb: AnyCb<'a>)
[src]
fn focus_view(&mut self, slt: &Selector) -> Result<(), ()>
[src]
fn needs_relayout(&self) -> bool
[src]
fn important_area(&self, size: Vec2) -> Rect
[src]
Auto Trait Implementations
impl<K> !Send for TabView<K>
impl<K> Unpin for TabView<K> where
K: Unpin,
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]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> View for T where
T: ViewWrapper,
[src]
T: ViewWrapper,
fn draw(&self, printer: &Printer)
[src]
fn required_size(&mut self, req: XY<usize>) -> XY<usize>
[src]
fn on_event(&mut self, ch: Event) -> EventResult
[src]
fn layout(&mut self, size: XY<usize>)
[src]
fn take_focus(&mut self, source: Direction) -> bool
[src]
fn call_on_any(
&mut self,
selector: &Selector,
callback: Box<dyn FnMut(&mut (dyn Any + 'static)) + 'a>
)
[src]
&mut self,
selector: &Selector,
callback: Box<dyn FnMut(&mut (dyn Any + 'static)) + 'a>
)
fn needs_relayout(&self) -> bool
[src]
fn focus_view(&mut self, selector: &Selector) -> Result<(), ()>
[src]
fn important_area(&self, size: XY<usize>) -> Rect
[src]
impl<T> Finder for T where
T: View,
[src]
T: View,
fn call_on<V, F, R>(&mut self, sel: &Selector, callback: F) -> Option<R> where
F: FnOnce(&mut V) -> R,
V: View + Any,
[src]
F: FnOnce(&mut V) -> R,
V: View + Any,
fn call_on_id<V, F, R>(&mut self, id: &str, callback: F) -> Option<R> where
F: FnOnce(&mut V) -> R,
V: View + Any,
[src]
F: FnOnce(&mut V) -> R,
V: View + Any,
fn find_id<V>(
&mut self,
id: &str
) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>> where
V: View + Any,
[src]
&mut self,
id: &str
) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>> where
V: View + Any,
impl<T> Scrollable for T where
T: View,
[src]
T: View,
fn scrollable(self) -> ScrollView<Self>
[src]
impl<T> Identifiable for T where
T: View,
[src]
T: View,
impl<T> With for T
[src]
fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
impl<T> Boxable for T where
T: View,
[src]
T: View,
fn boxed(self, width: SizeConstraint, height: SizeConstraint) -> BoxView<Self>
[src]
fn fixed_size<S>(self, size: S) -> BoxView<Self> where
S: Into<XY<usize>>,
[src]
S: Into<XY<usize>>,
fn fixed_width(self, width: usize) -> BoxView<Self>
[src]
fn fixed_height(self, height: usize) -> BoxView<Self>
[src]
fn full_screen(self) -> BoxView<Self>
[src]
fn full_width(self) -> BoxView<Self>
[src]
fn full_height(self) -> BoxView<Self>
[src]
fn max_size<S>(self, size: S) -> BoxView<Self> where
S: Into<XY<usize>>,
[src]
S: Into<XY<usize>>,
fn max_width(self, max_width: usize) -> BoxView<Self>
[src]
fn max_height(self, max_height: usize) -> BoxView<Self>
[src]
fn min_size<S>(self, size: S) -> BoxView<Self> where
S: Into<XY<usize>>,
[src]
S: Into<XY<usize>>,
fn min_width(self, min_width: usize) -> BoxView<Self>
[src]
fn min_height(self, min_height: usize) -> BoxView<Self>
[src]
impl<T> AnyView for T where
T: View,
[src]
T: View,
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
.
fn as_boxed_any(self: Box<T>) -> Box<dyn Any + 'static>
[src]
impl<T> IntoBoxedView for T where
T: View,
[src]
T: View,