|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Status-bar leaf widget for the ra8_widget tree model (#145 Phase 2). More...
#include "ra8_widget_status_bar.h"#include "ra8_check.h"#include "ra8_widget.h"#include "ra8_widget_internal.h"Go to the source code of this file.
Enumerations | |
| enum | ra8_widget_sb_geom_t : int16_t { k_ra8_widget_sb_no_rule = 0 } |
| No hairline: a rule_h at or below this draws no bottom rule. More... | |
Functions | |
| static void | internal_sb_label (const ra8_widget_paint_t *paint, const ra8_ui_rect_t *rect, const char *text, int16_t pad, ra8_widget_align_t align, uint32_t fg, uint32_t bg) |
| Draw one aligned label on the status band through the paint backend. | |
| static void | internal_sb_render (ra8_widget_t *w) |
| Status-bar vtable render: fill, left + right labels, bottom hairline. | |
| const ra8_widget_vtable_t * | ra8_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. | |
Variables | |
| static const char * | s_tag = "ra8_widget_status_bar" |
| Logging / check tag. | |
| static const ra8_widget_vtable_t | s_sb_vt |
| The single immutable vtable shared by every status bar. | |
Status-bar leaf widget for the ra8_widget tree model (#145 Phase 2).
Extracts the e-reader top band into a reusable ra8_widget leaf: a background fill, a left-aligned + a right-aligned label, and a bottom hairline rule, all painted through the injected ra8_widget_paint_t backend so the file carries no ra8_gfx dependency. Text placement reuses the shared RA8_PRIV priv_widget_text_pos helper (left / right alignment, vertical centring when the backend can measure). Display-only: the vtable leaves on_input NULL.
[Ring 5 / UI] {World: NS}
Definition in file ra8_widget_status_bar.c.
| enum ra8_widget_sb_geom_t : int16_t |
No hairline: a rule_h at or below this draws no bottom rule.
| Enumerator | |
|---|---|
| k_ra8_widget_sb_no_rule | Threshold below which the rule is skipped. |
Definition at line 34 of file ra8_widget_status_bar.c.
|
static |
Draw one aligned label on the status band through the paint backend.
Places text at align within rect via priv_widget_text_pos and draws it. A NULL text or a NULL draw_text backend is a no-op, so the left / right labels share one branch-coverable helper.
| [in] | paint | Draw backend (non-NULL). |
| [in] | rect | The band rectangle the text sits inside (non-NULL). |
| [in] | text | NUL-terminated ASCII, or NULL to draw nothing. |
| [in] | pad | Inner inset from the rect edges, pixels. |
| [in] | align | Horizontal alignment (left / right). |
| [in] | fg | Text colour, 0xRRGGBB. |
| [in] | bg | Background colour drawn behind the glyphs, 0xRRGGBB. |
paint and rect are non-NULL. text is NUL-terminated or NULL. text or draw_text is NULL. Definition at line 59 of file ra8_widget_status_bar.c.
References priv_widget_text_pos().
Referenced by internal_sb_render().
|
static |
Status-bar vtable render: fill, left + right labels, bottom hairline.
Reads the ra8_widget_status_bar_t from w->ctx, fills the rect with bg, draws the two labels via internal_sb_label, then – when rule_h > 0 – fills a rule strip along the band's bottom edge. A missing paint backend / fill_rect callback keeps drawing safe.
| [in] | w | The status-bar widget (its ctx is a ra8_widget_status_bar_t). |
w is non-NULL (guaranteed by ra8_widget_render_dirty). w->ctx points at a valid status-bar descriptor or is NULL. Definition at line 95 of file ra8_widget_status_bar.c.
References ra8_ui_rect_t::h, internal_sb_label(), k_ra8_widget_align_left, k_ra8_widget_align_right, k_ra8_widget_sb_no_rule, priv_widget_fill_box(), ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
|
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.
| [in,out] | w | Widget to turn into a status bar (non-NULL). |
| [in] | bar | Status-bar descriptor (non-NULL; outlives w's use). |
| k_ra8_ok | Bound; w renders bar. |
| k_ra8_err_null_ptr | w or bar is NULL. |
w and bar are non-NULL. bar outlives every render of w. w is left unchanged.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.
| 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.
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().
|
static |
The single immutable vtable shared by every status bar.
Definition at line 129 of file ra8_widget_status_bar.c.
Referenced by ra8_widget_status_bar_vtable().
|
static |
Logging / check tag.
Definition at line 29 of file ra8_widget_status_bar.c.