|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
Allocation-free, caller-owned style classes. More...
#include "style_schema.h"Data Structures | |
| struct | rmgui_style_ext_value_t |
| REFERENCE carries a schema spacing/colour token; integer/color are unused. More... | |
| struct | rmgui_style_ext_property_t |
| struct | rmgui_style_ext_slot_t |
| struct | rmgui_style_ext_class_t |
| struct | rmgui_style_ext_t |
| struct | rmgui_style_ext_resolved_property_t |
| Property IDs are class-local descriptor indices. More... | |
| struct | rmgui_style_ext_resolved_t |
Typedefs | |
| typedef int(*) | rmgui_style_ext_visit_fn(void *user, size_t class_id, const char *class_name, const rmgui_style_ext_property_t *property, rmgui_style_states_t state, const rmgui_style_ext_value_t *value) |
Enumerations | |
| enum | rmgui_style_ext_kind_t { RMGUI_STYLE_EXT_INT , RMGUI_STYLE_EXT_COLOR , RMGUI_STYLE_EXT_LENGTH , RMGUI_STYLE_EXT_ENUM , RMGUI_STYLE_EXT_REFERENCE } |
Functions | |
| int | rmgui_style_ext_init (rmgui_style_ext_t *ext, rmgui_style_ext_class_t *classes, size_t class_capacity, rmgui_style_ext_slot_t *properties, size_t property_capacity) |
| Initialize with zero counts and caller arrays/capacities. | |
| int | rmgui_style_ext_register (rmgui_style_ext_t *ext, const char *name, const rmgui_style_ext_property_t *properties, const rmgui_style_ext_value_t *defaults, size_t count, size_t *class_id) |
| Names are nonempty ASCII identifiers (letters, digits, '_' and '-'), unique within their scope; builtin class names are reserved. | |
| int | rmgui_style_ext_copy (rmgui_style_ext_t *destination, const rmgui_style_ext_t *source) |
| Copies active records into initialized, disjoint caller storage; sufficient destination capacities are required. | |
| const rmgui_style_ext_class_t * | rmgui_style_ext_class (const rmgui_style_ext_t *ext, size_t class_id) |
| Borrowed descriptor lookups; IDs are class-local for properties. | |
| const rmgui_style_ext_class_t * | rmgui_style_ext_find (const rmgui_style_ext_t *ext, const char *name) |
| const rmgui_style_ext_property_t * | rmgui_style_ext_property (const rmgui_style_ext_t *ext, size_t class_id, size_t property_id) |
| const rmgui_style_ext_property_t * | rmgui_style_ext_find_property (const rmgui_style_ext_t *ext, size_t class_id, const char *name) |
| int | rmgui_style_ext_set (rmgui_style_ext_t *ext, size_t class_id, size_t property_id, rmgui_style_states_t state, const rmgui_style_ext_value_t *value) |
| state is NORMAL (base) or exactly one flag. | |
| int | rmgui_style_ext_unset (rmgui_style_ext_t *ext, size_t class_id, size_t property_id, rmgui_style_states_t state) |
| Remove an authored overlay, restoring inheritance; base cannot be removed. | |
| int | rmgui_style_ext_check_author (const rmgui_style_ext_t *ext, const char *class_name, const char *property_name, rmgui_style_states_t state, const rmgui_style_ext_value_t *value) |
| Frontend hooks resolve names and validate or apply one assignment. | |
| int | rmgui_style_ext_author (rmgui_style_ext_t *ext, const char *class_name, const char *property_name, rmgui_style_states_t state, const rmgui_style_ext_value_t *value) |
| int | rmgui_style_ext_walk (const rmgui_style_ext_t *ext, rmgui_style_ext_visit_fn visitor, void *user) |
| Emits every registered property base then each authored overlay in order: HOVER, PRESSED, FOCUSED, DISABLED, SELECTED, DEFAULT, INACTIVE. | |
| int | rmgui_style_resolve_class (const rmgui_style_snapshot_t *snapshot, const rmgui_style_ext_t *ext, size_t class_id, rmgui_style_states_t states, int font_px, int scale_percent, rmgui_style_ext_resolved_t *out) |
| Resolve into caller storage. | |
| const rmgui_style_ext_resolved_property_t * | rmgui_style_ext_get (const rmgui_style_ext_resolved_t *resolved, size_t property_id) |
| const rmgui_style_ext_resolved_property_t * | rmgui_style_ext_get_name (const rmgui_style_ext_resolved_t *resolved, const char *name) |
Allocation-free, caller-owned style classes.
Descriptor strings and enum tables are borrowed and must outlive the registry and resolved output.
| typedef int(*) rmgui_style_ext_visit_fn(void *user, size_t class_id, const char *class_name, const rmgui_style_ext_property_t *property, rmgui_style_states_t state, const rmgui_style_ext_value_t *value) |
| int rmgui_style_ext_init | ( | rmgui_style_ext_t * | ext, |
| rmgui_style_ext_class_t * | classes, | ||
| size_t | class_capacity, | ||
| rmgui_style_ext_slot_t * | properties, | ||
| size_t | property_capacity ) |
Initialize with zero counts and caller arrays/capacities.
No fixed class or property limit exists. Status-returning functions return 0 on success, -1 on invalid/capacity failure without modifying outputs/storage (apart from a visitor's own side effects). Lookup functions return NULL on failure.
| int rmgui_style_ext_register | ( | rmgui_style_ext_t * | ext, |
| const char * | name, | ||
| const rmgui_style_ext_property_t * | properties, | ||
| const rmgui_style_ext_value_t * | defaults, | ||
| size_t | count, | ||
| size_t * | class_id ) |
Names are nonempty ASCII identifiers (letters, digits, '_' and '-'), unique within their scope; builtin class names are reserved.
IDs are COUNT + index. A class has at least one property. Registration copies descriptors/defaults but borrows their strings. All input/output storage must be disjoint.
| int rmgui_style_ext_copy | ( | rmgui_style_ext_t * | destination, |
| const rmgui_style_ext_t * | source ) |
Copies active records into initialized, disjoint caller storage; sufficient destination capacities are required.
Pointer strings remain borrowed. Used both to stage a codec transaction and to commit it after full parsing.
| const rmgui_style_ext_class_t * rmgui_style_ext_class | ( | const rmgui_style_ext_t * | ext, |
| size_t | class_id ) |
Borrowed descriptor lookups; IDs are class-local for properties.
| const rmgui_style_ext_class_t * rmgui_style_ext_find | ( | const rmgui_style_ext_t * | ext, |
| const char * | name ) |
| const rmgui_style_ext_property_t * rmgui_style_ext_property | ( | const rmgui_style_ext_t * | ext, |
| size_t | class_id, | ||
| size_t | property_id ) |
| const rmgui_style_ext_property_t * rmgui_style_ext_find_property | ( | const rmgui_style_ext_t * | ext, |
| size_t | class_id, | ||
| const char * | name ) |
| int rmgui_style_ext_set | ( | rmgui_style_ext_t * | ext, |
| size_t | class_id, | ||
| size_t | property_id, | ||
| rmgui_style_states_t | state, | ||
| const rmgui_style_ext_value_t * | value ) |
state is NORMAL (base) or exactly one flag.
Length/colour properties accept matching spacing/colour references. REFERENCE descriptors accept either. Values are range-checked, never clamped; references are checked at resolve. min/max constrain INT and LENGTH; ENUM requires enum_count in 1..INT_MAX, the type-imposed ceiling of its resolved integer index. Other descriptor fields do not constrain COLOR or REFERENCE values.
| int rmgui_style_ext_unset | ( | rmgui_style_ext_t * | ext, |
| size_t | class_id, | ||
| size_t | property_id, | ||
| rmgui_style_states_t | state ) |
Remove an authored overlay, restoring inheritance; base cannot be removed.
| int rmgui_style_ext_check_author | ( | const rmgui_style_ext_t * | ext, |
| const char * | class_name, | ||
| const char * | property_name, | ||
| rmgui_style_states_t | state, | ||
| const rmgui_style_ext_value_t * | value ) |
Frontend hooks resolve names and validate or apply one assignment.
| int rmgui_style_ext_author | ( | rmgui_style_ext_t * | ext, |
| const char * | class_name, | ||
| const char * | property_name, | ||
| rmgui_style_states_t | state, | ||
| const rmgui_style_ext_value_t * | value ) |
| int rmgui_style_ext_walk | ( | const rmgui_style_ext_t * | ext, |
| rmgui_style_ext_visit_fn | visitor, | ||
| void * | user ) |
Emits every registered property base then each authored overlay in order: HOVER, PRESSED, FOCUSED, DISABLED, SELECTED, DEFAULT, INACTIVE.
No synthetic inherited overlays are emitted. Visitor refusal returns -1.
| int rmgui_style_resolve_class | ( | const rmgui_style_snapshot_t * | snapshot, |
| const rmgui_style_ext_t * | ext, | ||
| size_t | class_id, | ||
| rmgui_style_states_t | states, | ||
| int | font_px, | ||
| int | scale_percent, | ||
| rmgui_style_ext_resolved_t * | out ) |
Resolve into caller storage.
Later present overlays override earlier ones: base,HOVER,PRESSED,FOCUSED,DISABLED,SELECTED,DEFAULT,INACTIVE. Unlike builtins, DISABLED does not suppress other overlays. font_px > 0; scale is 1..400. LENGTH scales like builtin signed lengths (nearest, halves away from zero, saturating at INT_MAX/-INT_MAX); INT and ENUM remain unscaled.
| const rmgui_style_ext_resolved_property_t * rmgui_style_ext_get | ( | const rmgui_style_ext_resolved_t * | resolved, |
| size_t | property_id ) |
| const rmgui_style_ext_resolved_property_t * rmgui_style_ext_get_name | ( | const rmgui_style_ext_resolved_t * | resolved, |
| const char * | name ) |