pub trait DialogExt: IsA<Dialog> + 'static {
Show 14 methods
// Provided methods
fn add_action_widget(
&self,
child: &impl IsA<Widget>,
response_id: ResponseType,
) { ... }
fn add_button(&self, button_text: &str, response_id: ResponseType) -> Widget { ... }
fn content_area(&self) -> Box { ... }
fn header_bar(&self) -> Option<HeaderBar> { ... }
fn response_for_widget(&self, widget: &impl IsA<Widget>) -> ResponseType { ... }
fn widget_for_response(&self, response_id: ResponseType) -> Option<Widget> { ... }
fn response(&self, response_id: ResponseType) { ... }
fn run(&self) -> ResponseType { ... }
fn set_default_response(&self, response_id: ResponseType) { ... }
fn set_response_sensitive(&self, response_id: ResponseType, setting: bool) { ... }
fn use_header_bar(&self) -> i32 { ... }
fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_close(&self) { ... }
fn connect_response<F: Fn(&Self, ResponseType) + 'static>(
&self,
f: F,
) -> SignalHandlerId { ... }
}Expand description
Trait containing all Dialog methods.
§Implementors
AboutDialog, AppChooserDialog, ColorChooserDialog, Dialog, FileChooserDialog, FontChooserDialog, MessageDialog, RecentChooserDialog
Provided Methods§
Sourcefn add_action_widget(&self, child: &impl IsA<Widget>, response_id: ResponseType)
fn add_action_widget(&self, child: &impl IsA<Widget>, response_id: ResponseType)
Adds an activatable widget to the action area of a Dialog,
connecting a signal handler that will emit the response
signal on the dialog when the widget is activated. The widget is
appended to the end of the dialog’s action area. If you want to add a
non-activatable widget, simply pack it into the action_area field
of the Dialog struct.
§child
an activatable widget
§response_id
response ID for child
Adds a button with the given text and sets things up so that
clicking the button will emit the response signal with
the given response_id. The button is appended to the end of the
dialog’s action area. The button widget is returned, but usually
you don’t need it.
§button_text
text of button
§response_id
response ID for the button
§Returns
the Button widget that was added
Sourcefn content_area(&self) -> Box
fn content_area(&self) -> Box
Sourcefn header_bar(&self) -> Option<HeaderBar>
fn header_bar(&self) -> Option<HeaderBar>
Returns the header bar of self. Note that the
headerbar is only used by the dialog if the
use-header-bar property is true.
§Returns
the header bar
Sourcefn response_for_widget(&self, widget: &impl IsA<Widget>) -> ResponseType
fn response_for_widget(&self, widget: &impl IsA<Widget>) -> ResponseType
Gets the response id of a widget in the action area of a dialog.
§widget
a widget in the action area of self
§Returns
the response id of widget, or ResponseType::None
if widget doesn’t have a response id set.
Sourcefn widget_for_response(&self, response_id: ResponseType) -> Option<Widget>
fn widget_for_response(&self, response_id: ResponseType) -> Option<Widget>
Sourcefn response(&self, response_id: ResponseType)
fn response(&self, response_id: ResponseType)
Sourcefn run(&self) -> ResponseType
fn run(&self) -> ResponseType
GtkWidget *dialog = gtk_dialog_new (); // Set up dialog…
int result = gtk_dialog_run (GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_ACCEPT: // do_application_specific_something (); break; default: // do_nothing_since_dialog_was_cancelled (); break; } gtk_widget_destroy (dialog); ]|
Note that even though the recursive main loop gives the effect of a
modal dialog (it prevents the user from interacting with other
windows in the same window group while the dialog is run), callbacks
such as timeouts, IO channel watches, DND drops, etc, will
be triggered during a run() call.
§Returns
response ID
Sourcefn set_default_response(&self, response_id: ResponseType)
fn set_default_response(&self, response_id: ResponseType)
Sets the last widget in the dialog’s action area with the given response_id
as the default widget for the dialog. Pressing “Enter” normally activates
the default widget.
§response_id
a response ID
Sourcefn set_response_sensitive(&self, response_id: ResponseType, setting: bool)
fn set_response_sensitive(&self, response_id: ResponseType, setting: bool)
Sourcefn use_header_bar(&self) -> i32
fn use_header_bar(&self) -> i32
Sourcefn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The ::close signal is a [keybinding signal][GtkBindingSignal] which gets emitted when the user uses a keybinding to close the dialog.
The default binding for this signal is the Escape key.
fn emit_close(&self)
Sourcefn connect_response<F: Fn(&Self, ResponseType) + 'static>(
&self,
f: F,
) -> SignalHandlerId
fn connect_response<F: Fn(&Self, ResponseType) + 'static>( &self, f: F, ) -> SignalHandlerId
Emitted when an action widget is clicked, the dialog receives a
delete event, or the application programmer calls response().
On a delete event, the response ID is ResponseType::DeleteEvent.
Otherwise, it depends on which action widget was clicked.
§response_id
the response ID
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".