Trait gtk::prelude::DialogExtManual
source · [−]pub trait DialogExtManual: 'static {
fn add_buttons(&self, buttons: &[(&str, ResponseType)]);
fn run_future<'a>(
&'a self
) -> Pin<Box<dyn Future<Output = ResponseType> + 'a>>;
}
Required Methods
Adds more buttons, same as calling DialogExt::add_button()
repeatedly. The variable argument list should be None
-terminated
as with gtk_dialog_new_with_buttons()
. Each button must have both
text and response ID.
first_button_text
button text
fn run_future<'a>(&'a self) -> Pin<Box<dyn Future<Output = ResponseType> + 'a>>
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);