Struct cursive::view::Button [] [src]

pub struct Button {
    // some fields omitted
}

Simple text label with a callback when ENTER is pressed. A button shows its content in a single line and has a fixed size.

Methods

impl Button
[src]

fn new<F>(label: &str, cb: F) -> Self where F: Fn(&mut Cursive) + 'static

Creates a new button with the given content and callback.

Trait Implementations

impl View for Button
[src]

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

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

fn get_min_size(&mut self, _: Vec2) -> Vec2

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

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

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

fn take_focus(&mut self, _: Direction) -> bool

This view is offered focus. Will it take it? Read more

fn needs_relayout(&self) -> bool

Returns true if the view content changed since last layout phase. Read more

fn layout(&mut self, Vec2)

Called once the size for this view has been decided, Read more

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

Finds the view pointed to by the given path. Read more