libadwaita::prelude

Trait AlertDialogExt

Source
pub trait AlertDialogExt:
    IsA<AlertDialog>
    + Sealed
    + 'static {
Show 33 methods // Provided methods fn add_response(&self, id: &str, label: &str) { ... } fn body(&self) -> GString { ... } fn is_body_use_markup(&self) -> bool { ... } fn close_response(&self) -> GString { ... } fn default_response(&self) -> Option<GString> { ... } fn extra_child(&self) -> Option<Widget> { ... } fn heading(&self) -> Option<GString> { ... } fn is_heading_use_markup(&self) -> bool { ... } fn prefers_wide_layout(&self) -> bool { ... } fn response_appearance(&self, response: &str) -> ResponseAppearance { ... } fn is_response_enabled(&self, response: &str) -> bool { ... } fn has_response(&self, response: &str) -> bool { ... } fn remove_response(&self, id: &str) { ... } fn set_body(&self, body: &str) { ... } fn set_body_use_markup(&self, use_markup: bool) { ... } fn set_close_response(&self, response: &str) { ... } fn set_default_response(&self, response: Option<&str>) { ... } fn set_extra_child(&self, child: Option<&impl IsA<Widget>>) { ... } fn set_heading(&self, heading: Option<&str>) { ... } fn set_heading_use_markup(&self, use_markup: bool) { ... } fn set_prefer_wide_layout(&self, prefer_wide_layout: bool) { ... } fn set_response_appearance( &self, response: &str, appearance: ResponseAppearance, ) { ... } fn set_response_enabled(&self, response: &str, enabled: bool) { ... } fn set_response_label(&self, response: &str, label: &str) { ... } fn connect_response<F: Fn(&Self, &str) + 'static>( &self, detail: Option<&str>, f: F, ) -> SignalHandlerId { ... } fn connect_body_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_body_use_markup_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_close_response_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_default_response_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_extra_child_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_heading_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_heading_use_markup_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... } fn connect_prefer_wide_layout_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { ... }
}
Available on crate feature v1_5 only.
Expand description

Trait containing all AlertDialog methods.

§Implementors

AlertDialog

Provided Methods§

Source

fn add_response(&self, id: &str, label: &str)

Adds a response with @id and @label to @self.

Responses are represented as buttons in the dialog.

Response ID must be unique. It will be used in response to tell which response had been activated, as well as to inspect and modify the response later.

An embedded underline in @label indicates a mnemonic.

set_response_label() can be used to change the response label after it had been added.

set_response_enabled() and set_response_appearance() can be used to customize the responses further.

§id

the response ID

§label

the response label

Source

fn body(&self) -> GString

Gets the body text of @self.

§Returns

the body of @self.

Source

fn is_body_use_markup(&self) -> bool

Gets whether the body text of @self includes Pango markup.

§Returns

whether @self uses markup for body text

Source

fn close_response(&self) -> GString

Gets the ID of the close response of @self.

§Returns

the close response ID

Source

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

Gets the ID of the default response of @self.

§Returns

the default response ID

Source

fn extra_child(&self) -> Option<Widget>

Gets the child widget of @self.

§Returns

the child widget of @self.

Source

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

Gets the heading of @self.

§Returns

the heading of @self.

Source

fn is_heading_use_markup(&self) -> bool

Gets whether the heading of @self includes Pango markup.

§Returns

whether @self uses markup for heading

Source

fn prefers_wide_layout(&self) -> bool

Gets whether @self prefers wide layout.

§Returns

whether to prefer wide layout

Source

fn response_appearance(&self, response: &str) -> ResponseAppearance

Gets the appearance of @response.

See set_response_appearance().

§response

a response ID

§Returns

the appearance of @response

Source

fn is_response_enabled(&self, response: &str) -> bool

Gets whether @response is enabled.

See set_response_enabled().

§response

a response ID

§Returns

whether @response is enabled

Source

fn has_response(&self, response: &str) -> bool

Gets whether @self has a response with the ID @response.

§response

response ID

§Returns

whether @self has a response with the ID @response.

Source

fn remove_response(&self, id: &str)

Removes a response from @self.

§id

the response ID

Source

fn set_body(&self, body: &str)

Sets the body text of @self.

§body

the body of @self

Source

fn set_body_use_markup(&self, use_markup: bool)

Sets whether the body text of @self includes Pango markup.

See parse_markup().

§use_markup

whether to use markup for body text

Source

fn set_close_response(&self, response: &str)

Sets the ID of the close response of @self.

It will be passed to response if the dialog is closed by pressing Escape or with a system action.

It doesn’t have to correspond to any of the responses in the dialog.

The default close response is close.

§response

the close response ID

Source

fn set_default_response(&self, response: Option<&str>)

Sets the ID of the default response of @self.

If set, pressing Enter will activate the corresponding button.

If set to NULL or to a non-existent response ID, pressing Enter will do nothing.

§response

the default response ID

Source

fn set_extra_child(&self, child: Option<&impl IsA<Widget>>)

Sets the child widget of @self.

The child widget is displayed below the heading and body.

§child

the child widget

Source

fn set_heading(&self, heading: Option<&str>)

Sets the heading of @self.

§heading

the heading of @self

Source

fn set_heading_use_markup(&self, use_markup: bool)

Sets whether the heading of @self includes Pango markup.

See parse_markup().

§use_markup

whether to use markup for heading

Source

fn set_prefer_wide_layout(&self, prefer_wide_layout: bool)

Available on crate feature v1_6 only.

Sets whether @self prefers wide layout.

Prefer horizontal button layout when possible, and wider dialog width otherwise.

§prefer_wide_layout

whether to prefer wide layout

Source

fn set_response_appearance( &self, response: &str, appearance: ResponseAppearance, )

Sets the appearance for @response.

alert-dialog-appearance

Use ADW_RESPONSE_SUGGESTED to mark important responses such as the affirmative action, like the Save button in the example.

Use ADW_RESPONSE_DESTRUCTIVE to draw attention to the potentially damaging consequences of using @response. This appearance acts as a warning to the user. The Discard button in the example is using this appearance.

The default appearance is ADW_RESPONSE_DEFAULT.

Negative responses like Cancel or Close should use the default appearance.

§response

a response ID

§appearance

appearance for @response

Source

fn set_response_enabled(&self, response: &str, enabled: bool)

Sets whether @response is enabled.

If @response is not enabled, the corresponding button will have sensitive set to FALSE and it can’t be activated as a default response.

@response can still be used as close-response while it’s not enabled.

Responses are enabled by default.

§response

a response ID

§enabled

whether to enable @response

Source

fn set_response_label(&self, response: &str, label: &str)

Sets the label of @response to @label.

Labels are displayed on the dialog buttons. An embedded underline in @label indicates a mnemonic.

§response

a response ID

§label

the label of @response

Source

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

This signal is emitted when the dialog is closed.

@response will be set to the response ID of the button that had been activated.

if the dialog was closed by pressing Escape or with a system action, @response will be set to the value of close-response.

§response

the response ID

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Available on crate feature v1_6 only.

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§