[−][src]Struct cursive_multiplex::Mux
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]
T: View,
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]
T: View,
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]
T: View,
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]
T: View,
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]
fn draw(&self, printer: &Printer)
[src]
fn needs_relayout(&self) -> bool
[src]
fn required_size(&mut self, constraint: Vec2) -> Vec2
[src]
fn layout(&mut self, constraint: Vec2)
[src]
fn take_focus(&mut self, _source: Direction) -> bool
[src]
fn focus_view(&mut self, _: &Selector) -> Result<(), ()>
[src]
fn call_on_any<'a>(&mut self, slct: &Selector, cb: AnyCb<'a>)
[src]
fn on_event(&mut self, evt: Event) -> EventResult
[src]
fn important_area(&self, view_size: XY<usize>) -> Rect
[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]
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> Identifiable for T where
T: View,
[src]
T: View,
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> 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> 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> Scrollable for T where
T: View,
[src]
T: View,
fn scrollable(self) -> ScrollView<Self>
[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> 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,