Skip to main content

DialogExt

Trait DialogExt 

Source
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

Provided Methods§

Source

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

Source

fn add_button(&self, button_text: &str, response_id: ResponseType) -> Widget

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

Source

fn content_area(&self) -> Box

Returns the content area of self.

§Returns

the content area Box.

Source

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

Source

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.

Source

fn widget_for_response(&self, response_id: ResponseType) -> Option<Widget>

Gets the widget button that uses the given response ID in the action area of a dialog.

§response_id

the response ID used by the self widget

§Returns

the widget button that uses the given response_id, or None.

Source

fn response(&self, response_id: ResponseType)

Emits the response signal with the given response ID. Used to indicate that the user has responded to the dialog in some way; typically either you or run() will be monitoring the ::response signal and take appropriate action.

§response_id

response ID

Source

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

Source

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

Source

fn set_response_sensitive(&self, response_id: ResponseType, setting: bool)

Calls gtk_widget_set_sensitive (widget, setting) for each widget in the dialog’s action area with the given response_id. A convenient way to sensitize/desensitize dialog buttons.

§response_id

a response ID

§setting

true for sensitive

Source

fn use_header_bar(&self) -> i32

true if the dialog uses a HeaderBar for action buttons instead of the action-area.

For technical reasons, this property is declared as an integer property, but you should only set it to true or false.

Source

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.

Source

fn emit_close(&self)

Source

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".

Implementors§

Source§

impl<O: IsA<Dialog>> DialogExt for O