Struct cursive::prelude::BoxView
[−]
[src]
pub struct BoxView<T: View> { // some fields omitted }
Wrapper around another view, with a fixed size.
Each axis can be enabled independantly.
- If both axis are fixed, the view always asks for this size.
- If both axis are left free, the wrapper has no effect and the underlying view is directly queried.
- If only one axis is fixed, it will override the size request when querying the wrapped view.
Examples
// Creates a 20x4 BoxView with a TextView content. let view = BoxView::fixed_size((20,4), TextView::new("Hello!"));
Methods
impl<T: View> BoxView<T>
[src]
fn fixed_size<S: Into<Vec2>>(size: S, view: T) -> Self
Wraps view
in a new BoxView
with the given size.
fn new(width: Option<usize>, height: Option<usize>, view: T) -> Self
Creates a new BoxView
with the given width and height requirements.
None
values will use the wrapped view's preferences.
fn fixed_width(width: usize, view: T) -> Self
Wraps view
in a new BoxView
with fixed width.
fn fixed_height(height: usize, view: T) -> Self
Wraps view
in a new BoxView
with fixed height.
Trait Implementations
impl<T: View> ViewWrapper for BoxView<T>
[src]
fn get_view(&self) -> &View
Get an immutable reference to the wrapped view.
fn get_view_mut(&mut self) -> &mut View
Get a mutable reference to the wrapped view.
fn wrap_get_min_size(&mut self, req: Vec2) -> Vec2
Wraps the get_min_size
method.
fn wrap_draw(&self, printer: &Printer)
Wraps the draw
method.
fn wrap_on_event(&mut self, ch: Event) -> EventResult
Wraps the on_event
method.
fn wrap_layout(&mut self, size: Vec2)
Wraps the layout
method.
fn wrap_take_focus(&mut self, source: Direction) -> bool
Wraps the take_focus
method.
fn wrap_find(&mut self, selector: &Selector) -> Option<&mut Any>
Wraps the find
method.
fn wrap_needs_relayout(&self) -> bool
Wraps the needs_relayout
method.