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

A proportional progress bar: a track plus a value / total fill. More...

#include <ra8_widget_progress_bar.h>

Detailed Description

A proportional progress bar: a track plus a value / total fill.

Caller-owned plain data bound to a ra8_widget_t with ra8_widget_progress_bar_init. render fills the whole rect with track, then fills the leftmost clamp(value, 0, total) / total fraction with fill. A total of 0 or a zero-width rect paints the track only (no divide, no fill); a value >= total paints a full bar. The bar is horizontal (fills left to right); rotate the containing panel for a vertical gauge.

Invariant
total == 0 is treated as "empty" (0% fill), never a divide.
The filled portion never exceeds the widget rect width.
Example:
static const ra8_widget_paint_t paint = { ... };
ra8_widget_progress_bar_t bar = {.paint = &paint, .track = 0x00303030U,
.fill = 0x00E0A020U, .value = 3, .total = 10};
ra8_widget_t w = {};
(void)ra8_widget_progress_bar_init(&w, &bar); // 30% bar
struct ra8_widget ra8_widget_t
ra8_err_t ra8_widget_progress_bar_init(ra8_widget_t *w, ra8_widget_progress_bar_t *bar)
Bind a widget instance to a progress bar.
Drawing backend the concrete leaf widgets paint through (a DI seam).
A proportional progress bar: a track plus a value / total fill.
See also
ra8_widget_progress_bar_init
Since
0.1.0

The documentation for this struct was generated from the following file: