Struct cursive_core::views::StackView [−][src]
pub struct StackView { /* fields omitted */ }Expand description
Simple stack of views. Only the top-most view is active and can receive input.
Implementations
Returns true if position points to a valid layer.
Returns false if it exceeds the bounds.
Adds a new full-screen layer on top of the stack.
Fullscreen layers have no shadow.
Adds new view on top of the stack in the center of the screen.
Adds new view on top of the stack in the center of the screen.
Chainable variant.
Returns a reference to the layer at the given position.
Returns a mutable reference to the layer at the given position.
Looks for the layer containing a view with the given name.
Returns Some(pos) if self.get(pos) has the given name,
or is a parent of a view with this name.
Returns None if the given name is not found.
Note that the returned position may be invalidated if some layers are removed from the view.
Examples
let mut stack = StackView::new();
stack.add_layer(TextView::new("Back"));
stack.add_layer(Dialog::around(TextView::new("Middle").with_name("text")));
stack.add_layer(TextView::new("Front"));
assert_eq!(stack.find_layer_from_name("text"), Some(LayerPosition::FromBack(1)));Adds a new full-screen layer on top of the stack.
Chainable variant.
Adds a new transparent layer on top of the stack.
Chainable variant.
Adds a view on top of the stack.
Adds a transparent view on top of the stack in the center of the screen.
pub fn add_transparent_layer_at<T>(&mut self, position: Position, view: T) where
T: IntoBoxedView,
pub fn add_transparent_layer_at<T>(&mut self, position: Position, view: T) where
T: IntoBoxedView,
Adds a transparent view on top of the stack.
Adds a view on top of the stack at the given position.
Chainable variant.
Computes the offset of the selected view.
👎 Deprecated since 0.17.0: Use StackView::layer_offset instead.
Use StackView::layer_offset instead.
Computes the offset of the current top view.
Returns the size for each layer in this view.
Moves a layer to a new position in the stack.
This only affects the elevation of a layer (whether it is drawn over or under other views).
Panics
If either from or to is out of bounds.
Background drawing
Drawing functions are split into forground and background to ease inserting layers under the stackview but above its background.
you probably just want to call draw()
Trait Implementations
Draws the view with the given printer (includes bounds) and focus. Read more
Called when an event is received (key press, mouse event, …). Read more
Returns the minimum size the view requires with the given restrictions. Read more
Attempt to give this view the focus. Read more
Runs a closure on the view identified by the given selector. Read more
Moves the focus to the view identified by the given selector. Read more
Should return true if the view content changed since the last call
to layout(). Read more
What part of the view is important and should be visible? Read more
