Struct cursive::prelude::KeyEventView [] [src]

pub struct KeyEventView {
    // some fields omitted
}

A simple wrapper view that catches some ignored event from its child.

If the event doesn't have a corresponding callback, it will stay ignored.

Examples

let view = KeyEventView::new(TextView::new("This view has an event!"))
                        .register('q', |s| s.quit())
                        .register(Key::Esc, |s| s.quit());

Methods

impl KeyEventView
[src]

fn new<V: View + 'static>(view: V) -> Self

Wraps the given view in a new KeyEventView.

fn register<F, E: Into<Event>>(self, event: E, cb: F) -> Self where F: Fn(&mut Cursive) + 'static

Registers a callback when the given key is ignored by the child.

Trait Implementations

impl ViewWrapper for KeyEventView
[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_on_event(&mut self, event: Event) -> EventResult

Wraps the on_event method.

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_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.