Struct std::GuiUi
struct GuiUi {
&Widget root;
?&GuiWindow win;
struct GuiTheme theme;
float scale;
struct GuiCanvas canvas;
int canvasReady;
struct Vec<&Widget> overlays;
?&Widget focus;
?&Widget hoverW;
?&Widget capture;
float mouseX;
float mouseY;
int mouseInside;
?&Widget tipFor;
double tipSince;
&Widget tip;
int tipShown;
double nowMs;
int needsLayout;
int dirty;
int layoutW;
int layoutH;
int cursor;
}Everything a widget tree needs that isn't a widget: the window it's shown in, the theme and scale, keyboard focus, the pointer, open popups (menus, drop-down lists, tooltips) and modal dialogs, and the canvas it paints with. One per window. GuiApp makes them (GuiApp::set_root); Widget::render/dispatch_event make one on first use for a root that has none; or make one yourself.
Fields
set by attach() / render()
the window's scale factor
popups and dialogs, bottom to top
gets the pointer while a button is held
tooltip candidate and since when
the tooltip widget
the size the tree was last laid out to
Methods
A context for 'root' (attached to it: root.ui() returns it).
The window it draws into and gets events from.
Routes one event (see Widget::dispatch_event). Returns 1 if consumed.
Lays out (if needed) and paints the tree and its overlays into the attached window's buffer.
Advances time-driven state — tooltips, caret blinking, busy indicators — to 'nowMs' (gui_time_ms()). Marks the UI dirty when something visible changed.
1 while something animates (the next frame will look different).
1 when the UI needs repainting; render() clears it.
Shows a menu (or any widget) as a popup at window position (x, y), kept on screen. A click outside closes it.
Shows 'dialog' centered over the window, blocking input to everything under it until close_modal() (or the dialog's close_dialog()). The UI doesn't own a shown dialog: free it after closing it (or reuse it).
The topmost open dialog, or null.
Frees the UI and its whole widget tree.
= drop()