Public Access
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
34 lines
988 B
C++
34 lines
988 B
C++
#pragma once
|
|
|
|
namespace roro {
|
|
|
|
// Selection and scrolling for a grid of `cols` columns showing `visibleRows` rows at a time, filled
|
|
// row by row. Left and Right go through every item and wrap around; Up and Down stay in the
|
|
// column and wrap around, landing on the last item where the last row has no such column.
|
|
class GridModel {
|
|
public:
|
|
GridModel(int cols, int visibleRows) : cols_(cols), rows_(visibleRows) {}
|
|
|
|
void setCount(int count);
|
|
int count() const { return count_; }
|
|
int selected() const { return selected_; } // -1 when empty
|
|
int cols() const { return cols_; }
|
|
int rows() const { return count_ ? (count_ - 1) / cols_ + 1 : 0; }
|
|
int firstVisibleRow() const { return first_; }
|
|
int visibleRows() const { return rows_; }
|
|
|
|
void select(int index);
|
|
void left();
|
|
void right();
|
|
void up();
|
|
void down();
|
|
|
|
private:
|
|
int cols_, rows_;
|
|
int count_ = 0;
|
|
int selected_ = -1;
|
|
int first_ = 0;
|
|
};
|
|
|
|
} // namespace roro
|