|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
layout.h — the retained layout kernel: a caller-owned tree of declared nodes, incremental measure/arrange over it, and the published immutable snapshot that painters, hit testing and focus read. More...
#include <stddef.h>#include <stdint.h>#include "geom.h"#include "mask.h"#include "layer.h"#include "scroll.h"#include "text.h"#include "a11y_types.h"#include "font.h"Data Structures | |
| struct | rmgui_layout_text_binding_t |
| Four values installed together: measure, optional prefix, default userdata, and optional metrics for paragraph painting. More... | |
| struct | rmgui_layout_overlay_t |
| An overlay declaration, attached to one child of a LAYER node through rmgui_layout_node_t.overlay. More... | |
| struct | rmgui_layout_grid_column_t |
| FIXED: nonnegative pixels. More... | |
| struct | rmgui_layout_grid_t |
| Grid declaration: children fill the borrowed columns row-major. More... | |
| struct | rmgui_layout_visual_t |
| Optional visual effect for an arranged node. More... | |
| struct | rmgui_layout_node_t |
| One node's declaration, copied by rmgui_layout_add_* / rmgui_layout_update. More... | |
| struct | rmgui_layout_links_t |
| Tree links of one node; -1 where there is none. More... | |
| struct | rmgui_layout_snapshot_node_t |
| One published node. More... | |
| struct | rmgui_layout_overlay_layer_t |
| One published overlay: node is its index, parent_id the id of the overlay that contains its anchor (0 for none), depth its nesting depth. More... | |
| struct | rmgui_layout_snapshot_t |
| One arrangement generation. More... | |
| struct | rmgui_layout_entry_t |
| -— private representation (members of rmgui_layout_t) --------------— More... | |
| struct | rmgui_layout_scroll_bind_t |
| struct | rmgui_layout_overlay_bind_t |
| struct | rmgui_layout_storage_t |
| Caller-owned, disjoint arrays, borrowed for the kernel's lifetime. More... | |
| struct | rmgui_layout_t |
Macros | |
| #define | RMGUI_LAYOUT_OVERLAY_GAP 4 |
| Base pixel gap between an anchored overlay and its anchor edge, scaled by the kernel's geometry percent (see rmgui_layout_place_t). | |
| #define | RMGUI_LAYOUT_BOUND_W 1u |
| Per-axis maximum-constraint selectors for rmgui_layout_node_t.max_bound. | |
| #define | RMGUI_LAYOUT_BOUND_H 2u |
| #define | RMGUI_LAYOUT_STORAGE(name, N, G, S, O, W, T, D) |
| Declares static or automatic caller storage; counts are constant expressions. | |
Functions | |
| int | rmgui_layout_init (rmgui_layout_t *k, const rmgui_layout_storage_t *storage) |
| Borrows storage and empties k; geometry scale starts at 100 percent. | |
| int | rmgui_layout_set_scale (rmgui_layout_t *k, int scale_percent) |
| Sets geometry scale (1..400 percent); -1 for invalid input, unchanged. | |
| void | rmgui_layout_set_text_binding (rmgui_layout_t *k, const rmgui_layout_text_binding_t *binding) |
| Copies the binding values, borrowing its userdata and metrics cache. | |
| void | rmgui_layout_set_font (rmgui_layout_t *k, const rmgui_font_t *font) |
| Installs the built-in font's measurement and exact prefix callbacks, with font as the default userdata and no paint cache. | |
| void | rmgui_layout_set_font_metrics (rmgui_layout_t *k, rmgui_font_metrics_t *metrics) |
| Installs the built-in metrics measurement and exact prefix callbacks. | |
| void | rmgui_layout_set_text_measure (rmgui_layout_t *k, rmgui_text_measure_fn callback, const void *ud) |
| Installs a measure-only binding with default userdata ud, clearing any prior prefix and cache. | |
| void | rmgui_layout_set_text_prefix (rmgui_layout_t *k, rmgui_text_prefix_fn prefix) |
| Replaces only the prefix provider, keeping the active measure callback, userdata and paint cache. | |
| void | rmgui_layout_reset (rmgui_layout_t *k) |
| Drops every node, grid and overlay declaration and the focus. | |
| int | rmgui_layout_add_root (rmgui_layout_t *k, const rmgui_layout_node_t *node, size_t *index) |
| Adds node as a new root (depth 0). | |
| int | rmgui_layout_add_child (rmgui_layout_t *k, size_t parent, const rmgui_layout_node_t *node, size_t *index) |
| Adds node as the last child of container parent. | |
| int | rmgui_layout_update (rmgui_layout_t *k, size_t index, const rmgui_layout_node_t *node) |
| Replaces node index's declaration; its id, kind, grid, scroll, overlay and fitted_anchor must be unchanged. | |
| int | rmgui_layout_set_text (rmgui_layout_t *k, size_t index, const char *text) |
| Field mutations preserve identity, links and all other declaration fields. | |
| int | rmgui_layout_set_hidden (rmgui_layout_t *k, size_t index, int hidden) |
| int | rmgui_layout_set_preferred_size (rmgui_layout_t *k, size_t index, int w, int h) |
| int | rmgui_layout_set_min_size (rmgui_layout_t *k, size_t index, int w, int h) |
| int | rmgui_layout_set_max_size (rmgui_layout_t *k, size_t index, int w, int h, unsigned bound) |
| int | rmgui_layout_set_padding (rmgui_layout_t *k, size_t index, int l, int t, int r, int b) |
| int | rmgui_layout_set_margin (rmgui_layout_t *k, size_t index, int l, int t, int r, int b) |
| int | rmgui_layout_set_flex (rmgui_layout_t *k, size_t index, uint32_t flex) |
| int | rmgui_layout_set_visual (rmgui_layout_t *k, size_t index, const rmgui_layout_visual_t *visual) |
| int | rmgui_layout_set_a11y (rmgui_layout_t *k, size_t index, const rmgui_a11y_record_t *record) |
| Attach borrowed semantic metadata, or detach with NULL. | |
| int | rmgui_layout_node_get (const rmgui_layout_t *k, size_t index, rmgui_layout_node_t *out) |
| Copies node index's current declaration into *out (corner_radius as clamped). | |
| rmgui_layout_links_t | rmgui_layout_links (const rmgui_layout_t *k, size_t index) |
| Tree links of node index; all -1 when index is out of range. | |
| int | rmgui_layout_find (const rmgui_layout_t *k, uint64_t id, size_t *index) |
| 0 with *index set to the node whose id is id; -1 when there is none. | |
| int | rmgui_layout_grid_declare (rmgui_layout_t *k, const rmgui_layout_grid_t *grid, uint32_t *handle) |
| Declares a grid; *handle is its 1-based handle, valid until reset. | |
| int | rmgui_layout_scroll_declare (rmgui_layout_t *k, uint64_t state_key, const rmgui_scroll_t *declaration, uint32_t *handle) |
| Declares keyed scroll axes, visibility, borrowed style and host DISABLED state. | |
| rmgui_scroll_t * | rmgui_layout_scroll_state (rmgui_layout_t *k, uint32_t handle) |
| The live scroll state of handle, or NULL. | |
| int | rmgui_layout_overlay_declare (rmgui_layout_t *k, const rmgui_layout_overlay_t *overlay, uint32_t *handle) |
| Declares an overlay; *handle is 1-based and valid until reset. | |
| int | rmgui_layout_arrange (rmgui_layout_t *k, size_t root, rmgui_rect_t box) |
| Measures and arranges the tree under root into box, re-running only nodes whose declaration, scroll state, box or clip changed, and publishes a new snapshot generation. | |
| const rmgui_layout_snapshot_t * | rmgui_layout_snapshot (const rmgui_layout_t *k) |
| The latest published generation, or NULL before the first. | |
| const rmgui_layout_snapshot_node_t * | rmgui_layout_snapshot_node (const rmgui_layout_t *k, size_t index) |
| Published node index, or NULL when out of the published range. | |
| int | rmgui_layout_contains (const rmgui_layout_snapshot_node_t *node, int x, int y) |
| 1 when (x, y) is inside a visible node's arranged rounded rect and clip, and its optional stretched shape hits (coverage >= RMGUI_MASK_HIT_MIN); 0 otherwise, including NULL node. | |
| int | rmgui_layout_hit_test (const rmgui_layout_t *k, int x, int y, size_t *index) |
| The frontmost arranged node under (x, y) in the published generation: inside the frontmost non-tooltip overlay when one is open, else under the snapshot root; later declared siblings win, independent of visual bounds and raised paint ordering. | |
layout.h — the retained layout kernel: a caller-owned tree of declared nodes, incremental measure/arrange over it, and the published immutable snapshot that painters, hit testing and focus read.
Threading: a kernel object is single-threaded and non-reentrant. No function may be called on a kernel from another thread, or from inside the kernel's own text-measure callback, while any call on that kernel is in progress. Distinct kernel objects share no state and may be used concurrently.
Storage: the small kernel borrows caller-owned arrays and never allocates. Callers mutate declarations through the functions below. After successful arrangement, damage[0..damage_count) are device-pixel repaint regions; damage_collapsed reports union collapse on capacity overflow. Repaint each region by replaying the complete scene clipped to that region, including its background. Other kernel members are private.
| #define RMGUI_LAYOUT_OVERLAY_GAP 4 |
Base pixel gap between an anchored overlay and its anchor edge, scaled by the kernel's geometry percent (see rmgui_layout_place_t).
| #define RMGUI_LAYOUT_BOUND_W 1u |
Per-axis maximum-constraint selectors for rmgui_layout_node_t.max_bound.
| #define RMGUI_LAYOUT_BOUND_H 2u |
| #define RMGUI_LAYOUT_STORAGE | ( | name, | |
| N, | |||
| G, | |||
| S, | |||
| O, | |||
| W, | |||
| T, | |||
| D ) |
Declares static or automatic caller storage; counts are constant expressions.
Use &name.storage with rmgui_layout_init. Zero-sized record classes reserve one unused C array element but expose zero capacity.
-— lifecycle --------------------------------------------------------—
A TOOLTIP layer paints but takes neither input nor focus.
The frontmost POPUP or MODAL layer is the scope of hit testing and focus traversal. A MODELESS layer paints above the root tree and shares input and focus with it: while no POPUP or MODAL layer is published, hit testing tries the MODELESS layers frontmost first and then the root, focus traversal from the published root visits the root's tree and then each MODELESS layer's tree in z-order, and rmgui_focus_set accepts a node inside one. A MODELESS layer takes part only when every overlay between it and the published root is MODELESS too.
| Enumerator | |
|---|---|
| RMGUI_LAYOUT_OVERLAY_MODE_TOOLTIP | |
| RMGUI_LAYOUT_OVERLAY_MODE_POPUP | |
| RMGUI_LAYOUT_OVERLAY_MODE_MODAL | |
| RMGUI_LAYOUT_OVERLAY_MODE_MODELESS | |
| enum rmgui_layout_place_t |
Where an anchored overlay goes relative to its anchor's arranged rect.
BELOW, ABOVE, AFTER and BEFORE put the overlay RMGUI_LAYOUT_OVERLAY_GAP pixels off the named anchor edge on the placement axis (BELOW and ABOVE align left edges, AFTER and BEFORE top edges); an overlay that would then leave the layer flips to the opposite edge, the same gap off it. The final clamp into the layer reduces the gap only when the layer lacks the room. AT_POINTER places the overlay's top-left at (pointer_x, pointer_y), and an overlay without an anchor keeps its own alignment; neither has a gap. CORNER_AT_POINTER puts a corner of the overlay at (pointer_x, pointer_y), chosen per axis: the overlay extends right of and below the pointer when it fits between the pointer and the layer's right (bottom) edge, else left of (above) it when it fits between the layer's left (top) edge and the pointer; only an axis with room on neither side is clamped into the layer. It ignores the anchor and has no gap.
| Enumerator | |
|---|---|
| RMGUI_LAYOUT_PLACE_BELOW | |
| RMGUI_LAYOUT_PLACE_ABOVE | |
| RMGUI_LAYOUT_PLACE_AFTER | |
| RMGUI_LAYOUT_PLACE_BEFORE | |
| RMGUI_LAYOUT_PLACE_AT_POINTER | |
| RMGUI_LAYOUT_PLACE_CORNER_AT_POINTER | |
Node vocabulary.
VBOX, HBOX, GRID, LAYER and SCROLL (exactly one child) are containers; every other kind is a leaf that refuses children. FIXED and SPACER take their declared size; TEXT, BUTTON and SELECTABLE measure their text through the kernel's text-measure callback.
| enum rmgui_layout_align_t |
Main-axis placement of the pixels no child claimed.
HBOX WRAP applies this independently to each row, after margins and the declared gap: START leaves the remainder at the end; CENTER puts floor(remainder / 2) before the row; END puts it all before the row. SPACE_BETWEEN adds it to the gaps, with indivisible pixels going to earlier gaps, so a row with at least two children reaches both content edges. A single-child row stays at the start for SPACE_BETWEEN. Wrapping preserves measured child outer widths (including margins, clamped to the content width), without flex grow/shrink; cross alignment remains relative to each row's height.
| Enumerator | |
|---|---|
| RMGUI_LAYOUT_MAIN_ALIGN_START | |
| RMGUI_LAYOUT_MAIN_ALIGN_CENTER | |
| RMGUI_LAYOUT_MAIN_ALIGN_END | |
| RMGUI_LAYOUT_MAIN_ALIGN_SPACE_BETWEEN | |
Every combined spelling lowers to exactly one policy on each axis (x, y): CLIP=(clip,clip), SCROLL_X=(scroll,clip), SCROLL_Y=(clip,scroll), SCROLL_BOTH=(scroll,scroll), WRAP=(wrap,clip), ELLIPSIS=(ellipsis,clip), ASSERT_FITS=(assert-fits,assert-fits).
A scrolling axis reserves RMGUI_SCROLL_BAR_WIDTH on the other axis; ASSERT_FITS refuses the arrangement when the node's measurement exceeds its arranged box. A SCROLL node's child is measured at its natural extent on each axis its scroll state scrolls (no wrapping, flexible space at its basis) and within the viewport on any other axis, and is arranged at the larger of that extent and the viewport.
How an IMAGE's artwork fills its content box: CONTAIN fits the whole image, COVER fills the box (the clip hides the excess), STRETCH ignores the aspect, INTEGER_SCALE uses the largest whole-number scale that fits.
| Enumerator | |
|---|---|
| RMGUI_LAYOUT_IMAGE_FIT_CONTAIN | |
| RMGUI_LAYOUT_IMAGE_FIT_STRETCH | |
| RMGUI_LAYOUT_IMAGE_FIT_INTEGER_SCALE | |
| RMGUI_LAYOUT_IMAGE_FIT_COVER | |
Width policy of one grid column (see rmgui_layout_grid_column_t).
| Enumerator | |
|---|---|
| RMGUI_LAYOUT_GRID_COLUMN_KIND_FIXED | |
| RMGUI_LAYOUT_GRID_COLUMN_KIND_INTRINSIC | |
| RMGUI_LAYOUT_GRID_COLUMN_KIND_FLEXIBLE | |
| int rmgui_layout_init | ( | rmgui_layout_t * | k, |
| const rmgui_layout_storage_t * | storage ) |
Borrows storage and empties k; geometry scale starts at 100 percent.
Returns -1 for NULL, missing arrays or invalid capacities; k unchanged.
| int rmgui_layout_set_scale | ( | rmgui_layout_t * | k, |
| int | scale_percent ) |
Sets geometry scale (1..400 percent); -1 for invalid input, unchanged.
Invalidates cached measurements/arrangement when scale changes; the published snapshot remains valid until the next arrangement.
| void rmgui_layout_set_text_binding | ( | rmgui_layout_t * | k, |
| const rmgui_layout_text_binding_t * | binding ) |
Copies the binding values, borrowing its userdata and metrics cache.
NULL binding clears all four values; NULL k is ignored. Invalidates cached measurements and arrangements once without editing the published snapshot. Userdata is borrowed until replaced; metrics additionally outlive every snapshot that uses them. Reinstall the binding if its provider's measurements change without changing the userdata pointer.
| void rmgui_layout_set_font | ( | rmgui_layout_t * | k, |
| const rmgui_font_t * | font ) |
Installs the built-in font's measurement and exact prefix callbacks, with font as the default userdata and no paint cache.
A node may override the default with another rmgui_font_t. This replaces passing rmgui_font_measure_layout and a font to rmgui_layout_set_text_measure.
| void rmgui_layout_set_font_metrics | ( | rmgui_layout_t * | k, |
| rmgui_font_metrics_t * | metrics ) |
Installs the built-in metrics measurement and exact prefix callbacks.
Both callbacks and snapshot painting use metrics, or the node's explicit mutable metrics override. This replaces passing rmgui_font_metrics_measure_layout and a cache to rmgui_layout_set_text_measure. The same invalidation and borrowing rules as rmgui_layout_set_text_binding apply to both font setters.
| void rmgui_layout_set_text_measure | ( | rmgui_layout_t * | k, |
| rmgui_text_measure_fn | callback, | ||
| const void * | ud ) |
Installs a measure-only binding with default userdata ud, clearing any prior prefix and cache.
This works for any conforming callback, including a built-in one, without selecting companion operations. Retained wrapping and ellipsis use the scratch fallback. Use the font setters for the built-in prefix/cache behavior or install them explicitly with rmgui_layout_set_text_binding.
| void rmgui_layout_set_text_prefix | ( | rmgui_layout_t * | k, |
| rmgui_text_prefix_fn | prefix ) |
Replaces only the prefix provider, keeping the active measure callback, userdata and paint cache.
The prefix provider must match the measure callback and effective userdata. NULL restores the scratch fallback. Invalidates measurements and arrangements; NULL k is ignored.
| void rmgui_layout_reset | ( | rmgui_layout_t * | k | ) |
Drops every node, grid and overlay declaration and the focus.
Scale, text binding and scroll states survive. Scroll states remain keyed by their state key; a key not redeclared after reset may be evicted when the table is full. The published snapshot stays readable until the next arrangement. NULL is ignored.
-— declaration --------------------------------------------------------—
| int rmgui_layout_add_root | ( | rmgui_layout_t * | k, |
| const rmgui_layout_node_t * | node, | ||
| size_t * | index ) |
Adds node as a new root (depth 0).
On 0, *index (if non-NULL) is its index, which is also its snapshot index. -1: invalid declaration (including an enabled visual with invalid layer transform/shadow at kernel scale), id in use, handle already bound, or caller storage exhausted; the kernel and the current published snapshot are unchanged.
| int rmgui_layout_add_child | ( | rmgui_layout_t * | k, |
| size_t | parent, | ||
| const rmgui_layout_node_t * | node, | ||
| size_t * | index ) |
Adds node as the last child of container parent.
Refused (-1, kernel unchanged) as rmgui_layout_add_root, and when parent is out of range, a leaf kind, a SCROLL that already has its child, or insufficient caller traversal storage for the new depth.
| int rmgui_layout_update | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| const rmgui_layout_node_t * | node ) |
Replaces node index's declaration; its id, kind, grid, scroll, overlay and fitted_anchor must be unchanged.
An enabled visual is validated at the kernel's current scale. A non-NULL text always counts as changed, so calling this is how a host reports rewritten text behind the same pointer. -1: out of range or invalid; node and snapshot are unchanged.
| int rmgui_layout_set_text | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| const char * | text ) |
Field mutations preserve identity, links and all other declaration fields.
Invalid index, NULL kernel, invalid sizes/insets/visual return -1 without mutation. Success marks this node dirty, and invalidates only its ancestor measurements when an intrinsic field changes. Text is borrowed (NULL means empty) and always invalidates, including replacement behind the same pointer. Hidden accepts only 0 or 1; sizes are nonnegative; inset ranges and max-bound bits match the node declaration. Visual must be non-NULL and obey the declaration's transform/shadow constraints.
| int rmgui_layout_set_hidden | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| int | hidden ) |
| int rmgui_layout_set_preferred_size | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| int | w, | ||
| int | h ) |
| int rmgui_layout_set_min_size | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| int | w, | ||
| int | h ) |
| int rmgui_layout_set_max_size | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| int | w, | ||
| int | h, | ||
| unsigned | bound ) |
| int rmgui_layout_set_padding | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| int | l, | ||
| int | t, | ||
| int | r, | ||
| int | b ) |
| int rmgui_layout_set_margin | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| int | l, | ||
| int | t, | ||
| int | r, | ||
| int | b ) |
| int rmgui_layout_set_flex | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| uint32_t | flex ) |
| int rmgui_layout_set_visual | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| const rmgui_layout_visual_t * | visual ) |
| int rmgui_layout_set_a11y | ( | rmgui_layout_t * | k, |
| size_t | index, | ||
| const rmgui_a11y_record_t * | record ) |
Attach borrowed semantic metadata, or detach with NULL.
Source records may be rewritten behind the same pointer only immediately before calling this setter. Both caller a11y banks are required for non-NULL metadata. Returns -1 for invalid index/record/storage, without mutation. Success invalidates only semantic publication, not measurement or pixel damage. FOCUSED is published from layout focus; node focusability is also exposed. Call arrange after focus changes before consuming the semantic snapshot.
| int rmgui_layout_node_get | ( | const rmgui_layout_t * | k, |
| size_t | index, | ||
| rmgui_layout_node_t * | out ) |
Copies node index's current declaration into *out (corner_radius as clamped).
-1: out of range or NULL; *out unchanged.
| rmgui_layout_links_t rmgui_layout_links | ( | const rmgui_layout_t * | k, |
| size_t | index ) |
Tree links of node index; all -1 when index is out of range.
| int rmgui_layout_find | ( | const rmgui_layout_t * | k, |
| uint64_t | id, | ||
| size_t * | index ) |
0 with *index set to the node whose id is id; -1 when there is none.
Expected constant time (hashed id index).
| int rmgui_layout_grid_declare | ( | rmgui_layout_t * | k, |
| const rmgui_layout_grid_t * | grid, | ||
| uint32_t * | handle ) |
Declares a grid; *handle is its 1-based handle, valid until reset.
-1: table full, no columns, a negative gap or column value.
| int rmgui_layout_scroll_declare | ( | rmgui_layout_t * | k, |
| uint64_t | state_key, | ||
| const rmgui_scroll_t * | declaration, | ||
| uint32_t * | handle ) |
Declares keyed scroll axes, visibility, borrowed style and host DISABLED state.
The kernel supplies scale; existing keys retain offsets/capture. Style must outlive state use and validate; other state bits are invalid. Styled re-declaration invalidates bound arrangement even at the same style address. *handle is 1-based until reset. Returns -1 unchanged on invalid fields or a table full of keys declared since the last reset.
| rmgui_scroll_t * rmgui_layout_scroll_state | ( | rmgui_layout_t * | k, |
| uint32_t | handle ) |
The live scroll state of handle, or NULL.
The host may drive it (offsets, drag state) between arrangements; the next rmgui_layout_arrange notices offset, axes or scrollbar changes, clamps the offsets and re-arranges the viewport. Other fields are rewritten by arrangement.
| int rmgui_layout_overlay_declare | ( | rmgui_layout_t * | k, |
| const rmgui_layout_overlay_t * | overlay, | ||
| uint32_t * | handle ) |
Declares an overlay; *handle is 1-based and valid until reset.
-1: table full or an invalid mode/placement. The anchor is resolved when the node carrying the handle is added.
-— arrangement and queries --------------------------------------------—
| int rmgui_layout_arrange | ( | rmgui_layout_t * | k, |
| size_t | root, | ||
| rmgui_rect_t | box ) |
Measures and arranges the tree under root into box, re-running only nodes whose declaration, scroll state, box or clip changed, and publishes a new snapshot generation.
When nothing changed since the last publication for the same root and box it returns 0 without publishing. Damage is empty on an unchanged pass; otherwise it covers previous and new visual bounds for every changed node. Regions may overlap. Structural changes or changed visibility/paint ordering may damage the whole scene. -1: bad arguments, caller work/text/line storage exhausted, text-callback failure, ASSERT_FITS violation, or an invisible overlay anchor. Snapshot and damage outputs are unchanged on refusal; scroll metrics may reflect the refused pass, and the next call arranges every node again.
| const rmgui_layout_snapshot_t * rmgui_layout_snapshot | ( | const rmgui_layout_t * | k | ) |
The latest published generation, or NULL before the first.
The pointer and every node pointer below stay valid until the next rmgui_layout_arrange on k.
| const rmgui_layout_snapshot_node_t * rmgui_layout_snapshot_node | ( | const rmgui_layout_t * | k, |
| size_t | index ) |
Published node index, or NULL when out of the published range.
| int rmgui_layout_contains | ( | const rmgui_layout_snapshot_node_t * | node, |
| int | x, | ||
| int | y ) |
1 when (x, y) is inside a visible node's arranged rounded rect and clip, and its optional stretched shape hits (coverage >= RMGUI_MASK_HIT_MIN); 0 otherwise, including NULL node.
Independent of visual transform and raised paint ordering.
| int rmgui_layout_hit_test | ( | const rmgui_layout_t * | k, |
| int | x, | ||
| int | y, | ||
| size_t * | index ) |
The frontmost arranged node under (x, y) in the published generation: inside the frontmost non-tooltip overlay when one is open, else under the snapshot root; later declared siblings win, independent of visual bounds and raised paint ordering.
0 with *index set; -1 when nothing is hit.