ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_widget_book.h
Go to the documentation of this file.
1
25
26#pragma once
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <stdint.h>
33
34#include "ra8_err.h"
35#include "ra8_widget.h"
36
53typedef struct ra8_widget_book {
54 const char* title;
55 const char* author;
56 uint32_t cover;
57 uint16_t percent;
59
93typedef struct ra8_widget_book_grid {
97 void (*on_open)(struct ra8_widget* w, uint16_t index);
98 uint32_t bg;
99 uint32_t title_fg;
100 uint32_t author_fg;
101 uint32_t bar_track;
102 uint32_t bar_fill;
103 uint16_t count;
104 uint16_t cols;
105 uint16_t selected;
106 int16_t pad;
107 int16_t gap;
108 int16_t label_h;
109 int16_t bar_h;
111
133
160
161#ifdef __cplusplus
162}
163#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Zero-heap composable widget layer (dwm-style) over ra8_box + ra8_ui.
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.
const ra8_widget_vtable_t * ra8_widget_book_grid_vtable(void)
Return the shared vtable backing every book-grid widget.
struct ra8_widget_book ra8_widget_book_t
A tappable N-column grid of book cards.
int16_t bar_h
Card progress-bar height, pixels.
uint32_t author_fg
Author text colour, 0xRRGGBB.
uint32_t bar_track
Card progress track colour, 0xRRGGBB.
uint16_t cols
Grid columns (>= 1).
void(* on_open)(struct ra8_widget *w, uint16_t index)
Tap callback (opt/NULL).
uint16_t selected
Last-tapped card index (observable).
int16_t label_h
Title / author row height, pixels.
const ra8_widget_paint_t * paint
Draw backend (NULL -> draws nothing).
uint32_t title_fg
Title text colour, 0xRRGGBB.
int16_t pad
Grid inner padding, pixels.
uint32_t bar_fill
Card progress fill colour, 0xRRGGBB.
uint16_t count
Number of book cards.
const ra8_widget_book_t * books
Array of count book records.
uint32_t bg
Grid background colour, 0xRRGGBB.
int16_t gap
Gap between cards, pixels.
One book card's data: cover colour, title, author, read progress.
uint32_t cover
Cover swatch fill colour, 0xRRGGBB.
const char * title
Title line (NUL-terminated; NULL -> none).
const char * author
Author line (NUL-terminated; NULL -> none).
uint16_t percent
Read progress 0..100 (saturates at 100).
Drawing backend the concrete leaf widgets paint through (a DI seam).
One widget instance (caller-owned, no allocation).
Behaviour table shared by all widgets of one kind.
Definition ra8_widget.h:121