Files
roro9stack/lib/core/src/app.h
T
twislaandClaude Opus 5.5 e2326e113b Launcher: a grid of icons, with badges; the list stays as a Setting
The Launcher shows the Apps as a 4 x 3 grid of 32 x 32 icons, the
selected one's name under it (issue #9). The icons are the website's
own, doubled, and two drawn the same way for SSH and the Shell; they
are PNGs in assets/icons, turned into arrays by scripts/make_icons.py,
which CI checks. The selected tile is the website's: dark blue on cyan,
with notched corners.

- GridModel (lib/ui, host-tested) holds the selection and the scrolling.
- App::badge(): a dot on the tile for unread IRC messages, a Track
  recording, a Capture running, an SSH session open.
- Settings > Launcher: Grid or List.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
2026-10-09 23:14:37 +02:00

70 lines
2.4 KiB
C++

#pragma once
#include <cstdint>
#include <vector>
#include "key_event.h"
#include "key_help.h"
namespace roro {
class Canvas; // provided by the widget kit
// A foreground, user-facing program (see CONTEXT.md). Exactly one App is on screen at a time.
class App {
public:
virtual ~App() = default;
virtual void onEnter() {}
virtual void onExit() {}
// Return true if the key was consumed. An unconsumed Back leaves the App.
virtual bool onKey(const KeyEvent& event) {
(void)event;
return false;
}
// True while the App is editing text: the arrow keys then type ; . , / and need Fn to move.
virtual bool textEntryActive() const { return false; }
// The keys that work right now, for the help panel (Fn+h): the App's own, in the state it's
// in. Back, Home and the arrows are added for it. No screen names keys any other way.
virtual void help(std::vector<KeyHelp>& out) const { (void)out; }
// What the panel is titled with, when the App's name isn't enough ("Notes: editor").
virtual const char* helpTitle() const { return nullptr; }
// Called every main-loop pass while in the foreground (e.g. to refresh live values).
virtual void update(uint32_t nowMs) { (void)nowMs; }
virtual void draw(Canvas& canvas) = 0;
// True while the screen shows something a picture of it shouldn't hold: the screenshot key
// (Fn+p, issue #83) then refuses, and says so.
virtual bool showsSecret() const { return false; }
// An App whose screen is costly to draw again (a picture decoded from the card, issue #45) can
// keep what it drew: while this is true its part of the screen isn't cleared before draw(),
// which then draws only what changed. contentLost() says that it was cleared after all, or
// that something drawn over it has gone: everything has to be drawn again.
virtual bool retainsContent() const { return false; }
virtual void contentLost() {}
// True while something goes on in the App that is worth a look, whether it is in front or
// not (unread messages, a recording running): the Launcher marks its tile (issue #9).
virtual bool badge() const { return false; }
void requestRedraw() { redraw_ = true; }
bool consumeRedraw() {
bool r = redraw_;
redraw_ = false;
return r;
}
private:
bool redraw_ = false;
};
} // namespace roro