pub struct Notifications<U> { /* private fields */ }Expand description
A Widget to show notifications
With the FooterWidgets (a WidgetAlias), this Widget
can be conveniently placed alongside a PromptLine and a
StatusLine, in a combination that hides the PromptLine
when it is not in use, covering it with the Notifications, and
vice-versa. This is the default behaviour of Duat.
use duat_core::{hook::OnWindowOpen, prelude::*};
use duat_utils::{state::*, widgets::*};
fn setup_generic_over_ui<U: Ui>() {
hook::remove("WindowWidgets");
hook::add::<OnWindowOpen<U>, U>(|pa, builder| {
let footer = FooterWidgets::default().notifs(Notifications::cfg().formatted(|rec| {
Some(txt!(
"[notifs.bracket]([notifs.target]{}[notifs.bracket]) {}",
rec.target(),
rec.text().clone()
))
}));
builder.push(pa, footer);
});
}Trait Implementations§
Source§impl<U: Ui> Widget<U> for Notifications<U>
impl<U: Ui> Widget<U> for Notifications<U>
Source§fn once() -> Result<(), Text>
fn once() -> Result<(), Text>
Actions taken when this widget opens for the first time Read more
Source§fn on_focus(pa: &mut Pass, handle: Handle<Self, U>)where
Self: Sized,
fn on_focus(pa: &mut Pass, handle: Handle<Self, U>)where
Self: Sized,
Actions to do whenever this
Widget is focusedAuto Trait Implementations§
impl<U> !Freeze for Notifications<U>
impl<U> !RefUnwindSafe for Notifications<U>
impl<U> !Send for Notifications<U>
impl<U> !Sync for Notifications<U>
impl<U> Unpin for Notifications<U>where
U: Unpin,
impl<U> !UnwindSafe for Notifications<U>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more