Struct cursive_multiplex::Mux [−][src]
pub struct Mux { /* fields omitted */ }
Expand description
View holding information and managing multiplexer.
Implementations
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);
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();
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();
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();
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 set_container_split_ratio<T: Into<f32>>(
&mut self,
id: Id,
input: T
) -> Result<(), AddViewError>
[src]
pub fn set_container_split_ratio<T: Into<f32>>(
&mut self,
id: Id,
input: T
) -> Result<(), AddViewError>
[src]Sets the dimensions for partitioning two adjacent panes in the same container.
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(); mux.set_container_split_ratio(new_node, 0.3).unwrap();
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);
Chainable setter for the default split ratio. Note: Only values from 0 to 1 are valid, if your value exceeds this range it will be clamped.
Setter for the default split ratio. Note: Only values from 0 to 1 are valid, if your value exceeds this range it will be clamped.
Chainable setter for action
Chainable setter for action
Chainable setter for action
Chainable setter for action
Chainable setter for action
Chainable setter for action
Chainable setter for action
Chainable setter for action
Setter for action
Setter for action
Setter for action
Setter for action
Setter for action
Setter for action
Setter for action
Setter for action
Chainable setter for the focus the mux should have
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
Draws the view with the given printer (includes bounds) and focus. Read more
Should return true
if the view content changed since the last call
to layout()
. Read more
Returns the minimum size the view requires with the given restrictions. Read more
Called once the size for this view has been decided. Read more
This view is offered focus. Will it take it? Read more
Moves the focus to the view identified by the given selector. Read more
Runs a closure on the view identified by the given selector. Read more
Called when an event is received (key press, mouse event, …). Read more
What part of the view is important and should be visible? Read more
Auto Trait Implementations
impl !RefUnwindSafe for Mux
impl !UnwindSafe for Mux
Blanket Implementations
Mutably borrows from an owned value. Read more
Runs a callback on all views identified by sel
. Read more
Runs a callback on the view identified by sel
. Read more
Convenient method to use call_on
with a view::Selector::Name
.
Convenient method to find a view wrapped in an NamedView
.
Returns a Box<View>
.
Wraps self
in a ResizedView
with the given size constraints.
Wraps self
into a fixed-size ResizedView
.
Wraps self
into a fixed-width ResizedView
.
Wraps self
into a fixed-width ResizedView
.
Wraps self
into a full-screen ResizedView
.
Wraps self
into a full-width ResizedView
.
Wraps self
into a full-height ResizedView
.
Wraps self
into a limited-size ResizedView
.
Wraps self
into a limited-width ResizedView
.
Wraps self
into a limited-height ResizedView
.
Wraps self
into a ResizedView
at least sized size
.
Wraps self
in a ResizedView
at least min_width
wide.
Wraps self
in a ResizedView
at least min_height
tall.
Wraps self
in a ScrollView
.
Calls the given closure and return the result. Read more
Calls the given closure on self
.