[][src]Struct cursive_multiplex::Mux

pub struct Mux { /* fields omitted */ }

View holding information and managing multiplexer.

Methods

impl Mux[src]

pub fn get_focus(&self) -> Id[src]

Returns the current focused view id. By default the newest node added to the multiplexer gets focused. Focus can also be changed by the user.

Example

let (mut mux, node1) = cursive_multiplex::MuxBuilder::new().build(cursive::views::DummyView);
let current_focus = mux.get_focus();
assert_eq!(current_focus, node1);

pub fn add_horizontal_path<T>(
    &mut self,
    v: T,
    path: Path
) -> Result<Id, AddViewError> where
    T: View
[src]

Add the given view to the tree based on the path, if the path is too specific it will be truncated, if not specific enough an error will be returned. When successful Ok() will contain the assigned Id

Example

let new_node = mux.add_horizontal_path(cursive::views::DummyView, Path::RightOrDown(Box::new(None))).unwrap();

pub fn add_vertical_path<T>(
    &mut self,
    v: T,
    path: Path
) -> Result<Id, AddViewError> where
    T: View
[src]

Add the given view to the tree based on the path, if the path is too specific it will be truncated, if not specific enough an error will be returned. When successful Ok() will contain the assigned Id

Example

let new_node = mux.add_vertical_path(cursive::views::DummyView, Path::RightOrDown(Box::new(None))).unwrap();

pub fn add_horizontal_id<T>(&mut self, v: T, id: Id) -> Result<Id, AddViewError> where
    T: View
[src]

Add the given view to the tree based on the path, if the path is too specific it will be truncated, if not specific enough an error will be returned. When successful Ok() will contain the assigned Id

Example

let (mut mux, node1) = cursive_multiplex::MuxBuilder::new().build(cursive::views::DummyView);
let new_node = mux.add_horizontal_id(cursive::views::DummyView, node1).unwrap();

pub fn add_vertical_id<T>(&mut self, v: T, id: Id) -> Result<Id, AddViewError> where
    T: View
[src]

Add the given view to the tree based on the path, if the path is too specific it will be truncated, if not specific enough an error will be returned. When successful Ok() will contain the assigned Id

Example

let (mut mux, node1) = cursive_multiplex::MuxBuilder::new().build(cursive::views::DummyView);
let new_node = mux.add_vertical_id(cursive::views::DummyView, node1).unwrap();

pub fn remove_id(&mut self, id: Id) -> Result<Id, RemoveViewError>[src]

Removes the given id from the multiplexer, returns an error if not a valid id contained in the tree or the lone root of the tree. When successful the Id of the removed Node is returned.

Example

let new_node = mux.add_vertical_id(cursive::views::DummyView, node1).unwrap();
mux.remove_id(new_node);

pub fn switch_views(&mut self, fst: Id, snd: Id) -> Result<(), SwitchError>[src]

Allows for position switching of two views, returns error if ids not in multiplexer. When successful empty Ok(())

Example

let daniel = mux.add_vertical_id(cursive::views::DummyView, node1).unwrap();
let the_cooler_daniel = mux.add_vertical_id(cursive::views::DummyView, node1).unwrap();
// Oops I wanted the cooler daniel in another spot
mux.switch_views(daniel, the_cooler_daniel);

Trait Implementations

impl View for Mux[src]

fn call_on_any(
    &mut self,
    &Selector,
    Box<dyn FnMut(&mut (dyn Any + 'static)) + 'a>
)
[src]

Runs a closure on the view identified by the given selector. Read more

fn important_area(&self, view_size: XY<usize>) -> Rect[src]

What part of the view is important and should be visible? Read more

Auto Trait Implementations

impl !Sync for Mux

impl !Send for Mux

impl Unpin for Mux

impl !RefUnwindSafe for Mux

impl !UnwindSafe for Mux

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<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> Finder for T where
    T: View
[src]

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]

Convenient method to use call_on with a view::Selector::Id.

fn find_id<V>(
    &mut self,
    id: &str
) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>> where
    V: View + Any
[src]

Convenient method to find a view wrapped in an [IdView]. Read more

impl<T> With for T[src]

fn with<F>(self, f: F) -> Self where
    F: FnOnce(&mut Self), 
[src]

Calls the given closure on self.

fn try_with<E, F>(self, f: F) -> Result<Self, E> where
    F: FnOnce(&mut Self) -> Result<(), E>, 
[src]

Calls the given closure on self.

fn with_if<F>(self, condition: bool, f: F) -> Self where
    F: FnOnce(&mut Self), 
[src]

Calls the given closure if condition == true.

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

fn scrollable(self) -> ScrollView<Self>[src]

Wraps self in a ScrollView.

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

fn boxed(self, width: SizeConstraint, height: SizeConstraint) -> BoxView<Self>[src]

Wraps self in a BoxView with the given size constraints.

fn fixed_size<S>(self, size: S) -> BoxView<Self> where
    S: Into<XY<usize>>, 
[src]

Wraps self into a fixed-size BoxView.

fn fixed_width(self, width: usize) -> BoxView<Self>[src]

Wraps self into a fixed-width BoxView.

fn fixed_height(self, height: usize) -> BoxView<Self>[src]

Wraps self into a fixed-width BoxView.

fn full_screen(self) -> BoxView<Self>[src]

Wraps self into a full-screen BoxView.

fn full_width(self) -> BoxView<Self>[src]

Wraps self into a full-width BoxView.

fn full_height(self) -> BoxView<Self>[src]

Wraps self into a full-height BoxView.

fn max_size<S>(self, size: S) -> BoxView<Self> where
    S: Into<XY<usize>>, 
[src]

Wraps self into a limited-size BoxView.

fn max_width(self, max_width: usize) -> BoxView<Self>[src]

Wraps self into a limited-width BoxView.

fn max_height(self, max_height: usize) -> BoxView<Self>[src]

Wraps self into a limited-height BoxView.

fn min_size<S>(self, size: S) -> BoxView<Self> where
    S: Into<XY<usize>>, 
[src]

Wraps self into a BoxView at least sized size.

fn min_width(self, min_width: usize) -> BoxView<Self>[src]

Wraps self in a BoxView at least min_width wide.

fn min_height(self, min_height: usize) -> BoxView<Self>[src]

Wraps self in a BoxView at least min_height tall.

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

fn with_id<S>(self, id: S) -> IdView<Self> where
    S: Into<String>, 
[src]

Wraps this view into an IdView with the given id. Read more

impl<T> View for T where
    T: ViewWrapper
[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