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

Book-card + book-grid leaf widget for the ra8_widget tree (#145 Phase 2). More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_widget.h"
Include dependency graph for ra8_widget_book.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_widget_book
struct  ra8_widget_book_grid

Typedefs

typedef struct ra8_widget_book ra8_widget_book_t
typedef struct ra8_widget_book_grid ra8_widget_book_grid_t

Functions

const ra8_widget_vtable_tra8_widget_book_grid_vtable (void)
 Return the shared vtable backing every book-grid widget.
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.

Detailed Description

Book-card + book-grid leaf widget for the ra8_widget tree (#145 Phase 2).

The e-reader Library screen is a grid of book cards: each card is a cover swatch above a title, an author line, and a read-progress bar, and tapping a card opens the book. ra8_widget_book_grid_t extracts that whole grid into one reusable ra8_widget leaf, driven by an array of ra8_widget_book_t records. render fills the grid background, tiles the cards into an N-column grid, and paints each card (cover / title / author / progress) through the injected ra8_widget_paint_t backend, so the widget carries no ra8_gfx dependency. on_input maps a touch to the card it lands on, records it in selected, and fires the optional on_open callback.

[Ring 5 / UI] {World: NS}

Since
0.1.0

Definition in file ra8_widget_book.h.

Typedef Documentation

◆ ra8_widget_book_grid_t

typedef struct ra8_widget_book_grid ra8_widget_book_grid_t

◆ ra8_widget_book_t

typedef struct ra8_widget_book ra8_widget_book_t

Function Documentation

◆ ra8_widget_book_grid_init()

ra8_err_t ra8_widget_book_grid_init ( ra8_widget_t * w,
ra8_widget_book_grid_t * grid )
nodiscard

Bind a widget instance to a book grid.

Wires w to render + route grid: sets its vtable to ra8_widget_book_grid_vtable, points its ctx at grid, and makes it visible. The caller still sets w's fixed / flex for its parent's layout.

Parameters
[in,out]wWidget to turn into a book grid (non-NULL).
[in]gridBook-grid descriptor (non-NULL; outlives w's use).
Returns
ra8_err_t
Return values
k_ra8_okBound; w renders + routes grid.
k_ra8_err_null_ptrw or grid is NULL.
Precondition
w and grid are non-NULL.
grid outlives every render / dispatch of w.
Postcondition
On success w->vt == ra8_widget_book_grid_vtable(), w->ctx == grid, w->visible == true.
On failure w is left unchanged.
Note
Not thread-safe.
See also
ra8_widget_book_grid_vtable
Since
0.1.0

Definition at line 317 of file ra8_widget_book.c.

References k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_widget_book_grid_vtable(), and s_tag.

◆ ra8_widget_book_grid_vtable()

const ra8_widget_vtable_t * ra8_widget_book_grid_vtable ( void )

Return the shared vtable backing every book-grid widget.

One immutable vtable serves all book grids: render fills the background and tiles + paints every card through the grid's ra8_widget_paint_t; on_input maps a touch to a card and fires on_open; measure is NULL. ra8_widget_book_grid_init binds it.

Returns
Non-NULL pointer to the static book-grid vtable.
Precondition
None.
None.
Postcondition
The returned pointer is non-NULL and references static storage.
No state is modified.
Note
Pure; thread-safe (returns a pointer to immutable static data).
See also
ra8_widget_book_grid_init
Since
0.1.0

Definition at line 312 of file ra8_widget_book.c.

References s_bg_vt.

Referenced by ra8_widget_book_grid_init(), and wd_build_tree().