|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
Fixed-point spinbutton composed with the existing editable field. More...
Data Structures | |
| struct | rmgui_spinbox_config_t |
| All numeric quantities use integer units of 10^-decimals, decimals 0..9. More... | |
| struct | rmgui_spinbox_t |
| Caller-owned, no allocation. More... | |
| struct | rmgui_spinbox_geometry_t |
| struct | rmgui_spinbox_presentation_t |
| Borrowed paint inputs for an arranged spinbox. More... | |
Functions | |
| int | rmgui_spinbox_init (rmgui_spinbox_t *, char *storage, size_t capacity, const rmgui_spinbox_config_t *, int64_t value) |
| Initialize canonical decimal text into storage (capacity EXCLUDES NUL). | |
| int | rmgui_spinbox_set (rmgui_spinbox_t *, int64_t value) |
| Set a bounded value, replacing draft with canonical fixed-point text. | |
| int | rmgui_spinbox_commit (rmgui_spinbox_t *) |
| int | rmgui_spinbox_revert (rmgui_spinbox_t *) |
| int | rmgui_spinbox_geometry (rmgui_rect_t, const rmgui_style_ext_resolved_t *, rmgui_spinbox_geometry_t *out) |
| Extension class requires nonnegative LENGTH button-width, suffix-width, COLOR background/border/text. | |
| int | rmgui_spinbox_layout (const rmgui_spinbox_t *, const rmgui_style_resolved_t *, const rmgui_style_ext_resolved_t *, const rmgui_field_metrics_t *, rmgui_rect_t, rmgui_field_layout_t *) |
| Lay out the existing field in geometry.field using supplied TEXT_FIELD style and metrics. | |
| rmgui_input_result_t | rmgui_spinbox_input (rmgui_spinbox_t *, rmgui_field_layout_t *, rmgui_rect_t, const rmgui_style_ext_resolved_t *, const rmgui_input_t *) |
| KEY UP/DOWN step, PAGE_UP/DOWN page, wheel positive decrements, primary button press steps immediately then captures for dt repeat. | |
| int | rmgui_spinbox_step (rmgui_spinbox_t *, uint32_t dt_ms) |
| Advance a held button; accelerated repeats are dt-partition invariant. | |
| int | rmgui_spinbox_a11y (const rmgui_spinbox_t *, const char *name, rmgui_a11y_record_t *out) |
| Accessibility helper replaces out with SPINBUTTON and numeric value, minimum/maximum/step in fixed-point units, name and canonical/draft text borrowed. | |
| int | rmgui_spinbox_action (rmgui_spinbox_t *, int direction, int64_t value) |
| void | rmgui_spinbox_paint_to (rmgui_target_t *, rmgui_font_t *, const rmgui_style_resolved_t *, const rmgui_style_ext_resolved_t *, rmgui_rect_t, rmgui_rect_t clip, const rmgui_spinbox_t *, const rmgui_field_layout_t *, rmgui_field_caret_t) |
| Pure CPU/RECORD painters: field uses caller's resolved TEXT_FIELD style; suffix/button chrome uses caller-resolved extension class above. | |
| void | rmgui_spinbox_paint (rmgui_fb_t *, rmgui_font_t *, const rmgui_style_resolved_t *, const rmgui_style_ext_resolved_t *, rmgui_rect_t, rmgui_rect_t clip, const rmgui_spinbox_t *, const rmgui_field_layout_t *, rmgui_field_caret_t) |
| int | rmgui_spinbox_prepare (const rmgui_ui_t *ui, const rmgui_spinbox_t *spinbox, const rmgui_spinbox_presentation_t *presentation) |
| Stage the current field and suffix before recording. | |
| int | rmgui_spinbox_draw (const rmgui_ui_t *ui, const rmgui_spinbox_t *spinbox, const rmgui_spinbox_presentation_t *presentation, rmgui_rect_t box, rmgui_field_caret_t caret) |
| Draw the spinbox; its current layout and UI font are required. | |
Fixed-point spinbutton composed with the existing editable field.
| int rmgui_spinbox_init | ( | rmgui_spinbox_t * | , |
| char * | storage, | ||
| size_t | capacity, | ||
| const rmgui_spinbox_config_t * | , | ||
| int64_t | value ) |
Initialize canonical decimal text into storage (capacity EXCLUDES NUL).
capacity must fit both formatted bounds, <= RMGUI_FIELD_CAPACITY_MAX. storage/self/config must not overlap. Returns 0, or -1 invalid with self AND storage unchanged. Any previous state must be retired before init.
| int rmgui_spinbox_set | ( | rmgui_spinbox_t * | , |
| int64_t | value ) |
Set a bounded value, replacing draft with canonical fixed-point text.
commit accepts optional '-', digits, optional '.' followed by 1..decimals digits; no whitespace/exponents/rounding. Missing fractional places are zero-padded. Invalid/out-of-range commit returns -1 with all state/storage unchanged. revert restores value without accepting draft. All return 0 success, -1 invalid/unbound/refused unchanged.
| int rmgui_spinbox_commit | ( | rmgui_spinbox_t * | ) |
| int rmgui_spinbox_revert | ( | rmgui_spinbox_t * | ) |
| int rmgui_spinbox_geometry | ( | rmgui_rect_t | , |
| const rmgui_style_ext_resolved_t * | , | ||
| rmgui_spinbox_geometry_t * | out ) |
Extension class requires nonnegative LENGTH button-width, suffix-width, COLOR background/border/text.
Widths reserve the right strip; buttons split vertically. Too-small rect shrinks strips, never negative. 0 success, -1 invalid unchanged. This same geometry is used by input and painters.
| int rmgui_spinbox_layout | ( | const rmgui_spinbox_t * | , |
| const rmgui_style_resolved_t * | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| const rmgui_field_metrics_t * | , | ||
| rmgui_rect_t | , | ||
| rmgui_field_layout_t * | ) |
Lay out the existing field in geometry.field using supplied TEXT_FIELD style and metrics.
Return field_layout status; invalid geometry refuses unchanged. Caller repeats after set/commit/revert/step and before paint.
| rmgui_input_result_t rmgui_spinbox_input | ( | rmgui_spinbox_t * | , |
| rmgui_field_layout_t * | , | ||
| rmgui_rect_t | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| const rmgui_input_t * | ) |
KEY UP/DOWN step, PAGE_UP/DOWN page, wheel positive decrements, primary button press steps immediately then captures for dt repeat.
Drag outside that button cancels repeat; release/leave/focus loss cancels capture. ENTER/focus loss commit; invalid draft reverts with CANCEL. ESC reverts. Other editing is delegated to field_input (including clipboard/IME). Numeric steps discard a pending draft. At bounds actions are consumed without CHANGE. DISABLED refuses inside press and ignores value actions. Invalid pointers/geometry yield zero result unchanged. Layout must have been produced by spinbox_layout. Re-layout after repaint before painting.
| int rmgui_spinbox_step | ( | rmgui_spinbox_t * | , |
| uint32_t | dt_ms ) |
Advance a held button; accelerated repeats are dt-partition invariant.
Returns 1 if committed value or draft changed, 0 idle/boundary/dt=0, -1 NULL/invalid state unchanged. Caller re-layouts on 1.
| int rmgui_spinbox_a11y | ( | const rmgui_spinbox_t * | , |
| const char * | name, | ||
| rmgui_a11y_record_t * | out ) |
Accessibility helper replaces out with SPINBUTTON and numeric value, minimum/maximum/step in fixed-point units, name and canonical/draft text borrowed.
Action direction -1/+1 steps, 0 sets exact value; disabled and invalid actions return -1 unchanged. Helpers do not depend on a11y module.
| int rmgui_spinbox_action | ( | rmgui_spinbox_t * | , |
| int | direction, | ||
| int64_t | value ) |
| void rmgui_spinbox_paint_to | ( | rmgui_target_t * | , |
| rmgui_font_t * | , | ||
| const rmgui_style_resolved_t * | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| rmgui_rect_t | , | ||
| rmgui_rect_t | clip, | ||
| const rmgui_spinbox_t * | , | ||
| const rmgui_field_layout_t * | , | ||
| rmgui_field_caret_t | ) |
Pure CPU/RECORD painters: field uses caller's resolved TEXT_FIELD style; suffix/button chrome uses caller-resolved extension class above.
No style lookup/registration, timing or input. Prepare field/suffix glyphs before RECORD; resources remain immutable through submit/discard. No allocation by these controls; existing CPU font drawing obeys font cache contract. Invalid geometry paints nothing; target failures latch.
| void rmgui_spinbox_paint | ( | rmgui_fb_t * | , |
| rmgui_font_t * | , | ||
| const rmgui_style_resolved_t * | , | ||
| const rmgui_style_ext_resolved_t * | , | ||
| rmgui_rect_t | , | ||
| rmgui_rect_t | clip, | ||
| const rmgui_spinbox_t * | , | ||
| const rmgui_field_layout_t * | , | ||
| rmgui_field_caret_t | ) |
| int rmgui_spinbox_prepare | ( | const rmgui_ui_t * | ui, |
| const rmgui_spinbox_t * | spinbox, | ||
| const rmgui_spinbox_presentation_t * | presentation ) |
Stage the current field and suffix before recording.
Returns 0 on success or on CPU targets, -1 on error. The field layout must use the UI font.
| int rmgui_spinbox_draw | ( | const rmgui_ui_t * | ui, |
| const rmgui_spinbox_t * | spinbox, | ||
| const rmgui_spinbox_presentation_t * | presentation, | ||
| rmgui_rect_t | box, | ||
| rmgui_field_caret_t | caret ) |
Draw the spinbox; its current layout and UI font are required.
Returns -1 for invalid arguments or style, otherwise 0; paint errors latch on the target.