Struct cursive::views::Button [] [src]

pub struct Button {
    // some fields omitted
}

Simple text label with a callback when is pressed.

A button shows its content in a single line and has a fixed size.

Examples

let quit_button = Button::new("Quit", |s| s.quit());

Methods

impl Button
[src]

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

Creates a new button with the given content and callback.

fn disable(&mut self)

Disables this view.

A disabled view cannot be selected.

fn disabled(self) -> Self

Disables this view.

Chainable variant.

fn enable(&mut self)

Re-enables this view.

fn set_enabled(&mut self, enabled: bool)

Enable or disable this view.

fn is_enabled(&self) -> bool

Returns true if this view is enabled.

Trait Implementations

impl View for Button
[src]

fn draw(&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. Read more

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