gtk::prelude

Trait DialogExtManual

Source
pub trait DialogExtManual:
    IsA<Dialog>
    + IsA<Widget>
    + Sealed
    + 'static {
    // Provided methods
    fn add_buttons(&self, buttons: &[(&str, ResponseType)]) { ... }
    fn run_future<'a>(
        &'a self,
    ) -> Pin<Box<dyn Future<Output = ResponseType> + 'a>> { ... }
}

Provided Methods§

Source

fn add_buttons(&self, buttons: &[(&str, ResponseType)])

Source

fn run_future<'a>(&'a self) -> Pin<Box<dyn Future<Output = ResponseType> + 'a>>

Shows the dialog and returns a Future that resolves to the ResponseType on response.

use gtk::prelude::*;

let dialog = gtk::MessageDialog::builder()
   .buttons(gtk::ButtonsType::OkCancel)
   .text("What is your answer?")
   .build();

let answer = dialog.run_future().await;
dialog.close();
println!("Answer: {:?}", answer);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§