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

Status-bar 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_status_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_status_bar

Typedefs

typedef struct ra8_widget_status_bar ra8_widget_status_bar_t

Functions

const ra8_widget_vtable_tra8_widget_status_bar_vtable (void)
 Return the shared vtable backing every status-bar widget.
ra8_err_t ra8_widget_status_bar_init (ra8_widget_t *w, ra8_widget_status_bar_t *bar)
 Bind a widget instance to a status bar.

Detailed Description

Status-bar leaf widget for the ra8_widget tree model (#145 Phase 2).

Both e-reader screens open with the same top band: a heading / wordmark hugging the left, a status string (clock, battery) hugging the right, and a hairline rule under the band. ra8_widget_status_bar_t extracts that into a reusable ra8_widget leaf: it fills its rect with bg, draws the left-aligned left text and the right-aligned right text (each vertically centred when the paint backend can measure a string), then paints a rule hairline rule_h pixels tall along its bottom edge. Painting goes through the injected ra8_widget_paint_t backend, so the widget carries no ra8_gfx dependency and is host-testable. It is display-only, so its vtable leaves on_input NULL.

[Ring 5 / UI] {World: NS}

Since
0.1.0

Definition in file ra8_widget_status_bar.h.

Typedef Documentation

◆ ra8_widget_status_bar_t

typedef struct ra8_widget_status_bar ra8_widget_status_bar_t

Function Documentation

◆ ra8_widget_status_bar_init()

ra8_err_t ra8_widget_status_bar_init ( ra8_widget_t * w,
ra8_widget_status_bar_t * bar )
nodiscard

Bind a widget instance to a status bar.

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

Definition at line 140 of file ra8_widget_status_bar.c.

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

◆ ra8_widget_status_bar_vtable()

const ra8_widget_vtable_t * ra8_widget_status_bar_vtable ( void )

Return the shared vtable backing every status-bar widget.

One immutable vtable serves all status bars: render fills the background, draws the left + right labels and the bottom hairline through the bar's ra8_widget_paint_t; measure and on_input are NULL (a status bar sizes from its parent's fixed/flex and never consumes input). ra8_widget_status_bar_init binds it, so callers rarely need it directly.

Returns
Non-NULL pointer to the static status-bar 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_status_bar_init
Since
0.1.0

Definition at line 135 of file ra8_widget_status_bar.c.

References s_sb_vt.

Referenced by ra8_widget_status_bar_init(), and wd_build_tree().