FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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).

    View source

    Members

    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_: the NotificationType of the notification.
    • expiration: the expiry time at which the notification will close (five seconds when None). Use Duration::ZERO for 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.

    Source

    empty

    fn empty() -> Rc<Self>
    

    Creates a notification without title and message, of the information type, that expires after five seconds.

    Source

    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.

    Source

    title

    fn title(self: &Self) -> Option<String>
    

    The title of the notification.

    Source

    set_title

    fn set_title(self: &Self, value: Option<String>)
    

    Source

    with_title

    fn with_title(self: Rc<Self>, value: Option<String>) -> Rc<Self>
    

    Sets the title; returns the notification for chaining.

    Source

    message

    fn message(self: &Self) -> Option<String>
    

    The notification message.

    Source

    set_message

    fn set_message(self: &Self, value: Option<String>)
    

    Source

    with_message

    fn with_message(self: Rc<Self>, value: Option<String>) -> Rc<Self>
    

    Sets the message; returns the notification for chaining.

    Source

    type_

    fn type_(self: &Self) -> NotificationType
    

    The NotificationType of the notification.

    Source

    set_type

    fn set_type(self: &Self, value: NotificationType)
    

    Source

    with_type

    fn with_type(self: Rc<Self>, value: NotificationType) -> Rc<Self>
    

    Sets the type; returns the notification for chaining.

    Source

    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.

    Source

    set_expiration

    fn set_expiration(self: &Self, value: Duration)
    

    Source

    with_expiration

    fn with_expiration(self: Rc<Self>, value: Duration) -> Rc<Self>
    

    Sets the expiration; returns the notification for chaining.

    Source

    on_click

    fn on_click(self: &Self) -> Option<Rc<dyn Fn() -> ()>>
    

    An action to be run when the notification is clicked.

    Source

    set_on_click

    fn set_on_click(self: &Self, value: Option<Rc<dyn Fn() -> ()>>)
    

    Source

    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.

    Source

    on_close

    fn on_close(self: &Self) -> Option<Rc<dyn Fn() -> ()>>
    

    An action to be run when the notification is closed.

    Source

    set_on_close

    fn set_on_close(self: &Self, value: Option<Rc<dyn Fn() -> ()>>)
    

    Source

    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.

    Source

    on_property_changed

    fn on_property_changed(self: &Self, property_name: Option<&str>)
    

    Raises the property changed event. Overridable: see NotificationOverrides::on_property_changed.

    Source

    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.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.