Files
roro9stack/src/ui/widgets.h
T
twislaandClaude Opus 5.5 51698a8011 M0 step 7: Settings, About, Storage, first-boot setup
- lib/apps_model (host-tested): SettingsMenu (rows, readable values,
  choices, validation messages) and SetupWizard (names, Region
  confirmation, timezone; saves only when finished)
- AppManager: modal Apps that Home/Back can't leave (setup wizard)
- SettingsApp: all settings plus Storage (usage, erase SD behind a
  dialog) and About (version, node id, battery, memory, uptime) pages,
  replacing the temporary Diagnostics App
- SetupApp: first-boot wizard, opened modally until SetupDone
- Node id and default names derived from the MAC like Meshtastic
- Widget demo is now hidden (About, then w)
- lib_ldf_mode = deep+ so libraries see each other's headers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
2026-10-02 13:47:03 +02:00

55 lines
1.8 KiB
C++

#pragma once
#include <functional>
#include <string>
#include <vector>
#include "canvas.h"
#include "dialog_model.h"
#include "line_editor.h"
#include "list_model.h"
#include "text_wrap.h"
#include "theme.h"
#include "toast_queue.h"
namespace roro {
struct StatusInfo {
std::string title;
int batteryPercent = -1; // -1: unknown
std::string clock = "--:--";
bool sdPresent = false;
int sdLevel = 0; // StorageMonitor level
char compose = 0; // pending Compose Key state
bool operator==(const StatusInfo& o) const {
return title == o.title && batteryPercent == o.batteryPercent && clock == o.clock &&
sdPresent == o.sdPresent && sdLevel == o.sdLevel && compose == o.compose;
}
bool operator!=(const StatusInfo& o) const { return !(*this == o); }
};
namespace widgets {
// Width in pixels of text in the body font.
MeasureText bodyMeasure(Canvas& canvas);
void statusBar(Canvas& c, const StatusInfo& info);
// A selectable list; `label(i)` gives row i's text and `value(i)`, if given, a right-aligned value.
void list(Canvas& c, const ListModel& model, theme::Rect area, const std::function<std::string(int)>& label,
const std::function<std::string(int)>& value = nullptr);
// Pre-wrapped lines starting at `firstLine`, with a scroll indicator when they don't all fit.
void textLines(Canvas& c, const std::vector<std::string>& lines, int firstLine, theme::Rect area);
// One line of editable text with a cursor; scrolls horizontally to keep the cursor visible.
void lineEditor(Canvas& c, const LineEditor& editor, theme::Rect area);
void dialog(Canvas& c, const std::string& title, const std::string& message, const DialogModel& model);
void toast(Canvas& c, const Toast& t);
} // namespace widgets
} // namespace roro