|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Text-label leaf widget for the ra8_widget tree model (#145 Phase 2). More...
Go to the source code of this file.
Enumerations | |
| enum | ra8_widget_label_geom_t : int16_t { k_ra8_widget_label_no_border = 0 } |
| No border on a plain label – a single background fill. More... | |
Functions | |
| static void | internal_label_render (ra8_widget_t *w) |
| Label vtable render: fill the background, then draw the aligned text. | |
| const ra8_widget_vtable_t * | ra8_widget_label_vtable (void) |
| Return the shared vtable backing every text-label widget. | |
| ra8_err_t | ra8_widget_label_init (ra8_widget_t *w, ra8_widget_label_t *label) |
| Bind a widget instance to a text label. | |
Variables | |
| static const char * | s_tag = "ra8_widget_label" |
| Logging / check tag. | |
| static const ra8_widget_vtable_t | s_label_vt |
| The single immutable vtable shared by every text label. | |
Text-label leaf widget for the ra8_widget tree model (#145 Phase 2).
The simplest concrete leaf the panel compositor can composite: a background fill plus an aligned string. Its render paints through the injected ra8_widget_paint_t backend (so the file stays free of any ra8_gfx dependency) and its vtable leaves on_input NULL because a label is purely display – it never consumes a touch. The geometry is delegated to the shared RA8_PRIV helpers in ra8_widget_paint.c, so a label is just "fill the box, place the text". Binding a widget with ra8_widget_label_init makes it a label that drops into any panel's child array.
[Ring 5 / UI] {World: NS}
Definition in file ra8_widget_label.c.
| enum ra8_widget_label_geom_t : int16_t |
No border on a plain label – a single background fill.
Passed as the border_w to priv_widget_fill_box so the label paints exactly one fill (no frame), unlike the bordered button.
| Enumerator | |
|---|---|
| k_ra8_widget_label_no_border | RA8 widget label no border. |
Definition at line 36 of file ra8_widget_label.c.
|
static |
Label vtable render: fill the background, then draw the aligned text.
Reads the ra8_widget_label_t from w->ctx, fills the rect with bg, then – when there is text and a draw_text backend – places it via priv_widget_text_pos and draws it. Each guard is a single condition so a missing backend / text is a safe no-op.
| [in] | w | The label widget (its ctx is a ra8_widget_label_t). |
w is non-NULL (guaranteed by ra8_widget_render_dirty). w->ctx points at a valid label descriptor or is NULL. Definition at line 56 of file ra8_widget_label.c.
References k_ra8_widget_label_no_border, priv_widget_fill_box(), and priv_widget_text_pos().
|
nodiscard |
Bind a widget instance to a text label.
Wires w to render label: sets its vtable to ra8_widget_label_vtable, points its ctx at label, and makes it visible. The caller still sets w's fixed / flex for its parent's layout.
| [in,out] | w | Widget to turn into a label (non-NULL). |
| [in] | label | Label descriptor (non-NULL; outlives w's use). |
| k_ra8_ok | Bound; w renders label. |
| k_ra8_err_null_ptr | w or label is NULL. |
w and label are non-NULL. label outlives every render of w. w is left unchanged.Definition at line 90 of file ra8_widget_label.c.
References k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_widget_label_vtable(), and s_tag.
Referenced by wk_build_tree().
| const ra8_widget_vtable_t * ra8_widget_label_vtable | ( | void | ) |
Return the shared vtable backing every text-label widget.
One immutable vtable serves all labels: render fills the background and draws the aligned text through the label's ra8_widget_paint_t; measure and on_input are NULL (a label sizes from its parent's fixed/flex and never consumes input). ra8_widget_label_init binds it, so callers rarely need it directly – it is exposed for tests and hand-built widgets.
Definition at line 85 of file ra8_widget_label.c.
References s_label_vt.
Referenced by ra8_widget_label_init().
|
static |
The single immutable vtable shared by every text label.
Definition at line 79 of file ra8_widget_label.c.
Referenced by ra8_widget_label_vtable().
|
static |
Logging / check tag.
Definition at line 29 of file ra8_widget_label.c.