Trait cursive::view::View [] [src]

pub trait View {
    fn draw(&mut self, printer: &Printer);

    fn on_event(&mut self, Event) -> EventResult { ... }
    fn get_min_size(&self, SizeRequest) -> Vec2 { ... }
    fn layout(&mut self, Vec2) { ... }
    fn find(&mut self, &Selector) -> Option<&mut Any> { ... }
    fn take_focus(&mut self) -> bool { ... }
}

Main trait defining a view behaviour.

Required Methods

fn draw(&mut self, printer: &Printer)

Draws the view with the given printer (includes bounds) and focus.

Provided Methods

fn on_event(&mut self, Event) -> EventResult

Called when a key was pressed. Default implementation just ignores it.

fn get_min_size(&self, SizeRequest) -> Vec2

Returns the minimum size the view requires under the given restrictions.

fn layout(&mut self, Vec2)

Called once the size for this view has been decided, so it can propagate the information to its children.

fn find(&mut self, &Selector) -> Option<&mut Any>

Finds the view pointed to by the given path. Returns None if the path doesn't lead to a view.

fn take_focus(&mut self) -> bool

This view is offered focus. Will it take it?

Implementors