gtk4::prelude

Trait NativeDialogExt

Source
pub trait NativeDialogExt: IsA<NativeDialog> + 'static {
Show 16 methods // Provided methods fn destroy(&self) { ... } fn is_modal(&self) -> bool { ... } fn title(&self) -> Option<GString> { ... } fn transient_for(&self) -> Option<Window> { ... } fn is_visible(&self) -> bool { ... } fn hide(&self) { ... } fn set_modal(&self, modal: bool) { ... } fn set_title(&self, title: &str) { ... } fn set_transient_for(&self, parent: Option<&impl IsA<Window>>) { ... } fn show(&self) { ... } fn set_visible(&self, visible: bool) { ... } fn connect_response<F: Fn(&Self, ResponseType) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_modal_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_title_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_transient_for_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_visible_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all NativeDialog methods.

§Implementors

FileChooserNative, NativeDialog

Provided Methods§

Source

fn destroy(&self)

Source

fn is_modal(&self) -> bool

Returns whether the dialog is modal.

§Returns

true if the dialog is set to be modal

Source

fn title(&self) -> Option<GString>

Gets the title of the NativeDialog.

§Returns

the title of the dialog, or None if none has been set explicitly. The returned string is owned by the widget and must not be modified or freed.

Source

fn transient_for(&self) -> Option<Window>

Fetches the transient parent for this window.

§Returns

the transient parent for this window, or None if no transient parent has been set.

Source

fn is_visible(&self) -> bool

Determines whether the dialog is visible.

§Returns

true if the dialog is visible

Source

fn hide(&self)

Hides the dialog if it is visible, aborting any interaction.

Once this is called the response signal will not be emitted until after the next call to show().

If the dialog is not visible this does nothing.

Source

fn set_modal(&self, modal: bool)

Sets a dialog modal or non-modal.

Modal dialogs prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use set_transient_for() to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

whether the window is modal

Source

fn set_title(&self, title: &str)

Sets the title of the NativeDialog

§title

title of the dialog

Source

fn set_transient_for(&self, parent: Option<&impl IsA<Window>>)

Dialog windows should be set transient for the main application window they were spawned from.

This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window.

Passing None for @parent unsets the current transient window.

§parent

parent window

Source

fn show(&self)

Shows the dialog on the display.

When the user accepts the state of the dialog the dialog will be automatically hidden and the response signal will be emitted.

Multiple calls while the dialog is visible will be ignored.

Source

fn set_visible(&self, visible: bool)

Whether the window is currently visible.

Source

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

Emitted when the user responds to the dialog.

When this is called the dialog has been hidden.

If you call hide() before the user responds to the dialog this signal will not be emitted.

§response_id

the response ID

Source

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

Source

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

Source

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

Source

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

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§