Trait cursive::view::ViewWrapper
[−]
[src]
pub trait ViewWrapper { type V: View; fn get_view(&self) -> &Self::V; fn get_view_mut(&mut self) -> &mut Self::V; fn wrap_draw(&self, printer: &Printer) { ... } fn wrap_get_min_size(&mut self, req: Vec2) -> Vec2 { ... } fn wrap_on_event(&mut self, ch: Event) -> EventResult { ... } fn wrap_layout(&mut self, size: Vec2) { ... } fn wrap_take_focus(&mut self, source: Direction) -> bool { ... } fn wrap_find_any(&mut self, selector: &Selector) -> Option<&mut Any> { ... } fn wrap_needs_relayout(&self) -> bool { ... } }
Generic wrapper around a view.
Default implementation forwards all calls to the child view. Overrides some methods as desired.
You can use the wrap_impl!
macro to define get_view
and
get_view_mut
for you.
Associated Types
Required Methods
fn get_view(&self) -> &Self::V
Get an immutable reference to the wrapped view.
fn get_view_mut(&mut self) -> &mut Self::V
Get a mutable reference to the wrapped view.
Provided Methods
fn wrap_draw(&self, printer: &Printer)
Wraps the draw
method.
fn wrap_get_min_size(&mut self, req: Vec2) -> Vec2
Wraps the get_min_size
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_any(&mut self, selector: &Selector) -> Option<&mut Any>
Wraps the find
method.
fn wrap_needs_relayout(&self) -> bool
Wraps the needs_relayout
method.
Implementors
impl<T: View> ViewWrapper for BoxView<T>
impl<T: View + Any> ViewWrapper for IdView<T>
impl<T: View> ViewWrapper for KeyEventView<T>
impl<V: View> ViewWrapper for Panel<V>
impl<T: View> ViewWrapper for ShadowView<T>
impl<T: View> ViewWrapper for SizedView<T>
impl<T: View> ViewWrapper for TrackedView<T>