pub struct Style {Show 27 fields
pub w: Units,
pub h: Units,
pub min_w: f32,
pub min_h: f32,
pub flex: f32,
pub dock: Dock,
pub gap: f32,
pub pad: [f32; 4],
pub margin: [f32; 4],
pub cell: Cell,
pub halign: Option<HAlign>,
pub valign: Option<VAlign>,
pub bg: Color,
pub bg_image: String,
pub color: Color,
pub align: Align,
pub font_scale: f32,
pub text_shadow: bool,
pub focus_style: FocusStyle,
pub focus_color: Color,
pub no_wrap: bool,
pub pos: Option<(f32, f32)>,
pub ellipsis: bool,
pub clip: bool,
pub scroll_y: f32,
pub scrollbar: bool,
pub font: String,
}Expand description
Visual and layout style for a widget.
Fields§
§w: Units§h: Units§min_w: f32§min_h: f32§flex: f32§dock: Dock§gap: f32§pad: [f32; 4]§margin: [f32; 4]§cell: Cell§halign: Option<HAlign>Horizontal placement in its slot (grid cell, or a Column’s width) —
see HAlign. None = the parent’s default.
valign: Option<VAlign>Vertical placement in its slot (grid cell, or a Row’s height) — see
VAlign. None = the parent’s default.
bg: Color§bg_image: StringBackground image, drawn over bg and stretched to the box — a Yog
image source (sprite:button, sprite:panel, mymod:gui/frame);
sprites are nine-sliced, so frames keep their edges. Empty = none.
color: Color§align: Align§font_scale: f32§text_shadow: bool§focus_style: FocusStyle§focus_color: Color§no_wrap: boolLabels/buttons: never word-wrap, even if narrower than the text. For single-line titles/headers that must stay on one line — matches Patchouli, where such text overflows its box horizontally rather than wrapping onto a second line.
pos: Option<(f32, f32)>Absolute position (x, y) inside the parent’s content box (inside its
padding) — WPF Canvas / WinForms Location style. A positioned
widget is taken out of the parent’s flex flow: it takes no main-axis
space, ignores flex/dock, and is drawn in tree order (later
siblings on top). None (default) = normal flex positioning.
ellipsis: boolLabels/buttons: a single line (implies no_wrap) cut with ... when
wider than the box, instead of overflowing it.
clip: boolContainers: children are drawn (and hit) only inside this widget’s rect — anything scrolled or overflowing past it is cut off.
scroll_y: f32Containers: vertical scroll offset of the children in GUI pixels
(0 = top). Layout clamps it to the content — the effective value is
LayoutNode::scroll_y.
scrollbar: boolContainers: reserve a strip on the right edge and draw a vertical
scrollbar there whenever the content overflows (see
ScrollState for driving it).
font: StringFont id for text — empty (default) = the game’s default font
(yog:font/default); a Yog font such as mymod:fancy, or another
game font by Yog’s alias: yog:font/uniform, yog:font/alt,
yog:font/illageralt.
See crate::text for how non-default fonts are measured.