|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
Caller-owned Gregorian calendar, no allocation, libc calendar or clock. More...
#include "a11y_types.h"#include "input.h"#include "font.h"#include "style_ext.h"#include "draw_target.h"#include "ui_context.h"Data Structures | |
| struct | rmgui_date_t |
| One civil date; month/day are one-based and year is 1..9999. More... | |
| struct | rmgui_iso_week_t |
| ISO week-year, week 1..53, weekday 1 Monday . More... | |
| struct | rmgui_datepicker_config_t |
| rmgui_datepicker_config_t.month_count, rmgui_datepicker_config_t.weekday_count More... | |
| struct | rmgui_datepicker_t |
| rmgui_datepicker_t.hover, rmgui_datepicker_t.pressed More... | |
| struct | rmgui_datepicker_cell_t |
| struct | rmgui_datepicker_layout_t |
| 42 cells in month view; 12 in year/decade view. More... | |
Macros | |
| #define | RMGUI_DATEPICKER_GRID SIZE_MAX |
| #define | RMGUI_DATEPICKER_STYLE_PROPERTIES 9u |
Typedefs | |
| typedef int(*) | rmgui_datepicker_disabled_fn(void *, rmgui_date_t) |
| Nonzero disables a date. | |
Functions | |
| int | rmgui_datepicker_prepare (const rmgui_ui_t *, const rmgui_datepicker_t *) |
| Stage the initialized calendar's current labels before recording. | |
| int | rmgui_datepicker_draw (const rmgui_ui_t *, const rmgui_datepicker_t *, const rmgui_style_ext_resolved_t *, const rmgui_datepicker_layout_t *) |
| Draw an arranged calendar with a borrowed, device-resolved datepicker extension style. | |
| int | rmgui_date_valid (rmgui_date_t) |
| Return 1 for a Gregorian civil date in the supported domain, else 0. | |
| int | rmgui_date_days_from_civil (rmgui_date_t, int *) |
| Convert a valid civil date to days since 1970-01-01. | |
| int | rmgui_date_civil_from_days (int, rmgui_date_t *) |
| Inverse serial conversion; out-of-domain serials refuse unchanged. | |
| int | rmgui_date_iso_week (rmgui_date_t, rmgui_iso_week_t *) |
| Compute ISO 8601 week-year, week and weekday for a valid civil date. | |
| int | rmgui_datepicker_init (rmgui_datepicker_t *, const rmgui_datepicker_config_t *) |
| Bind localization/configuration. | |
| int | rmgui_datepicker_cells (const rmgui_datepicker_t *, rmgui_datepicker_cell_t *, size_t) |
| Grid needs capacity >=42, even at zoom; refuses atomically. | |
| int | rmgui_datepicker_layout (const rmgui_datepicker_t *, rmgui_rect_t, rmgui_datepicker_layout_t *) |
| Calculate month/zoom cells and controls for positive, representable bounds. | |
| int | rmgui_datepicker_select (rmgui_datepicker_t *, rmgui_date_t) |
| Select commits a single day, or alternates range anchor/completed range. | |
| int | rmgui_datepicker_navigate (rmgui_datepicker_t *, int steps) |
| Navigate by months/years/decades according to zoom; never wraps years. | |
| int | rmgui_datepicker_zoom (rmgui_datepicker_t *, rmgui_datepicker_zoom_t) |
| Change view without selection changes; disabled state or invalid zoom refuses. | |
| int | rmgui_datepicker_time (rmgui_datepicker_t *, int part, int steps) |
| Step part 1 hour, 2 minute or 3 second without carrying into other parts. | |
| rmgui_input_result_t | rmgui_datepicker_input (rmgui_datepicker_t *, const rmgui_datepicker_layout_t *, const rmgui_input_t *) |
| Arrows move days/weeks (months/years at zoom); Home/End week boundaries, Ctrl Home/End month boundaries; PageUp/Down months (Shift/Ctrl years). | |
| int | rmgui_datepicker_style_register (rmgui_style_ext_t *, size_t *class_id) |
| Registers extension class "datepicker". | |
| void | rmgui_datepicker_paint_to (rmgui_target_t *, rmgui_font_t *, const rmgui_style_ext_resolved_t *, int font_px, const rmgui_datepicker_t *, const rmgui_datepicker_layout_t *, rmgui_rect_t clip) |
| void | rmgui_datepicker_paint (rmgui_fb_t *, rmgui_font_t *, const rmgui_style_ext_resolved_t *, int font_px, const rmgui_datepicker_t *, const rmgui_datepicker_layout_t *, rmgui_rect_t clip) |
| int | rmgui_a11y_from_datepicker (const rmgui_datepicker_t *, size_t item, const char *name, rmgui_a11y_record_t *) |
| GRID builds grid semantics; cell IDs build selected/disabled/focused CELL records (including zoom cells). | |
| int | rmgui_datepicker_a11y_action (rmgui_datepicker_t *, size_t item, int operation, int64_t value, rmgui_input_result_t *) |
Caller-owned Gregorian calendar, no allocation, libc calendar or clock.
Years are 1..9999, serial days are relative to 1970-01-01. All integer divisions in geometry round down; remainder pixels go to later cells. Status functions return 0 or -1, with output/state unchanged on refusal. NULL required arguments are refused; NULL font paints geometry only. Strings and callback/user storage are borrowed until reinitialization. Public state may change states/time_part; use operations for other fields.
| #define RMGUI_DATEPICKER_GRID SIZE_MAX |
| #define RMGUI_DATEPICKER_STYLE_PROPERTIES 9u |
| typedef int(*) rmgui_datepicker_disabled_fn(void *, rmgui_date_t) |
Nonzero disables a date.
Must be deterministic and not mutate the picker.
| int rmgui_datepicker_prepare | ( | const rmgui_ui_t * | , |
| const rmgui_datepicker_t * | ) |
Stage the initialized calendar's current labels before recording.
CPU targets need no staging. Returns 0 on success or -1 on error.
| int rmgui_datepicker_draw | ( | const rmgui_ui_t * | , |
| const rmgui_datepicker_t * | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| const rmgui_datepicker_layout_t * | ) |
Draw an arranged calendar with a borrowed, device-resolved datepicker extension style.
The UI supplies the logical label size and scale. Returns -1 for invalid arguments or style; paint failures latch on the target.
| int rmgui_date_valid | ( | rmgui_date_t | ) |
Return 1 for a Gregorian civil date in the supported domain, else 0.
| int rmgui_date_days_from_civil | ( | rmgui_date_t | , |
| int * | ) |
Convert a valid civil date to days since 1970-01-01.
| int rmgui_date_civil_from_days | ( | int | , |
| rmgui_date_t * | ) |
Inverse serial conversion; out-of-domain serials refuse unchanged.
| int rmgui_date_iso_week | ( | rmgui_date_t | , |
| rmgui_iso_week_t * | ) |
Compute ISO 8601 week-year, week and weekday for a valid civil date.
| int rmgui_datepicker_init | ( | rmgui_datepicker_t * | , |
| const rmgui_datepicker_config_t * | ) |
Bind localization/configuration.
Initial date must be enabled and within ordered min/max. Initialization focuses it without selecting a value.
| int rmgui_datepicker_cells | ( | const rmgui_datepicker_t * | , |
| rmgui_datepicker_cell_t * | , | ||
| size_t | ) |
Grid needs capacity >=42, even at zoom; refuses atomically.
Out-of-domain adjacent days are invalid cells. No caller output is retained.
| int rmgui_datepicker_layout | ( | const rmgui_datepicker_t * | , |
| rmgui_rect_t | , | ||
| rmgui_datepicker_layout_t * | ) |
Calculate month/zoom cells and controls for positive, representable bounds.
| int rmgui_datepicker_select | ( | rmgui_datepicker_t * | , |
| rmgui_date_t | ) |
Select commits a single day, or alternates range anchor/completed range.
Every day in a completed range must be enabled, including interior days. Selection refuses disabled/out-of-bound dates without partial mutation.
| int rmgui_datepicker_navigate | ( | rmgui_datepicker_t * | , |
| int | steps ) |
Navigate by months/years/decades according to zoom; never wraps years.
Focus retains its day where possible (Feb clamps). Selection is unchanged.
| int rmgui_datepicker_zoom | ( | rmgui_datepicker_t * | , |
| rmgui_datepicker_zoom_t | ) |
Change view without selection changes; disabled state or invalid zoom refuses.
| int rmgui_datepicker_time | ( | rmgui_datepicker_t * | , |
| int | part, | ||
| int | steps ) |
Step part 1 hour, 2 minute or 3 second without carrying into other parts.
Each part wraps independently; time_row must be enabled.
| rmgui_input_result_t rmgui_datepicker_input | ( | rmgui_datepicker_t * | , |
| const rmgui_datepicker_layout_t * | , | ||
| const rmgui_input_t * | ) |
Arrows move days/weeks (months/years at zoom); Home/End week boundaries, Ctrl Home/End month boundaries; PageUp/Down months (Shift/Ctrl years).
Ctrl Up zooms out, Ctrl Down zooms in. Enter/Space selects; Escape drops a pending range or zooms in. Tab cycles optional time parts (Shift reverse). Time arrows adjust active part. Disabled press reports REFUSED, no capture. Pointer activation requires press/release on the same item.
| int rmgui_datepicker_style_register | ( | rmgui_style_ext_t * | , |
| size_t * | class_id ) |
Registers extension class "datepicker".
Nine COLOR properties, in order: background,text,selection,selection-text,disabled,today,focus,border,muted. Resolve normally with rmgui_style_resolve_class into caller property storage; painter requires all nine matching COLOR properties. font_px is 1..512. CPU and _to geometry/pixels agree. RECORD uses prepared immutable glyphs and bounded target storage; normal target failures latch.
| void rmgui_datepicker_paint_to | ( | rmgui_target_t * | , |
| rmgui_font_t * | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| int | font_px, | ||
| const rmgui_datepicker_t * | , | ||
| const rmgui_datepicker_layout_t * | , | ||
| rmgui_rect_t | clip ) |
| void rmgui_datepicker_paint | ( | rmgui_fb_t * | , |
| rmgui_font_t * | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| int | font_px, | ||
| const rmgui_datepicker_t * | , | ||
| const rmgui_datepicker_layout_t * | , | ||
| rmgui_rect_t | clip ) |
| int rmgui_a11y_from_datepicker | ( | const rmgui_datepicker_t * | , |
| size_t | item, | ||
| const char * | name, | ||
| rmgui_a11y_record_t * | ) |
GRID builds grid semantics; cell IDs build selected/disabled/focused CELL records (including zoom cells).
Other item IDs build BUTTON/SPINBUTTON. Names are caller-borrowed. operation: 0=set value, 1=increment, -1=decrement, 2=press, 3=focus. Grid values are serial days; time values are component values. Grid increment/decrement navigates. Returns 0 handled, 1 unsupported, -1 invalid; nonzero leaves out unchanged. Disabled actions return REFUSED.
| int rmgui_datepicker_a11y_action | ( | rmgui_datepicker_t * | , |
| size_t | item, | ||
| int | operation, | ||
| int64_t | value, | ||
| rmgui_input_result_t * | ) |