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(&self, _: SizeRequest) -> Vec2

Returns the minimum size the view requires under 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) -> bool

This view is offered focus. Will it take it?

fn layout(&mut self, Vec2)

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

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. Read more