[−][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, node1) = cursive_multiplex::Mux::new(cursive::views::DummyView); 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, node1) = cursive_multiplex::Mux::new(cursive::views::DummyView); 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, node1) = cursive_multiplex::Mux::new(cursive::views::DummyView); 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, node1) = cursive_multiplex::Mux::new(cursive::views::DummyView); 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<T>(v: T) -> (Self, Id) where
T: View,
[src]
T: View,
Example
let (mut mux, node1) = cursive_multiplex::Mux::new(cursive::views::DummyView);
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 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::Mux::new(cursive::views::DummyView); let current_focus = mux.get_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 on_event(&mut self, evt: Event) -> EventResult
[src]
fn call_on_any(
&mut self,
&Selector,
Box<dyn FnMut(&mut (dyn Any + 'static)) + 'a>
)
[src]
&mut self,
&Selector,
Box<dyn FnMut(&mut (dyn Any + 'static)) + 'a>
)
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]
U: From<T>,
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> 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,
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]
&mut self,
id: &str
) -> Option<OwningHandle<OwningRef<Rc<RefCell<V>>, RefCell<V>>, RefMut<'static, V>>> where
V: View + Any,
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]
F: FnOnce(&mut Self),
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]
F: FnOnce(&mut Self) -> Result<(), E>,
Calls the given closure on self
.
fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
Calls the given closure if condition == true
.
impl<T> Scrollable for T where
T: View,
[src]
T: View,
fn scrollable(self) -> ScrollView<Self>
[src]
Wraps self
in a ScrollView
.
impl<T> Boxable for T where
T: View,
[src]
T: View,
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]
S: Into<XY<usize>>,
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]
S: Into<XY<usize>>,
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]
S: Into<XY<usize>>,
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]
T: View,
fn with_id<S>(self, id: S) -> IdView<Self> where
S: Into<String>,
[src]
S: Into<String>,
Wraps this view into an IdView
with the given id. Read more
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> 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,