Public Access
Add widget kit, input layer with Compose Key, Launcher and demo apps
Steps 5 and 6 of M0. - lib/ui (host-tested): ListModel, LineEditor (UTF-8, byte-limited), wrapText, ToastQueue, DialogModel - lib/input (host-tested): KeyMapper turns keyboard state into logical keys (Fn arrows, ` Back, Fn+` Home) and composes accents with opt - src/ui: off-screen 16-bit frame pushed in one transfer (fixes the flicker), Status Bar, list, text, line editor, dialog, Toast widgets, Notifier (Toast + beep + LED), vendored public-domain Latin-1 fonts - Apps: minimal Launcher, Widget demo, Diagnostics (SD erase now behind a confirmation dialog) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
|
||||
#include "event.h"
|
||||
|
||||
namespace roro {
|
||||
|
||||
struct Toast {
|
||||
std::string text;
|
||||
NotificationLevel level;
|
||||
};
|
||||
|
||||
// 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<Toast> queue_;
|
||||
bool showing_ = false;
|
||||
uint32_t shownAtMs_ = 0;
|
||||
bool changed_ = false;
|
||||
};
|
||||
|
||||
} // namespace roro
|
||||
Reference in New Issue
Block a user