Skip to content

Packer

[Source]

GTK2-style box packing algorithm. Computes child allocations given container dimensions, packing axis, and children's size hints + pack options.

When expanding children have more space than needed, extra is distributed equally. When there is less space than needed, expanding children shrink proportionally. Non-expanding children always get their preferred size (truncated only if they physically exceed remaining space).

primitive val Packer

Constructors

create

[Source]

new val create()
: Packer val^

Returns


Public Functions

pack

[Source]

Compute child allocations within a container. Handles pack_start/pack_end, expand/fill, padding, proportional shrinking, and container alignment.

fun box pack(
  axis: (Horizontal val | Vertical val),
  container_w: USize val,
  container_h: USize val,
  children: Array[(USize val , USize val , PackOption val , Bool val)] val,
  align: (AlignStart val | AlignCenter val | AlignEnd val) = reference)
: Array[Allocation val] val

Parameters

Returns


eq

[Source]

fun box eq(
  that: Packer val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: Packer val)
: Bool val

Parameters

Returns