17static const char*
s_tag =
"ra8_widget";
37 return (r->
w <= 0) && (r->
h <= 0);
58 return (a < b) ? a : b;
79 return (a > b) ? a : b;
111 const ra8_ui_rect_t out = {.x = x0, .y = y0, .w = x1 - x0, .h = y1 - y0};
134 for (uint16_t i = 0U; i < count; ++i) {
135 if (widgets[i].visible) {
181 if ((uint32_t)cap < ((uint32_t)vis + 1U)) {
199 for (uint16_t i = 0U; i < count; ++i) {
200 if (!widgets[i].visible) {
205 leaf.
fixed = widgets[i].fixed;
206 leaf.
flex = widgets[i].flex;
207 leaf.
tag = (int16_t)widgets[i].action_id;
241 uint16_t box_idx = 1U;
242 for (uint16_t i = 0U; i < count; ++i) {
243 if (!widgets[i].visible) {
246 widgets[i].rect = box_scratch[box_idx].
rect;
259 if ((count > 0U) && (widgets ==
nullptr)) {
262 *out_handled =
false;
264 for (uint16_t i = 0U; i < count; ++i) {
266 if (!w->visible || (w->vt ==
nullptr) || (w->vt->on_input ==
nullptr)) {
274 *out_handled = w->vt->on_input(w, ev);
278 if (w->vt->on_input(w, ev)) {
293 if ((uint8_t)refresh > w->refresh) {
294 w->refresh = (uint8_t)refresh;
308 if ((count > 0U) && (widgets ==
nullptr)) {
315 for (uint16_t i = 0U; i < count; ++i) {
316 if (!widgets[i].visible || !widgets[i].dirty) {
320 if (widgets[i].refresh > hint) {
321 hint = widgets[i].refresh;
333 if ((count > 0U) && (widgets ==
nullptr)) {
336 for (uint16_t i = 0U; i < count; ++i) {
338 if (!w->visible || !w->dirty) {
341 if ((w->vt !=
nullptr) && (w->vt->render !=
nullptr)) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_err_t ra8_box_tree_init(ra8_box_tree_t *tree, ra8_box_t *storage, uint16_t cap)
Bind a tree builder to caller-owned node storage.
ra8_err_t ra8_box_layout(ra8_box_tree_t *tree, int16_t root, const ra8_ui_rect_t *frame)
Lay out the tree, filling every node's rect.
@ k_ra8_box_none
No child / no sibling link.
int16_t ra8_box_add(ra8_box_tree_t *tree, int16_t parent, const ra8_box_t *node)
Append a node and link it as a child of parent.
@ k_ra8_box_stack_v
Vertical stack: children stack top->bottom.
@ k_ra8_box_leaf
Terminal box (no children laid out).
@ k_ra8_box_stack_h
Horizontal stack: children left->right.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_null_ptr
Pointer was NULL where a valid pointer was required.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
bool ra8_ui_rect_contains(const ra8_ui_rect_t *r, int32_t px, int32_t py)
Test whether a point lies inside a rectangle.
One node in a box tree (caller-owned).
uint8_t kind
ra8_box_kind_t.
uint16_t flex
Flex weight when not fixed.
int16_t fixed
Fixed main-axis extent; 0 => use flex.
int16_t tag
Caller tag (e.g.
int16_t gap
Gap between children.
int16_t pad
Inner padding (all four sides).
ra8_ui_rect_t rect
OUTPUT: computed rectangle.
Append-only builder over caller-owned node storage.
Axis-aligned rectangle in framebuffer pixel coordinates.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).