pub struct StackView { /* private fields */ }
Expand description

Simple stack of views. Only the top-most view is active and can receive input.

Implementations

Creates a new empty StackView

Returns the number of layers in this StackView.

Returns true if there is no layer in this StackView.

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.

Adds a transparent view on top of the stack.

Adds a view on top of the stack at the given position.

Chainable variant.

Remove a layer from this StackView.

Panics

If the given position is out of bounds.

Remove the top-most layer.

Computes the offset of the selected view.

👎 Deprecated since 0.17.0:

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.

Brings the given view to the front of the stack.

Panics

If layer is out of bounds.

Pushes the given view to the back of the stack.

Panics

If layer is out of bounds.

Moves a layer to a new position on the screen.

Panics

If layer 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()

Forground 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

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

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

Called once the size for this view has been decided. 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

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.

Convenient method to find a view wrapped in an NamedView.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Returns a Box<View>.

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

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.