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

Navigation-strip leaf widget for the ra8_widget tree model (#145 Phase 2). More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_widget.h"
Include dependency graph for ra8_widget_nav_bar.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_nav_bar

Typedefs

typedef struct ra8_widget_nav_bar ra8_widget_nav_bar_t

Functions

const ra8_widget_vtable_tra8_widget_nav_bar_vtable (void)
 Return the shared vtable backing every navigation-strip widget.
ra8_err_t ra8_widget_nav_bar_init (ra8_widget_t *w, ra8_widget_nav_bar_t *nav)
 Bind a widget instance to a navigation strip.

Detailed Description

Navigation-strip leaf widget for the ra8_widget tree model (#145 Phase 2).

The e-reader Library screen ends in a bottom navigation strip: a row of equal destinations (Library / Store / Settings ...) with the active one inked and the rest muted, each a tap target. ra8_widget_nav_bar_t extracts that into a reusable ra8_widget leaf. render fills the strip and centres each item's label in its equal-width cell (active vs muted colour) through the injected ra8_widget_paint_t backend, so the widget carries no ra8_gfx dependency. on_input maps a touch to the cell it landed in, records it in selected, and fires the optional on_select callback; a button event is declined.

[Ring 5 / UI] {World: NS}

Since
0.1.0

Definition in file ra8_widget_nav_bar.h.

Typedef Documentation

◆ ra8_widget_nav_bar_t

typedef struct ra8_widget_nav_bar ra8_widget_nav_bar_t

Function Documentation

◆ ra8_widget_nav_bar_init()

ra8_err_t ra8_widget_nav_bar_init ( ra8_widget_t * w,
ra8_widget_nav_bar_t * nav )
nodiscard

Bind a widget instance to a navigation strip.

Wires w to render + route nav: sets its vtable to ra8_widget_nav_bar_vtable, points its ctx at nav, 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 nav strip (non-NULL).
[in]navNav-strip descriptor (non-NULL; outlives w's use).
Returns
ra8_err_t
Return values
k_ra8_okBound; w renders + routes nav.
k_ra8_err_null_ptrw or nav is NULL.
Precondition
w and nav are non-NULL.
nav outlives every render / dispatch of w.
Postcondition
On success w->vt == ra8_widget_nav_bar_vtable(), w->ctx == nav, w->visible == true.
On failure w is left unchanged.
Note
Not thread-safe.
See also
ra8_widget_nav_bar_vtable
Since
0.1.0

Definition at line 231 of file ra8_widget_nav_bar.c.

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

◆ ra8_widget_nav_bar_vtable()

const ra8_widget_vtable_t * ra8_widget_nav_bar_vtable ( void )

Return the shared vtable backing every navigation-strip widget.

One immutable vtable serves all nav strips: render fills the strip and centres each label in its cell through the strip's ra8_widget_paint_t; on_input maps a touch to a cell and fires on_select; measure is NULL. ra8_widget_nav_bar_init binds it.

Returns
Non-NULL pointer to the static nav-strip 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_nav_bar_init
Since
0.1.0

Definition at line 226 of file ra8_widget_nav_bar.c.

References s_nav_vt.

Referenced by ra8_widget_nav_bar_init(), and wd_build_tree().