#pragma once #include #include #include #include "event.h" namespace roro { struct Toast { std::string text; NotificationLevel level; uint32_t id; // unique per push, to tell two identical Toasts apart }; // Notifications waiting to be shown as Toasts, one at a time, each for the same duration. class ToastQueue { public: explicit ToastQueue(uint32_t durationMs, size_t capacity = 4) : durationMs_(durationMs), capacity_(capacity) {} void push(const std::string& text, NotificationLevel level, uint32_t nowMs); // The Toast to show now, or nullptr. Advances the queue as Toasts expire. const Toast* current(uint32_t nowMs); void dismiss(uint32_t nowMs); // True once after the visible Toast changed (appeared, switched or disappeared). bool takeChanged(); private: uint32_t durationMs_; size_t capacity_; std::deque queue_; bool showing_ = false; uint32_t shownAtMs_ = 0; bool changed_ = false; uint32_t nextId_ = 1; }; } // namespace roro