Expand description
Widget types and styling.
Structs§
- Image
- An image widget’s data — see
image. - Style
- Visual and layout style for a widget.
- 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. - 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.
- 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). - 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
- 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
- mc_
image - A raw Minecraft texture (
"minecraft:textures/..."),img_w × img_hpixels, stretched over the widget. Version-dependent: preferimage. - 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.