[][src]Struct cursive_multiplex::Mux

pub struct Mux { /* fields omitted */ }

View holding information and managing multiplexer.

Methods

impl Mux[src]

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_below(cursive::views::DummyView, node1).unwrap();
mux.remove_id(new_node);

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

Add the given view, below the given Id. The new view and the indexed one will share the space previously given to the give Id. When successful Ok() will contain the assigned Id

Example

let mut mux = cursive_multiplex::Mux::new();
let node1 = mux.add_right_of(cursive::views::DummyView, mux.root().build().unwrap()).unwrap();
let new_node = mux.add_below(cursive::views::DummyView, node1).unwrap();

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

Add the given view, above the given Id. The new view and the indexed one will share the space previously given to the give Id. When successful Ok() will contain the assigned Id

Example

let mut mux = cursive_multiplex::Mux::new();
let node1 = mux.add_right_of(cursive::views::DummyView, mux.root().build().unwrap()).unwrap();
let new_node = mux.add_above(cursive::views::DummyView, node1).unwrap();

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

Add the given view, left of the given Id. The new view and the indexed one will share the space previously given to the give Id. When successful Ok() will contain the assigned Id

Example

let mut mux = cursive_multiplex::Mux::new();
let node1 = mux.add_right_of(cursive::views::DummyView, mux.root().build().unwrap()).unwrap();
let new_node = mux.add_left_of(cursive::views::DummyView, node1).unwrap();

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

Add the given view, right of the given Id. The new view and the indexed one will share the space previously given to the give Id. When successful Ok() will contain the assigned Id

Example

let mut mux = cursive_multiplex::Mux::new();
let node1 = mux.add_right_of(cursive::views::DummyView, mux.root().build().unwrap()).unwrap();
let new_node = mux.add_right_of(cursive::views::DummyView, node1).unwrap();

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_below(cursive::views::DummyView, node1).unwrap();
let the_cooler_daniel = mux.add_below(cursive::views::DummyView, node1).unwrap();
// Oops I wanted the cooler daniel in another spot
mux.switch_views(daniel, the_cooler_daniel);

impl Mux[src]

pub fn root(&self) -> Path[src]

Getter for the initial path to traverse the tree and find a specific Id. Returns a Path which can be traversed.

impl Mux[src]

pub fn new() -> Self[src]

Example

let mut mux = cursive_multiplex::Mux::new();

pub fn with_move_focus_up(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_move_focus_down(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_move_focus_left(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_move_focus_right(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_resize_up(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_resize_down(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_resize_left(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn with_resize_right(self, evt: Event) -> Self[src]

Chainable setter for action

pub fn set_move_focus_up(&mut self, evt: Event)[src]

Setter for action

pub fn set_move_focus_down(&mut self, evt: Event)[src]

Setter for action

pub fn set_move_focus_left(&mut self, evt: Event)[src]

Setter for action

pub fn set_move_focus_right(&mut self, evt: Event)[src]

Setter for action

pub fn set_resize_up(&mut self, evt: Event)[src]

Setter for action

pub fn set_resize_down(&mut self, evt: Event)[src]

Setter for action

pub fn set_resize_left(&mut self, evt: Event)[src]

Setter for action

pub fn set_resize_right(&mut self, evt: Event)[src]

Setter for action

pub fn with_focus(self, id: Id) -> Self[src]

Chainable setter for the focus the mux should have

pub fn set_focus(&mut self, id: Id)[src]

Setter for the focus the mux should have

pub fn 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 = cursive_multiplex::Mux::new();
let node1 = mux.add_right_of(cursive::views::TextArea::new(), mux.root().build().unwrap()).unwrap();
let current_focus = mux.focus();
assert_eq!(current_focus, node1);

Trait Implementations

impl View for Mux[src]

Auto Trait Implementations

impl Unpin for Mux

impl !Sync for Mux

impl !Send for Mux

impl !UnwindSafe for Mux

impl !RefUnwindSafe for Mux

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> Identifiable for T where
    T: View
[src]

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

impl<T> With for T[src]

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

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

impl<T> Finder 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