Skip to main content

Module ui

Module ui 

Source
Expand description

UI framework — flexbox layout + widgets on top of yog-gfx.

Modules§

component
Custom components — a mod’s own reusable widgets, used from .yui markup like the built-in elements (the user controls of WPF).
event
The raw UI events a Yog screen’s register_ui handler receives, parsed once into UiEvent.
image
Image widgets: natural size (asked from the host, cached) and drawing — fitting the image into the widget per its Stretch and cutting it to the clip rect.
layout
rich
Yog text — one format for every text a mod writes (.yres, .yui, books), the same for every host, version and the designer:
scroll
Driving a scrolling container (widget::scroll_view()) from the raw UI events a Yog screen receives (scroll:DY, click:X:Y, drag:X:Y, release:X:Y).
surface
Surfaces — widgets that draw themselves.
text
Text wrapping utilities shared by layout (measuring) and render (drawing).
textbox
Driving a single-line text input (widget::text_box()) from the raw UI events a Yog screen receives — click:X:Y, drag:X:Y, release:X:Y, key:KEY:MODS and char:CODEPOINT — like ScrollState does for scroll views.
theme
Themes: the look of .yui screens, apart from their markup.
widget
Widget types and styling.

Structs§

Action
A typed click target: owner 0 = the screen, k = items control k; slot = the command (or Action::SELECT); index = the item index inside an items control (0 elsewhere).
Cell
The grid cell(s) a widget occupies — WPF’s Grid.Row, Grid.Column, Grid.RowSpan, Grid.ColumnSpan. Only a grid reads it; out-of-range values are clamped to the grid (like WPF).
GridLines
Where a grid’s rows and columns ended up — for drawing grid lines and designer adorners.
GridSpec
A grid’s rows, columns and the space between them. No rows (columns) = one * row (column), like WPF.
LayoutNode
Rect
ScrollState
Scroll offset plus scrollbar-drag state of one scrolling container.
StateFlags
Interaction state bits of a widget — see Widget::state.
StateStyles
A widget’s state patches: each applies when the widget’s state contains its flags; later rules win.
StylePatch
Paint-only style overrides — never affect layout.
TextBoxState
Text, caret, selection and focus of one text box.
Track
One row or column of a GridSpec: its size and the limits on it.
UiRoot
Top-level UI tree. Build it, call layout, then [render] each frame.
Widget
A single widget in the UI tree.

Enums§

Align
Dock
WinForms-style dock — which edge(s) the widget attaches to inside its parent.
FlexDir
FocusStyle
How a focused widget shows its focus indicator.
GridLength
How a grid row or column is sized — WPF’s GridLength.
HAlign
Where a widget sits horizontally in the space its parent gives it — WPF’s HorizontalAlignment. In a grid cell None means Stretch; in a Column it overrides the parent’s align for this child.
Pointer
A pointer event on a surface, in coordinates local to its box (0,0 = top-left corner).
Stretch
How an image fills the box it’s given — WPF’s Stretch.
TextBoxEvent
What TextBoxState::handle did with an event.
UiEvent
One parsed UI event — see the module docs.
Units
A size value — either a fixed pixel amount, a CSS-style percentage of the parent’s own resolved content size (0.0–100.0), or Auto (size to content/available space, this crate’s original behaviour).
VAlign
Where a widget sits vertically — WPF’s VerticalAlignment; see HAlign.

Traits§

Surface
What a surface widget draws and how it takes the pointer — see the module docs.

Functions§

hit_path
The child-index path (as in Widget::at_path) of the node hit_test finds at (mx, my); None on a miss.
node_at
The node at child-index path (&[] = node).
set_focus
Walk tree and set focused = true on the node whose id matches, false on all others.