Struct cursive::views::Dialog[][src]

pub struct Dialog { /* fields omitted */ }

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

Examples

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

Methods

impl Dialog
[src]

Creates a new Dialog with empty content.

You should probably call content() next.

Creates a new Dialog with the given content.

Sets the content for this dialog.

Chainable variant.

Gets the content of this dialog.

use cursive::views::{Dialog, TextView};
let dialog = Dialog::around(TextView::new("Hello!"));
let text_view: &TextView = dialog
    .get_content()
    .as_any()
    .downcast_ref::<TextView>()
    .unwrap();
assert_eq!(text_view.get_content().source(), "Hello!");

Gets mutable access to the content.

Sets the content for this dialog.

Previous content will be dropped.

Convenient method to create a dialog with a simple text content.

Convenient method to create an infobox.

It will contain the given text and a Ok dismiss button.

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

Consumes and returns self for easy chaining.

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

Returns the number of buttons on this dialog.

Removes any button from self.

Removes a button from this dialog.

Panics

Panics if i >= self.buttons_len().

Sets the horizontal alignment for the buttons, if any.

Only works if the buttons are as a row at the bottom of the dialog.

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

Sets the title of the dialog.

If not empty, it will be visible at the top.

Sets the title of the dialog.

Sets the horizontal position of the title in the dialog. The default position is HAlign::Center

Sets the horizontal position of the title in the dialog. The default position is HAlign::Center

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

Sets the top padding in the dialog (under the title).

Sets the bottom padding in the dialog (under buttons).

Sets the left padding in the dialog.

Sets the right padding in the dialog.

Returns an iterator on this buttons for this dialog.

Returns currently focused element

Trait Implementations

impl Default for Dialog
[src]

Returns the "default value" for a type. Read more

impl View for Dialog
[src]

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

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

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

Called when an event is received (key press, mouse event, ...). Read more

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

Runs a closure on the view identified by the given selector. Read more

Moves the focus to the view identified by the given selector. Read more

What part of the view is important and should be visible? Read more

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

Auto Trait Implementations

impl !Send for Dialog

impl !Sync for Dialog