Notification
struct · ferroui-controls · v0.5.0
struct Notification
A notification that can be shown in a window or by the host operating system.
This class represents a notification that can be displayed either in a
window using a
WindowNotificationManager or by the
host operating system (to be implemented).
Members
newemptywith_overridestitleset_titlewith_titlemessageset_messagewith_messagetype_set_typewith_typeexpirationset_expirationwith_expirationon_clickset_on_clickwith_on_clickon_closeset_on_closewith_on_closeon_property_changedbase_on_property_changed
new
fn new(title: Option<String>, message: Option<String>, type_: NotificationType, expiration: Option<Duration>, on_click: Option<Rc<dyn Fn() -> ()>>, on_close: Option<Rc<dyn Fn() -> ()>>) -> Rc<Self>
Creates a notification.
title: the title of the notification.message: the message to be displayed in the notification.type_: theNotificationTypeof the notification.expiration: the expiry time at which the notification will close (five seconds whenNone). UseDuration::ZEROfor notifications that will remain open.on_click: an action to call when the notification is clicked.on_close: an action to call when the notification is closed.
empty
fn empty() -> Rc<Self>
Creates a notification without title and message, of the information type, that expires after five seconds.
with_overrides
fn with_overrides(title: Option<String>, message: Option<String>, type_: NotificationType, expiration: Option<Duration>, on_click: Option<Rc<dyn Fn() -> ()>>, on_close: Option<Rc<dyn Fn() -> ()>>, overrides: Rc<dyn NotificationOverrides>) -> Rc<Self>
Creates a notification whose overridable members are replaced by
overrides: the form a class deriving from the notification takes.
title
fn title(self: &Self) -> Option<String>
The title of the notification.
set_title
fn set_title(self: &Self, value: Option<String>)
with_title
fn with_title(self: Rc<Self>, value: Option<String>) -> Rc<Self>
Sets the title; returns the notification for chaining.
message
fn message(self: &Self) -> Option<String>
The notification message.
set_message
fn set_message(self: &Self, value: Option<String>)
with_message
fn with_message(self: Rc<Self>, value: Option<String>) -> Rc<Self>
Sets the message; returns the notification for chaining.
type_
fn type_(self: &Self) -> NotificationType
The NotificationType of the notification.
set_type
fn set_type(self: &Self, value: NotificationType)
with_type
fn with_type(self: Rc<Self>, value: NotificationType) -> Rc<Self>
Sets the type; returns the notification for chaining.
expiration
fn expiration(self: &Self) -> Duration
The expiration time of the notification after which it will
automatically close. If the value is Duration::ZERO then the
notification will remain open until the user closes it.
set_expiration
fn set_expiration(self: &Self, value: Duration)
with_expiration
fn with_expiration(self: Rc<Self>, value: Duration) -> Rc<Self>
Sets the expiration; returns the notification for chaining.
on_click
fn on_click(self: &Self) -> Option<Rc<dyn Fn() -> ()>>
An action to be run when the notification is clicked.
set_on_click
fn set_on_click(self: &Self, value: Option<Rc<dyn Fn() -> ()>>)
with_on_click
fn with_on_click(self: Rc<Self>, value: Option<Rc<dyn Fn() -> ()>>) -> Rc<Self>
Sets the click action; returns the notification for chaining.
on_close
fn on_close(self: &Self) -> Option<Rc<dyn Fn() -> ()>>
An action to be run when the notification is closed.
set_on_close
fn set_on_close(self: &Self, value: Option<Rc<dyn Fn() -> ()>>)
with_on_close
fn with_on_close(self: Rc<Self>, value: Option<Rc<dyn Fn() -> ()>>) -> Rc<Self>
Sets the close action; returns the notification for chaining.
on_property_changed
fn on_property_changed(self: &Self, property_name: Option<&str>)
Raises the property changed event. Overridable: see
NotificationOverrides::on_property_changed.
base_on_property_changed
fn base_on_property_changed(self: &Self, property_name: Option<&str>)
The implementation of
on_property_changed of this class, for
overrides.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyAnyValueClassDefaultsErasedDestructorIntoEitherINotificationINotifyPropertyChangedPartialEqModelMarkupTyped
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.