ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_widget_book_grid_t Struct Reference

A tappable N-column grid of book cards. More...

#include <ra8_widget_book.h>

Detailed Description

A tappable N-column grid of book cards.

Caller-owned plain data bound to a ra8_widget_t with ra8_widget_book_grid_init. books is a caller-owned array of count records tiled into cols columns (rows follow from the count), inset by pad and separated by gap. Each card stacks a cover, a label_h-tall title row, a label_h-tall author row, and a bar_h-tall progress bar. render paints the background then every card; on_input records the tapped card in selected and fires on_open.

Invariant
cols >= 1 (a cols of 0 is treated as 1 column).
selected holds a valid card index after any touch is consumed.
Example:
static const ra8_widget_book_t books[] = {
{.title = "Dune", .author = "Herbert", .cover = 0x00806040U, .percent = 42},
{.title = "1984", .author = "Orwell", .cover = 0x00404060U, .percent = 100},
};
ra8_widget_book_grid_t grid = {.paint = &paint, .books = books, .count = 2,
.cols = 2, .bg = 0x00FFFFFFU, .pad = 8,
.gap = 8, .label_h = 16, .bar_h = 4, ...};
ra8_widget_t w = {};
(void)ra8_widget_book_grid_init(&w, &grid);
struct ra8_widget ra8_widget_t
ra8_err_t ra8_widget_book_grid_init(ra8_widget_t *w, ra8_widget_book_grid_t *grid)
Bind a widget instance to a book grid.
struct ra8_widget_book_grid ra8_widget_book_grid_t
const ra8_widget_paint_t * paint
Draw backend (NULL -> draws nothing).
const ra8_widget_book_t * books
Array of count book records.
One book card's data: cover colour, title, author, read progress.
See also
ra8_widget_book_grid_init
ra8_widget_book_t
Since
0.1.0

The documentation for this struct was generated from the following file: