Struct cursive::view::Dialog [] [src]

pub struct Dialog {
    // some fields omitted
}

Popup-like view with a main content, and optional buttons under it.

Examples

let dialog = Dialog::new(TextView::new("Hello!")).button("Ok", |s| s.quit());

Methods

impl Dialog
[src]

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

Creates a new Dialog with the given content.

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

Adds a button to the dialog with the given label and callback.

Consumes and returns self for easy chaining.

fn h_align(self, h: HAlign) -> Self

Sets the horizontal alignment for the buttons, if any. Only works if the buttons are as a row at the bottom of the dialog.

fn v_align(self, v: VAlign) -> Self

Sets the vertical alignment for the buttons, if any. Only works if the buttons are as a column to the right of the dialog.

fn dismiss_button<'a>(self, label: &'a str) -> Self

Shortcut method to add a button that will dismiss the dialog.

fn title(self, label: &str) -> Self

Sets the title of the dialog. If not empty, it will be visible at the top.

fn padding<T: ToVec4>(self, padding: T) -> Self

Sets the padding in the dialog (around content and buttons).

Trait Implementations

impl View for Dialog
[src]

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

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

fn get_min_size(&self, req: SizeRequest) -> Vec2

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

fn layout(&mut self, size: Vec2)

Called once the size for this view has been decided, so it can propagate the information to its children. 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) -> bool

This view is offered focus. Will it take it?

fn find(&mut self, selector: &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