pub struct Notification { /* private fields */ }Expand description
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).
Implementations§
Source§impl Notification
impl Notification
Sourcepub 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>
pub 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.
Sourcepub fn empty() -> Rc<Self>
pub fn empty() -> Rc<Self>
Creates a notification without title and message, of the information type, that expires after five seconds.
Sourcepub 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>
pub 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.
pub fn set_title(&self, value: Option<String>)
Sourcepub fn with_title(self: Rc<Self>, value: Option<String>) -> Rc<Self>
pub fn with_title(self: Rc<Self>, value: Option<String>) -> Rc<Self>
Sets the title; returns the notification for chaining.
pub fn set_message(&self, value: Option<String>)
Sourcepub fn with_message(self: Rc<Self>, value: Option<String>) -> Rc<Self>
pub fn with_message(self: Rc<Self>, value: Option<String>) -> Rc<Self>
Sets the message; returns the notification for chaining.
Sourcepub fn type_(&self) -> NotificationType
pub fn type_(&self) -> NotificationType
The NotificationType of the notification.
pub fn set_type(&self, value: NotificationType)
Sourcepub fn with_type(self: Rc<Self>, value: NotificationType) -> Rc<Self>
pub fn with_type(self: Rc<Self>, value: NotificationType) -> Rc<Self>
Sets the type; returns the notification for chaining.
Sourcepub fn expiration(&self) -> Duration
pub fn expiration(&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.
pub fn set_expiration(&self, value: Duration)
Sourcepub fn with_expiration(self: Rc<Self>, value: Duration) -> Rc<Self>
pub fn with_expiration(self: Rc<Self>, value: Duration) -> Rc<Self>
Sets the expiration; returns the notification for chaining.
Sourcepub fn on_click(&self) -> Option<Rc<dyn Fn()>>
pub fn on_click(&self) -> Option<Rc<dyn Fn()>>
An action to be run when the notification is clicked.
pub fn set_on_click(&self, value: Option<Rc<dyn Fn()>>)
Sourcepub fn with_on_click(self: Rc<Self>, value: Option<Rc<dyn Fn()>>) -> Rc<Self>
pub fn with_on_click(self: Rc<Self>, value: Option<Rc<dyn Fn()>>) -> Rc<Self>
Sets the click action; returns the notification for chaining.
Sourcepub fn on_close(&self) -> Option<Rc<dyn Fn()>>
pub fn on_close(&self) -> Option<Rc<dyn Fn()>>
An action to be run when the notification is closed.
pub fn set_on_close(&self, value: Option<Rc<dyn Fn()>>)
Sourcepub fn with_on_close(self: Rc<Self>, value: Option<Rc<dyn Fn()>>) -> Rc<Self>
pub fn with_on_close(self: Rc<Self>, value: Option<Rc<dyn Fn()>>) -> Rc<Self>
Sets the close action; returns the notification for chaining.
Sourcepub fn on_property_changed(&self, property_name: Option<&str>)
pub fn on_property_changed(&self, property_name: Option<&str>)
Raises the property changed event. Overridable: see
NotificationOverrides::on_property_changed.
Sourcepub fn base_on_property_changed(&self, property_name: Option<&str>)
pub fn base_on_property_changed(&self, property_name: Option<&str>)
The implementation of
on_property_changed of this class, for
overrides.
Trait Implementations§
Source§impl INotification for Notification
impl INotification for Notification
Source§fn type_(&self) -> NotificationType
fn type_(&self) -> NotificationType
NotificationType of the notification.Source§fn expiration(&self) -> Duration
fn expiration(&self) -> Duration
Duration::ZERO then the
notification will remain open until the user closes it.Source§fn on_click(&self) -> Option<Rc<dyn Fn()>>
fn on_click(&self) -> Option<Rc<dyn Fn()>>
Source§fn on_close(&self) -> Option<Rc<dyn Fn()>>
fn on_close(&self) -> Option<Rc<dyn Fn()>>
Source§fn to_boxed(self: Rc<Self>) -> BoxedValue
fn to_boxed(self: Rc<Self>) -> BoxedValue
Source§impl INotifyPropertyChanged for Notification
impl INotifyPropertyChanged for Notification
Source§fn property_changed(&self) -> &Event<str>
fn property_changed(&self) -> &Event<str>
Source§fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>
fn as_notify_property_changing(&self) -> Option<&dyn INotifyPropertyChanging>
INotifyPropertyChanging, when it also raises the event of a property
that is about to change; None by default. Read moreSource§impl Model for Notification
impl Model for Notification
Source§fn describe(builder: ModelTypeBuilder<Self>) -> ModelTypeBuilder<Self>
fn describe(builder: ModelTypeBuilder<Self>) -> ModelTypeBuilder<Self>
Auto Trait Implementations§
impl !Freeze for Notification
impl !RefUnwindSafe for Notification
impl !Send for Notification
impl !Sync for Notification
impl !UnwindSafe for Notification
impl Unpin for Notification
impl UnsafeUnpin for Notification
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more