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]

[src]

Creates a new Dialog with empty content.

You should probably call content() next.

[src]

Creates a new Dialog with the given content.

[src]

Sets the content for this dialog.

Chainable variant.

[src]

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!");

[src]

Gets mutable access to the content.

[src]

Sets the content for this dialog.

Previous content will be dropped.

[src]

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

[src]

Convenient method to create an infobox.

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

[src]

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

Consumes and returns self for easy chaining.

[src]

Sets the horizontal alignment for the buttons, if any.

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

[src]

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

[src]

Sets the title of the dialog.

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

[src]

Sets the title of the dialog.

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

Sets the left padding in the dialog.

[src]

Sets the right padding in the dialog.

Important traits for Box<W>
[src]

Returns an iterator on this buttons for this dialog.

[src]

Returns currently focused element

Trait Implementations

impl Default for Dialog
[src]

[src]

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

impl View for Dialog
[src]

[src]

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

[src]

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

[src]

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

[src]

Called when a key was pressed. Read more

[src]

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

[src]

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

[src]

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

[src]

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

Auto Trait Implementations

impl !Send for Dialog

impl !Sync for Dialog