|
RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
|
Caller-owned tooltip arbitration, timing, placement and pure painting. More...
#include <stdint.h>#include "input.h"#include "paint.h"#include "style_ext.h"#include "ui_context.h"Data Structures | |
| struct | rmgui_tooltip_t |
| Zero-initialize states and group. More... | |
| struct | rmgui_tooltip_group_t |
| struct | rmgui_tooltip_placement_t |
| struct | rmgui_tooltip_view_t |
| A zero-initialized tooltip state, its borrowed timing group, and optional content hook. More... | |
Typedefs | |
| typedef void(*) | rmgui_tooltip_content_fn(rmgui_target_t *, rmgui_rect_t content, rmgui_rect_t clip, void *user) |
| Optional rich-content hook, invoked once after chrome, through the SAME target for CPU and RECORD. | |
Enumerations | |
| enum | rmgui_tooltip_side_t { RMGUI_TOOLTIP_TOP , RMGUI_TOOLTIP_BOTTOM , RMGUI_TOOLTIP_LEFT , RMGUI_TOOLTIP_RIGHT } |
| Preferred side; placement flips to its opposite when that fits better. More... | |
Functions | |
| int | rmgui_tooltip_group_init (rmgui_tooltip_group_t *, uint32_t delay_ms, uint32_t hide_ms, uint32_t warm_ms) |
| Initialize an idle group. | |
| int | rmgui_tooltip_input (rmgui_tooltip_group_t *, rmgui_tooltip_t *, rmgui_rect_t anchor, const rmgui_input_t *) |
| Route pointer MOVE/LEAVE and FOCUS_IN/OUT for this anchor. | |
| int | rmgui_tooltip_step (rmgui_tooltip_group_t *, uint32_t dt_ms) |
| Advance delay/hide/warm countdowns, including leftover dt at transitions. | |
| int | rmgui_tooltip_visible (const rmgui_tooltip_group_t *, const rmgui_tooltip_t *) |
| 1 only for the group's currently visible state, otherwise 0. | |
| int | rmgui_tooltip_place (rmgui_rect_t anchor, rmgui_rect_t bounds, rmgui_size_t size, rmgui_tooltip_side_t preferred, int gap, int arrow_size, int padding, rmgui_tooltip_placement_t *out) |
| Compute a box of requested outer size, shift into bounds and flip if the opposite side has more room and the preferred side cannot fit. | |
| void | rmgui_tooltip_paint_to (rmgui_target_t *, const rmgui_style_ext_resolved_t *, const rmgui_tooltip_placement_t *, rmgui_rect_t clip, rmgui_tooltip_content_fn, void *user) |
| Caller-resolved extension class requires COLOR background/border and nonnegative LENGTH border-width. | |
| void | rmgui_tooltip_paint (rmgui_fb_t *, const rmgui_style_ext_resolved_t *, const rmgui_tooltip_placement_t *, rmgui_rect_t clip, rmgui_tooltip_content_fn, void *user) |
| int | rmgui_tooltip_event (rmgui_tooltip_view_t *tooltip, rmgui_rect_t anchor, const rmgui_input_t *event) |
| Route one event for the host-supplied anchor. | |
| int | rmgui_tooltip_draw (const rmgui_ui_t *ui, const rmgui_tooltip_view_t *tooltip, const rmgui_style_ext_resolved_t *style, const rmgui_tooltip_placement_t *placement) |
| Draw a visible tooltip using a placement from rmgui_tooltip_place and a resolved extension style. | |
Caller-owned tooltip arbitration, timing, placement and pure painting.
| typedef void(*) rmgui_tooltip_content_fn(rmgui_target_t *, rmgui_rect_t content, rmgui_rect_t clip, void *user) |
Optional rich-content hook, invoked once after chrome, through the SAME target for CPU and RECORD.
It must be allocation-free, pure with respect to widget state, and honor content intersect clip. user is borrowed.
| enum rmgui_tooltip_side_t |
| int rmgui_tooltip_group_init | ( | rmgui_tooltip_group_t * | , |
| uint32_t | delay_ms, | ||
| uint32_t | hide_ms, | ||
| uint32_t | warm_ms ) |
Initialize an idle group.
NULL returns -1; otherwise 0. Durations may be zero. Reinitialize only when no state remains associated with the group.
| int rmgui_tooltip_input | ( | rmgui_tooltip_group_t * | , |
| rmgui_tooltip_t * | , | ||
| rmgui_rect_t | anchor, | ||
| const rmgui_input_t * | ) |
Route pointer MOVE/LEAVE and FOCUS_IN/OUT for this anchor.
Press (primary, auxiliary or touch), WHEEL and ESC cancel the group's active tooltip even when routed for another anchor. Cancellation blocks the cancelled state until both triggers have left; then reentry may arm it again. Replacing a pending/visible anchor hides it immediately. Input never consumes events. Returns 1 when timing/visibility/trigger state changes, 0 otherwise; -1 for NULL or nonpositive anchor extents, unchanged.
| int rmgui_tooltip_step | ( | rmgui_tooltip_group_t * | , |
| uint32_t | dt_ms ) |
Advance delay/hide/warm countdowns, including leftover dt at transitions.
Warm-up starts when a visible tooltip closes; a new anchor in that window opens immediately. Leaving a pending anchor cancels its delay. Leaving a visible anchor starts hide_ms; reentry cancels that hide. 1 changed, 0 idle or dt=0, -1 NULL unchanged.
| int rmgui_tooltip_visible | ( | const rmgui_tooltip_group_t * | , |
| const rmgui_tooltip_t * | ) |
1 only for the group's currently visible state, otherwise 0.
| int rmgui_tooltip_place | ( | rmgui_rect_t | anchor, |
| rmgui_rect_t | bounds, | ||
| rmgui_size_t | size, | ||
| rmgui_tooltip_side_t | preferred, | ||
| int | gap, | ||
| int | arrow_size, | ||
| int | padding, | ||
| rmgui_tooltip_placement_t * | out ) |
Compute a box of requested outer size, shift into bounds and flip if the opposite side has more room and the preferred side cannot fit.
Oversize boxes shrink to bounds. gap/arrow_size/padding >= 0; anchor/bounds/size >0; coordinates plus extents must be representable by int. Arrow is optional (size=0), fitted within bounds, and omitted if no gap remains. Returns 0, or -1 invalid with out untouched. Content is rect inset by padding.
| void rmgui_tooltip_paint_to | ( | rmgui_target_t * | , |
| const rmgui_style_ext_resolved_t * | , | ||
| const rmgui_tooltip_placement_t * | , | ||
| rmgui_rect_t | clip, | ||
| rmgui_tooltip_content_fn | , | ||
| void * | user ) |
Caller-resolved extension class requires COLOR background/border and nonnegative LENGTH border-width.
Invalid/missing properties paint nothing. Placement (including padding/arrow) is already resolved by place(). Text and rich content are host-owned; RECORD glyphs must be prepared before this call, resources immutable through submit/discard. No allocation; stream failures latch. Neither painter changes group or widget state.
| void rmgui_tooltip_paint | ( | rmgui_fb_t * | , |
| const rmgui_style_ext_resolved_t * | , | ||
| const rmgui_tooltip_placement_t * | , | ||
| rmgui_rect_t | clip, | ||
| rmgui_tooltip_content_fn | , | ||
| void * | user ) |
| int rmgui_tooltip_event | ( | rmgui_tooltip_view_t * | tooltip, |
| rmgui_rect_t | anchor, | ||
| const rmgui_input_t * | event ) |
Route one event for the host-supplied anchor.
Returns 1 on change, 0 on no change, or -1 for invalid arguments. Use rmgui_tooltip_step to advance the shared clock.
| int rmgui_tooltip_draw | ( | const rmgui_ui_t * | ui, |
| const rmgui_tooltip_view_t * | tooltip, | ||
| const rmgui_style_ext_resolved_t * | style, | ||
| const rmgui_tooltip_placement_t * | placement ) |
Draw a visible tooltip using a placement from rmgui_tooltip_place and a resolved extension style.
A hidden tooltip returns 0 without using the placement or style. The host stages any glyphs used by the content hook before recording. Returns -1 for invalid arguments or style, otherwise 0; paint errors latch on the target.