module

Tryst::UI::LayoutIntentValidator

Rejects a layout intent (grow:/gap:/pad:/align:) declared where nothing would honour it. Every node accepts the four keys, so without this a pad: 12 on a grid, or a grow: true on a widget inside a scrollable, parsed fine and then vanished at realize - the layout came out wrong with nothing pointing at the line that asked for it. Runs on every node from Validator#walk.

What honours what:

  • gap:/pad:/align: on a container with a flow (column/row, and the stacked ones: panel/group/tab/pane/window); gap: alone on a grid, where it's the per-cell padx/pady default.
  • grow: on a child of a flow container, or of the root/any other plain-packed container (Realizer#pack_plain). Everything else - a leaf with spacing, a grid's pad:/align:, any of them on a scrollable/tabs/split/canvas/menu, grow: under a grid (say cell(sticky:) or grid.stretch instead), a scrollable (every child already fills), a tabs or split (the notebook/panedwindow places its pages/panes) - is an error.

Constants

SPACING = [:gap, :pad, :align]

Class methods

call(node : Node, parent : Node | Nil, errors : Array(String)) : Nil
Source