#[repr(C)]pub struct KuiSpec {Show 123 fields
pub width: KuiSizing,
pub height: KuiSizing,
pub min_w: f32,
pub max_w: f32,
pub min_h: f32,
pub max_h: f32,
pub dir: u32,
pub pad_l: f32,
pub pad_r: f32,
pub pad_t: f32,
pub pad_b: f32,
pub gap: f32,
pub main_align: u32,
pub cross_align: u32,
pub bg: u32,
pub border_color: u32,
pub border_w: f32,
pub radius: f32,
pub overflow: u32,
pub float_mode: u32,
pub float_anchor_x: u32,
pub float_anchor_y: u32,
pub float_self_x: u32,
pub float_self_y: u32,
pub float_dx: f32,
pub float_dy: f32,
pub float_fit: u32,
pub hoverable: u32,
pub window_role: u32,
pub transition_ms: f32,
pub easing: u32,
pub slide: u32,
pub hover_bg: u32,
pub pressed_bg: u32,
pub hover_group: KuiStr,
pub per_corner: u32,
pub radius_tl: f32,
pub radius_tr: f32,
pub radius_br: f32,
pub radius_bl: f32,
pub repeat: u32,
pub delay_ms: f32,
pub keyframes: *const KuiKeyframe,
pub keyframes_len: usize,
pub enter: KuiEnter,
pub click_sound: u64,
pub hover_sound: u64,
pub on_layout: *const KuiValue,
pub role: u32,
pub label: KuiStr,
pub checked: u32,
pub value_set: u32,
pub value_now: f32,
pub value_min: f32,
pub value_max: f32,
pub caret: u32,
pub selection_anchor: u32,
pub focusable: u32,
pub disabled: u32,
pub focus_bg: u32,
pub tooltip: KuiStr,
pub modal: *const KuiValue,
pub on_context_menu: *const KuiValue,
pub cursor: u32,
pub selected: u32,
pub expanded: u32,
pub opacity_set: u32,
pub opacity: f32,
pub shadow_color: u32,
pub shadow_blur: f32,
pub shadow_x: f32,
pub shadow_y: f32,
pub shadow_spread: f32,
pub wrap_children: u32,
pub cross_gap: f32,
pub initial_focus: u32,
pub exit: KuiEnter,
pub live: u32,
pub key_up: u32,
pub value_text: KuiStr,
pub description: KuiStr,
pub animate: u32,
pub accent: u32,
pub selectable: u32,
pub on_force_click: *const KuiValue,
pub focus_region: u32,
pub scrollbar: u32,
pub scrollbar_width: f32,
pub scrollbar_color: u32,
pub scrollbar_active_color: u32,
pub anchor: u32,
pub on_scroll: *const KuiValue,
pub on_drop: *const KuiValue,
pub drop_bg: u32,
pub float_clip: u32,
pub aspect_ratio: f32,
pub mixed: u32,
pub value_step: f32,
pub on_change: *const KuiValue,
pub pixel_snap: u32,
pub keep_focus: u32,
pub on_focus: *const KuiValue,
pub rules: u32,
pub rule_w: f32,
pub on_button: *const KuiValue,
pub buttons: u32,
pub overscroll: u32,
pub scroll_axes: u32,
pub modifier_keys: u32,
pub min_w_size: KuiSizing,
pub max_w_size: KuiSizing,
pub min_h_size: KuiSizing,
pub max_h_size: KuiSizing,
pub bounce: f32,
pub gradient: *const KuiGradient,
pub scroll_mods: u32,
pub backdrop_blur: f32,
pub rotate: f32,
pub scale: f32,
pub pivot_set: u32,
pub pivot_x: f32,
pub pivot_y: f32,
pub iterations: f32,
}Expand description
Everything a box node is built from: size, layout, paint, behaviour
tags and accessibility, as the kui_open* family and the stock
widgets read it.
Zero-initialize it and set what you need; a zeroed field is its
documented default. The library reads the whole struct, so build
against the header that matches kui_abi_version(). Pointers (KuiStr
and KuiValue) are borrowed while the node opens and never retained.
Fields§
§width: KuiSizing§height: KuiSizing§min_w: f32Clamps applied after sizing resolves; 0 for max means unconstrained,
0 for min is undeclared, KUI_MIN_FIT the node’s own fit size and
KUI_MIN_NONE a declared 0.
max_w: f32§min_h: f32§max_h: f32§dir: u32KUI_COLUMN (0), KUI_ROW (1) or KUI_TABLE (2): a column whose
rows’ children line up in columns.
pad_l: f32§pad_r: f32§pad_t: f32§pad_b: f32§gap: f32§main_align: u320 = start, 1 = center, 2 = end
cross_align: u32§bg: u320xRRGGBBAA; 0 = transparent
border_color: u32§border_w: f32§radius: f32§overflow: u32KUI_CLIP | KUI_SCROLL_X | KUI_SCROLL_Y; the same bits the
binary protocol carries, applied by NodeSpec::overflow_bits.
float_mode: u32KUI_FLOAT_NONE (in flow), KUI_FLOAT_PARENT or KUI_FLOAT_VIEWPORT.
kui_spec_float_preset fills this and the fields below from one of
the named presets.
float_anchor_x: u32Attach points as align values (0 start, 1 center, 2 end).
float_anchor_y: u32§float_self_x: u32§float_self_y: u32§float_dx: f32§float_dy: f32§float_fit: u32Non-zero: flip across the anchor / clamp to stay in the viewport.
hoverable: u32Non-zero: hover-track this node (kui_is_hovered) without a payload.
window_role: u32Window-chrome role: 0 = none, 1 = drag, 2 = close button, 3 = minimize button, 4 = maximize button. Chrome nodes emit window commands (kui_take_window_command), never events.
transition_ms: f32Positive: ease sizing/colors/radius changes over this many ms (the node needs a stable key, i.e. kui_open_keyed). Needs kui_set_time.
easing: u32KUI_EASE_* curve for transition_ms.
slide: u32Non-zero (with transition_ms): also ease the node’s position, so
reordered siblings slide into place.
hover_bg: u320xRRGGBBAA background while hovered (or while any node in the same
hover group is); 0 = none. Implies hover tracking; eases with
transition_ms.
pressed_bg: u320xRRGGBBAA background while pressed; 0 = none. Implies hover tracking.
hover_group: KuiStrHover group name (empty = none): members show hover_bg / pressed_bg together. Hashed by the core; the string is not retained.
per_corner: u32Non-zero: radius_tl..radius_bl are the four corner radii and
radius is ignored (zero = uniform radius on every corner).
radius_tl: f32§radius_tr: f32§radius_br: f32§radius_bl: f32§repeat: u32KUI_REPEAT_* direction for keyframes (CSS animation-direction).
delay_ms: f32Holds the keyframe cycle back by this many ms (CSS animation-delay).
keyframes: *const KuiKeyframeCSS-style stops (keyframes_len of them; NULL/0 = none): the slots
they name cycle over transition_ms, forever, without the view
redrawing. Read while the node opens; not retained.
keyframes_len: usize§enter: KuiEnterEntrance: with set non-zero, the named slots ease in from these
values on the node’s first sight (see KuiEnter).
click_sound: u64Registered sounds (kui_sound_add) played when the node is clicked /
the pointer enters it; 0 = none. Either makes the node hover-tracked.
hover_sound: u64§on_layout: *const KuiValueLayout tag (NULL = none): the node’s laid-out rect arrives as
{kind="layout", x, y, w, h, parent, tag} on its first frame and
whenever it changes. Borrowed — cloned while the node opens, so the
caller keeps ownership and frees it as usual; kui_value_null()
asks for the events without a tag.
role: u32KUI_ROLE_* (0 = unset: the core derives one). What the node is to assistive technology; KUI_ROLE_NONE hides it and its subtree.
label: KuiStrAccessible name (empty = none). Copied while the node opens.
checked: u32Non-zero: a checkbox / radio / switch role is on.
value_set: u32KUI_VALUE_NOW / MIN / MAX bits saying which of the three below are set (a slider role’s position and range).
value_now: f32§value_min: f32§value_max: f32§caret: u32On a KUI_ROLE_LINE of a custom editor: the caret’s byte offset into
the line’s text, and the selection’s other end (KUI_VALUE_CARET /
KUI_VALUE_ANCHOR in value_set say which are present).
KUI_VALUE_CARET_SOLID beside KUI_VALUE_CARET says the caret is
solid — a block caret in a modal editor’s normal mode — so
kui_has_caret leaves it out and no blink clock is armed on it,
while it still anchors the IME and reads to assistive technology.
selection_anchor: u32§focusable: u32Non-zero: reachable by Tab (and focused by a click) without a click payload or a control role.
disabled: u32Non-zero: inert — no click, drag or key sink, no hover / pressed / focus background, skipped by Tab, reported disabled to assistive technology; hover tracking stays so a tooltip can say why.
focus_bg: u320xRRGGBBAA background while the node holds keyboard-visible focus (Tab or assistive technology put it there); 0 = the core’s default ring.
tooltip: KuiStrHover hint (empty = none), the tooltip prop of the other
bindings: makes the node hover-tracked, becomes its accessible
description, and floats kui_core::widgets::tooltip below it while
the pointer is over it: as its last child for the kui_open*
family and the kui_fragment* doors (backlog RG124), which
kui_close draws, and beside a leaf, anchored to it,
for the leaf doors (leaf_spec_of, backlog RG113).
modal: *const KuiValueModal surface (NULL = none): while this node is declared the Tab
ring is its subtree, everything outside it is inert to the pointer,
the wheel and assistive technology, and Escape or a press outside
emits {kind="dismiss", reason, tag} on it — the app stops opening
the node. The last one declared wins (a confirm inside a dialog);
a modal that must cover the app is a float. Borrowed — cloned
while the node opens, so the caller keeps ownership;
kui_value_null() asks for the behaviour without a tag.
Context menu (NULL = none): a secondary-button press over this node
emits {kind="contextmenu", x, y, tag} on it, at the logical point
to open the menu at. The press moves no focus, places no caret and
produces no click. Borrowed — cloned while the node opens, so the
caller keeps ownership; kui_value_null() asks for the behaviour
without a tag.
cursor: u32KUI_CURSOR_* (0 = unset: the I-beam over text, the arrow otherwise — a clickable or draggable node included). The pointer shape while the pointer is over this node; a node with only a cursor is hover-tracked so it can be found.
selected: u32Non-zero: this node is the current one of its set — the shown tab, the picked row, the link for the page you are on. A KUI_ROLE_TAB reports the state either way; a row or a link reports it only when this is set.
expanded: u32KUI_EXPANDED_* (0 = unset: the node does not expand and says nothing about it). What a twisty, an accordion header or a menu button reads as.
opacity_set: u32Non-zero: opacity is the node’s group opacity (0 without this bit
means “not set”, so a fully transparent subtree stays expressible).
opacity: f32Group opacity 0..1 with opacity_set: fades this node and its whole
subtree. A per-quad alpha multiply, not an offscreen composite, so
overlapping pieces of one subtree show their seams through the fade;
layout, hit-testing and the access tree are untouched. Eases with
transition_ms.
shadow_color: u320xRRGGBBAA drop-shadow color; 0 = no shadow, and nothing else here
draws without it. The shadow is the node’s rounded rect moved by
shadow_x/shadow_y, grown by shadow_spread and blurred over
shadow_blur, painted behind the node. Outer shadows only, and the
shape is not knocked out of the middle.
shadow_blur: f32Blur radius (logical px): the edge ramps over this distance and reaches this far past the shape. 0 = a hard edge.
shadow_x: f32Offset (logical px); positive shadow_y casts downward.
shadow_y: f32§shadow_spread: f32Grows (negative: shrinks) the shape before blurring (logical px).
wrap_children: u32Non-zero: children that don’t fit the main axis start a new line
instead of overflowing or shrinking. Rows only — a column, or a row
with KUI_OVERFLOW_SCROLL_X, lays out as if this were 0 and raises a
wrap-ignored warning.
cross_gap: f32Space between wrap lines, across the main axis (gap stays the
space between children along it).
initial_focus: u32Non-zero: where focus lands when the enclosing modal scope is
entered - the first node in the modal’s Tab ring declaring it,
instead of the ring’s first, so a destructive confirm opens on its
Cancel. Read on entry only; nothing declaring it (or only nodes
the ring skips) keeps the ring’s first node.
exit: KuiEnterExit: with set non-zero and a transition_ms, the frame after the
view stops declaring this node its subtree is copied out of the last
frame that had it and replayed — frozen where layout left it, on top
of everything and inert — while the named slots ease from where they
were to these values (see KuiEnter, which an exit reuses: an exit
is an entrance read the other way).
live: u32KUI_LIVE_* (0 = KUI_LIVE_OFF, the default): when the text inside
this node changes, a screen reader reads the change without being
asked. A node that declares it is semantic, so a plain box marked
live is not elided from the access tree. For a one-off with no node
behind it, kui_announce is the other half.
key_up: u32Non-zero, with a non-NULL on_key on kui_open_with: the sink hears
releases too, as the same {kind="key"} payload with phase="up"
(text null, repeat false) — for a held-key interaction (WASD,
press-and-hold, a key that arms a mode while it is down). A key only
comes up where it went down, and focus leaving while a key is held
delivers the up first. Zero: presses only, which is what a keymap
wants — one that heard both halves would run every binding twice.
value_text: KuiStrWhat a slider role’s position reads as, empty for none (ARIA’s
aria-valuetext). Without one a reader has only value_now and the
range and says a percentage — 25 in [5..60] is “36 percent” — so a
value whose unit carries the meaning says it here: “25 minutes”. It
replaces the number in the reading rather than joining it, and a
nudge announces the new text. Copied while the node opens. It
arrives back as KuiAccessNode.value (KUI_ACCESS_HAS_VALUE), the
one string slot a node has.
description: KuiStrThe accessible description (empty = none): the extra sentence a
reader says after the name, for what the name cannot say on its own
— what a button will do, why a control is disabled, what format a
field wants. tooltip is the shorthand that also draws the string
and hover-tracks the node; this is the description alone, for a hint
that is spoken and never drawn. Both write the one slot and this one
is applied second, so it wins over a tooltip on the same node. It
reads only on a node that reaches the access tree — a role, a label,
a control — since a plain box is elided and takes its description
with it. Borrowed while the node opens.
animate: u32Non-zero: ask for another frame after this one, every frame this
node is declared (animate). What a kui_fragment reading time
needs. Opt-in, because it takes the loop off input-driven; one node
asking is enough for the window.
accent: u32Non-zero: paint this node’s background in the OS accent colour
(kui_env_set_system), keeping bg where the host never said what
it is. On kui_button_with it takes the hover and pressed shades
and the label colour with it.
selectable: u32Non-zero: this node is a selection scope. The text of every node inside it selects as one run, and a press-drag across them takes the lot. Declared on the container, not on each label.
on_force_click: *const KuiValueForce-click tag (on_force_click): a press that deepens past the
second stage of a Force Touch trackpad over this node emits
{kind:"forceclick", x, y, tag} on it. Borrowed while the node
opens, like every other tag.
focus_region: u32Non-zero: this node’s subtree is a focus region, a Tab ring of its
own that the ring outside never enters and that never leaves.
Entered on purpose: kui_focus_region, a press inside it, or a
focus on a node in it. Nothing else about the node changes.
scrollbar: u32When this node’s scrollbars are drawn: KUI_SCROLLBAR_* (the
scrollbar row’s index plus one), 0 for the default, which is
KUI_SCROLLBAR_VISIBLE.
scrollbar_width: f32The thumb’s width at rest, logical px; 0 for the stock 4. Under the pointer or dragged it is 2 px wider.
scrollbar_color: u32The thumb at rest and under the pointer, 0xRRGGBBAA; 0 (fully
transparent, like every unset colour) for the theme’s scrollbar
and scrollbar_active.
scrollbar_active_color: u32§anchor: u32Non-zero: scroll anchoring on this scrolling node (CSS’s
overflow-anchor): the first child in view keeps its place on
screen when the content before it changes size.
on_scroll: *const KuiValueScroll tag (on_scroll): the wheel over this node emits
{kind:"scroll", x, y, dx, dy, lines, tag} on it instead of
scrolling anything (lines the whole lines a cells grid’s delta
covers, null elsewhere), and a drag-select held past a grid’s edge
arrives the same way once a frame. Borrowed while the node opens,
like every other tag.
on_drop: *const KuiValueDrop-zone tag (on_drop): files dragged in from the OS over this
node emit {kind:"drop", phase, paths, x, y, tag} on it, phase
one of enter, move, leave, drop. A node inside a zone is
the zone’s; a node that is no zone is looked past. Borrowed while
the node opens, like every other tag. ABI 18.
drop_bg: u32Background while dragged files are over this node, 0xRRGGBBAA;
0 for none. Wins over pressed_bg, focus_bg and hover_bg;
eases with transition. ABI 18.
float_clip: u32Non-zero: a KUI_FLOAT_PARENT float takes its parent’s clip, as a
child does, instead of escaping every ancestor’s: cut at a clip
canvas’s edge and not hit past it. Read with the parent anchor
only; still painted as a layer over its in-flow siblings. ABI 19.
aspect_ratio: f32Width over height (aspectRatio); 0 for none. It sizes the axis
whose sizing is fit: a fit height from the final width, a fit width
from a fixed height. ABI 19.
mixed: u32A checkbox that is neither on nor off (mixed): read as mixed
whatever checked says, drawn as a dash by kui_checkbox. ABI 19.
value_step: f32A slider’s step (valueStep), present when KUI_VALUE_STEP is in
value_set. ABI 19.
on_change: *const KuiValueA slider’s change tag (onChange): the core turns a press, a drag,
the arrows, PageUp / PageDown and Home / End into
{kind:"change", value, phase, tag}. Borrowed while the node
opens, like every other tag. ABI 19.
pixel_snap: u32Non-zero: paint the background, border, shadow and fragment with each edge
on a whole physical pixel (pixelSnap), so snapped boxes that
share an edge in layout, and one beside a text’s background, meet
without a seam. A zeroed field is a box drawn where layout put it.
ABI 20.
keep_focus: u32Non-zero: a press on this node or inside it leaves keyboard focus
where it was (keepFocus). ABI 20.
on_focus: *const KuiValueFocus entering or leaving this node’s subtree emits {kind:"focus", phase, by, tag} (onFocus). Borrowed while the node opens, like
every other tag. ABI 20.
rules: u32A table’s grid rules (rules), 0xRRGGBBAA; 0 draws none. ABI 20.
rule_w: f32Their width in logical px (ruleWidth); 0 is 1. ABI 20.
The non-primary buttons as {kind:"button", phase, button, x, y, clicks, tag} events on the node that claims them, captured from
press to release (onButton). Borrowed while the node opens, like
every other tag. ABI 20.
Which buttons on_button claims, as KUI_BUTTONS_* bits; 0 is all
three. ABI 20.
overscroll: u32Whether a scroll gesture starting over this scroller at its limit
goes on to the one around it (overscroll): KUI_OVERSCROLL_*,
the row’s index plus one; 0 is auto. ABI 20.
scroll_axes: u32Which axes on_scroll takes (scrollAxes): KUI_SCROLL_AXES_*,
the row’s index plus one; 0 is both. ABI 20.
modifier_keys: u32Non-zero, with on_key: the modifier and lock keys arrive as keys
of their own (modifierKeys), with codes “shift”, “ctrl”, “alt”,
“super”, “capslock”, “numlock”, “scrolllock” and the side in
location. Zero: a modifier is only ever held. ABI 21.
min_w_size: KuiSizingThe clamps as size expressions: a KUI_FIXED, KUI_PERCENT or
KUI_CALC sizing (kui_size_*) here replaces the float of the
same name, resolved by layout against the parent’s content box;
zeroed (KUI_FIT), the float holds. ABI 22.
max_w_size: KuiSizing§min_h_size: KuiSizing§max_h_size: KuiSizing§bounce: f32How far a spring overshoots (bounce), in place of a spring
easing’s own, and making a timed easing a spring; 0 is the
easing’s own, since a spring with none is KUI_EASE_SMOOTH.
ABI 23.
gradient: *const KuiGradientA gradient painted over bg, under the border and the children;
NULL for none. Read during the call. ABI 24.
scroll_mods: u32The modifiers on_scroll is for (scrollMods), as KUI_KMOD_*
bits: with any set, the node hears only a scroll gesture begun
with one of them held, ahead of every scroller under the pointer.
0 is none: a handler like any other. ABI 25.
backdrop_blur: f32Blur what was drawn beneath the node, inside its rounded box, by
this radius in logical px (backdropBlur, backlog F129); 0 is
none. ABI 26.
rotate: f32A turn of the node and everything under it, in turns clockwise,
about its pivot, after layout (rotate, ADR 0043); 0 is none.
ABI 27.
scale: f32A uniform scale about the pivot (scale); 0, the zeroed spec, is
1 — a scale of nothing is opacity’s job. ABI 27.
pivot_set: u32KUI_PIVOT_X / KUI_PIVOT_Y bits saying which of pivot_x /
pivot_y hold — fractions of the box (pivotX / pivotY); an
axis not set keeps the centre, so a pivot on the top edge or at
the top-left corner stays expressible. ABI 27.
pivot_x: f32§pivot_y: f32§iterations: f32How many times the keyframes cycle runs (iterations, backlog
F133); 0, the zeroed spec, is for ever. A finite cycle plays from
the first frame the node is declared with it and rests where its
last iteration ended. ABI 27.
Trait Implementations§
Auto Trait Implementations§
impl !Send for KuiSpec
impl !Sync for KuiSpec
impl Freeze for KuiSpec
impl RefUnwindSafe for KuiSpec
impl Unpin for KuiSpec
impl UnsafeUnpin for KuiSpec
impl UnwindSafe for KuiSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.