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();

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);

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

Example

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

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

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

Setter for action

Chainable setter for the focus the mux should have

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

Returns the “default value” for a type. Read more

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

Returns the type of this view. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Downcast self to a Any.

Downcast self to a mutable Any.

Returns a boxed any from a boxed self. Read more

Immutably borrows from an owned value. Read more

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.

👎 Deprecated:

call_on_id is being renamed to call_on_name

Same as call_on_name.

Convenient method to find a view wrapped in an NamedView.

👎 Deprecated:

find_id is being renamed to find_name

Same as find_name.

Performs the conversion.

Performs the conversion.

Returns a Box<View>.

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

👎 Deprecated:

with_id is being renamed to with_name

Same as with_name

👎 Deprecated:

Use Resizable::resized() instead.

Same as resized

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.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.