ui_controls

module pkg::alloy::ui::treesource

The element tree: each element's widget, its children, its layout and its canvas node.

type Nodesource

exp type Node = struct

What laying out reads comes first, then the rest by width, which keeps a node at 136 bytes and layout as fast as measured.

Fields

exp widget: Option<*var Widget> = ::None
exp children: Vector<u32> = Vector<u32>::empty()
exp size: Extent
exp position: Point = ORIGIN

in its parent's coordinates

exp shown_at: Point = ORIGIN

where painting shows it, its edges snapped to device pixels (painting.alloy), and how far its top left lies past the pixel it was snapped to, in device pixels (none until shown)

exp parent: Option<u32> = ::None
exp generation: u32 = 0
exp alive: bool = true
exp transparent: bool = false

laid out as part of its parent (show and each)

exp hidden: bool = false

a hidden view's (switch, screens): with all under it, not laid out, drawn, hit, focused nor described

exp hovered: bool = false
exp moving: bool = false

given a transition (transitions.alloy), which plays as it goes

exp busy: bool = false

showing a resource still loading (network.alloy), for screen readers

exp direction: LayoutDirection = LayoutDirection::LeftToRight

which way it reads as last laid out, and the way directed gave it (languages.alloy)

exp draw: Option<NodeId> = ::None
exp overlay: Option<NodeId> = ::None

over the children of a clipping element

fn new_nodesource

exp fn new_node(self ui: &var Ui, widget: *var Widget, transparent: bool) -> u32

A new node for the widget, adopting the elements it holds.

fn elementsource

exp fn element(self ui: &Ui, index: u32) -> Element

fn adoptsource

exp fn adopt(self ui: &var Ui, parent: u32, child: Element)

Makes the element the node's last child.

fn mark_layoutsource

exp fn mark_layout(self ui: &var Ui, index: u32)

Lays the node out again, and the ancestors whose size may change with it.

fn mark_paintsource

exp fn mark_paint(self ui: &var Ui, index: u32)

fn applysource

exp fn apply(self ui: &var Ui, index: u32, change: Change)

Lays out or paints the node again as the change says.

fn node_sizingsource

exp fn node_sizing(self ui: &Ui, index: u32) -> Sizing

fn invalidate_allsource

exp fn invalidate_all(self ui: &var Ui)

Lays out and paints every element again, as for a new theme.

fn fontssource

exp fn fonts(self ui: &var Ui) -> &var text::Fonts

The fonts text is laid out with: the canvas's, or the Ui's own with none (a headless Ui's, or one's before its window's first frame), which hold the bundled faces alone, so that layout there is the same on every machine and asks the system for nothing; each given what install_fonts installs.