gpui-kit GitHub

Components

NotificationCenter view

The list of notifications a window has accumulated.

A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).

use gpui_kit::overlay::NotificationCenter;

Construct

new(ident: impl Into<Ident>, cx: &mut Context<Self>) -> Self

Options

Chain onto the value.

capacity(capacity: usize) -> Self

Commands

Need a Context, so they need a view.

show(notification: Notification, cx: &mut Context<Self>) -> bool
record(notification: Notification, cx: &mut Context<Self>)
mark_read(id: &str, cx: &mut Context<Self>) -> bool
mark_all_read(cx: &mut Context<Self>)
dismiss(id: &str, cx: &mut Context<Self>) -> bool
clear(cx: &mut Context<Self>)

Queries

Only answer; they change nothing.

len() -> usize
is_empty() -> bool
holds(id: &str) -> bool
is_read(id: &str) -> Option<bool>
unread() -> UnreadCount

Reports

The variants of the event it emits. It never applies the change itself.

Rendered by

Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.

Source: crates/gpui-kit/src/overlay/notification_center.rs