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

Toolbar 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_toolbar.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_toolbar

Typedefs

typedef struct ra8_widget_toolbar ra8_widget_toolbar_t

Functions

const ra8_widget_vtable_tra8_widget_toolbar_vtable (void)
 Return the shared vtable backing every toolbar widget.
ra8_err_t ra8_widget_toolbar_init (ra8_widget_t *w, ra8_widget_toolbar_t *bar)
 Bind a widget instance to a toolbar.

Detailed Description

Toolbar leaf widget for the ra8_widget tree model (#145 Phase 2).

The e-reader Library screen carries a toolbar: a wide search field on the left (a bordered box showing a placeholder hint) and a fixed-width count chip on the right (e.g. "12 books"). Tapping the search field opens the on-screen keyboard. ra8_widget_toolbar_t extracts that into a reusable ra8_widget leaf. render fills the band, draws the bordered search field with its hint and the right-aligned count text, all through the injected ra8_widget_paint_t backend (no ra8_gfx dependency). on_input treats the search field as a tap target: a touch inside it bumps searches, self-invalidates fast, and fires the optional on_search callback; a tap on the count chip (or a button event) is declined so it keeps routing.

[Ring 5 / UI] {World: NS}

Since
0.1.0

Definition in file ra8_widget_toolbar.h.

Typedef Documentation

◆ ra8_widget_toolbar_t

typedef struct ra8_widget_toolbar ra8_widget_toolbar_t

Function Documentation

◆ ra8_widget_toolbar_init()

ra8_err_t ra8_widget_toolbar_init ( ra8_widget_t * w,
ra8_widget_toolbar_t * bar )
nodiscard

Bind a widget instance to a toolbar.

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

Definition at line 164 of file ra8_widget_toolbar.c.

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

◆ ra8_widget_toolbar_vtable()

const ra8_widget_vtable_t * ra8_widget_toolbar_vtable ( void )

Return the shared vtable backing every toolbar widget.

One immutable vtable serves all toolbars: render fills the band, the bordered search field + hint, and the count chip through the toolbar's ra8_widget_paint_t; on_input latches a touch inside the search field and declines everything else; measure is NULL. ra8_widget_toolbar_init binds it.

Returns
Non-NULL pointer to the static toolbar 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_toolbar_init
Since
0.1.0

Definition at line 159 of file ra8_widget_toolbar.c.

References s_tb_vt.

Referenced by ra8_widget_toolbar_init(), and wd_build_tree().