gtk4::prelude

Trait DialogExt

Source
pub trait DialogExt: IsA<Dialog> + 'static {
    // 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) -> HeaderBar { ... }
    fn widget_for_response(&self, response_id: ResponseType) -> Option<Widget> { ... }
    fn response(&self, response_id: 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 { ... }
}
👎Deprecated: Since 4.10
Expand description

Provided Methods§

Source

fn add_action_widget(&self, child: &impl IsA<Widget>, response_id: ResponseType)

👎Deprecated: Since 4.10

Adds an activatable widget to the action area of a Dialog.

GTK connects 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.

§Deprecated since 4.10

Use Window instead

§child

an activatable widget

§response_id

response ID for @child

Source

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

👎Deprecated: Since 4.10

Adds a button with the given text.

GTK arranges things 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.

§Deprecated since 4.10

Use Window instead

§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

👎Deprecated: Since 4.10

Returns the content area of @self.

§Deprecated since 4.10

Use Window instead

§Returns

the content area Box.

Source

fn header_bar(&self) -> HeaderBar

👎Deprecated: Since 4.10

Returns the header bar of @self.

Note that the headerbar is only used by the dialog if the use-header-bar property is true.

§Deprecated since 4.10

Use Window instead

§Returns

the header bar

Source

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

👎Deprecated: Since 4.10

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

§Deprecated since 4.10

Use Window instead

§response_id

the response ID used by the @self widget

§Returns

the @widget button that uses the given @response_id

Source

fn response(&self, response_id: ResponseType)

👎Deprecated: Since 4.10

Emits the ::response signal with the given response ID.

Used to indicate that the user has responded to the dialog in some way.

§Deprecated since 4.10

Use Window instead

§response_id

response ID

Source

fn set_default_response(&self, response_id: ResponseType)

👎Deprecated: Since 4.10

Sets the default widget for the dialog based on the response ID.

Pressing “Enter” normally activates the default widget.

§Deprecated since 4.10

Use Window instead

§response_id

a response ID

Source

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

👎Deprecated: Since 4.10

A convenient way to sensitize/desensitize dialog buttons.

Calls gtk_widget_set_sensitive (widget, @setting) for each widget in the dialog’s action area with the given @response_id.

§Deprecated since 4.10

Use Window instead

§response_id

a response ID

§setting

true for sensitive

Source

fn use_header_bar(&self) -> i32

👎Deprecated: Since 4.10

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.

§Creating a dialog with headerbar

Builtin Dialog subclasses such as ColorChooserDialog set this property according to platform conventions (using the gtk-dialogs-use-header setting).

Here is how you can achieve the same:

⚠️ The following code is in c ⚠️

g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
§Deprecated since 4.10

Use Window instead

Source

fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId

👎Deprecated: Since 4.10

Emitted when the user uses a keybinding to close the dialog.

This is a keybinding signal.

The default binding for this signal is the Escape key.

§Deprecated since 4.10

Use Window instead

Source

fn emit_close(&self)

👎Deprecated: Since 4.10
Source

fn connect_response<F: Fn(&Self, ResponseType) + 'static>( &self, f: F, ) -> SignalHandlerId

👎Deprecated: Since 4.10

Emitted when an action widget is clicked.

The signal is also emitted when the dialog receives a delete event, and when response() is called. On a delete event, the response ID is ResponseType::DeleteEvent. Otherwise, it depends on which action widget was clicked.

§Deprecated since 4.10

Use Window instead

§response_id

the response ID

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§

Source§

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