Expand description
Widget types and styling.
Structs§
- Action
- A typed click target:
owner0 = the screen,k= items controlk;slot= the command (orAction::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 agridreads it; out-of-range values are clamped to the grid (like WPF). - Grid
Spec - A grid’s rows, columns and the space between them. No rows (columns)
= one
*row (column), like WPF. - Image
- An image widget’s data — see
image. - State
Flags - Interaction state bits of a widget — see
Widget::state. - State
Styles - A widget’s state patches: each applies when the widget’s state contains its flags; later rules win.
- Style
- Visual and layout style for a widget.
- Style
Patch - Paint-only style overrides — never affect layout.
- TextBox
- A text box’s content and editing state, as drawn this frame. Built by
text_box(text, placeholder, max length, event names); the caret, selection and horizontal scroll are filled in each frame byTextBoxState::apply. - Track
- One row or column of a
GridSpec: its size and the limits on it. - Widget
- A single widget in the UI tree.
Enums§
- Dock
- WinForms-style dock — which edge(s) the widget attaches to inside its parent.
- Focus
Style - How a focused widget shows its focus indicator.
- Grid
Length - 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 cellNonemeansStretch; in a Column it overrides the parent’salignfor this child. - Stretch
- How an image fills the box it’s given — WPF’s
Stretch. - 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; seeHAlign. - Widget
Kind
Constants§
- PLACEHOLDER_
COLOR - Placeholder text color of a text box.
- SELECTION_
COLOR - Selection highlight behind selected text.
- TEXT_
BOX_ BORDER - Border of an unfocused text box (vanilla
EditBox). - TEXT_
BOX_ FOCUS_ BORDER - Border of a focused text box unless
focus_coloris set.
Functions§
- button
- grid
- WPF’s
Grid: a container of rows and columns — give itWidget::rowsandWidget::cols(Tracks: pixels,Autoor*shares) and put each child in a cell withWidget::cell/Widget::span. A child fills its cell unless it hasWidget::halign/Widget::valign(or an explicit size);Widget::margininsets it. - image
- An image from a Yog image source —
"item:apple","block:stone","sprite:button","mymod:gui/logo"(seeyog_gfx::image) — the host resolves it for its Minecraft version. Sized to the image’s natural size (16×16 until the host told it) unless givenw/h; scaled into the widget perWidget::stretch(defaultUniform), nearest-neighbour. - inv_
slot - An inventory-slot decoration (icon + stack-count overlay) for
item_id(empty string = empty slot) withcountitems. Purely decorative — real drag-and-drop still goes through the vanillaSlotthis overlays. - item_
slot - label
- panel
- scroll_
view - A vertically scrolling column: clips its children, scrolls them by
Widget::scroll_yand draws a scrollbar when they overflow — WPF’sScrollVieweraround aStackPanel. Give it a fixed (or flex) height. - spacer
- text_
box - A single-line text input holding
text— black box, grey border (white while focused), like vanilla’sEditBox. Its text, caret and focus live in aTextBoxStatethat the code-behind keeps and applies to it each frame.