JFLib

Toasts, spinners, progress#

Source: lib/ui/notify.rs

notify -- transient feedback: toasts, spinner, indeterminate progress

  toast(kind, title, msg, ms)         queue a notification card (IB_INFO .. IB_ERROR; ms 0
                                      = 5 s, u32::MAX = until closed); returns its id
  toast_host()                        draw the queued toasts (bottom right, newest at the
                                      bottom, above dialogs); call it once per frame after
                                      the content.  Hovering keeps a toast; its close button
                                      removes it; expiry wakes the loop (timer UIT_TOAST).
                                      Records: the card (K_BOX, the title), its message
                                      (K_TEXT) and the close button (K_BUTTON "Schließen").
  toast_dismiss(id) / toast_clear()
  toasts() -> [(id, kind, title, msg)]   the queued toasts (a notification history)
  spinner(id, size_dip)               a turning ring while something loads
  progress_indeterminate(id)          a bar with a running segment (natural 200 x 4 DIP)
The animations keep the window repainting while they are shown.

impl Ui

  • fn toast(&mut self, kind: u32, title: &str, msg: &str, ms: u32) -> u32 ui_toast(kind, title, msg, ms) -> toast id
  • fn toast_dismiss(&mut self, id: u32) ui_toast_dismiss(id)
  • fn toast_clear(&mut self) ui_toast_clear
  • fn toasts(&self) -> Vec<(u32, u32, String, String)> the queued toasts: (id, kind, title, message)
  • fn toast_host(&mut self) ui_toast_host: draw the toasts (once per frame, after the content)
  • fn spinner(&mut self, id: u32, size: i32) ui_spinner(id, size_dip): a turning ring
  • fn progress_indeterminate(&mut self, id: u32) ui_progress_indeterminate(id): a bar with a running segment

Source: docs/API.md in the JFLib repository.