UI module

layout_tree

procedureextensionexperimentalsince 0.31.0Source

Measure and arrange the whole tree for the window's size. end_frame calls it; call it again only after changing a node by hand.

Example↗
ui := headless(.{ width = 200, height = 100 });
defer free_ui(*ui);
push_ui(*ui);
begin_frame(*ui);
button("OK");
while ui.stack.count > 1 end_container(*ui);
layout_tree(*ui);   // end_frame does this for you
pop_ui();
assert(find_label(*ui, "OK").rect.w > 0);
layout_tree :: (ui: *UI_State)

Measure and arrange the whole tree for the window's size. end_frame calls it; call it again only after changing a node by hand.

Parameters

ui: *UI_State
the UI whose tree to lay out.
Example↗
ui := headless(.{ width = 200, height = 100 });
defer free_ui(*ui);
push_ui(*ui);
begin_frame(*ui);
button("OK");
while ui.stack.count > 1 end_container(*ui);
layout_tree(*ui);   // end_frame does this for you
pop_ui();
assert(find_label(*ui, "OK").rect.w > 0);

See also