flex

Types

FlexAlign {...}{.size: 4.} = enum
  Auto = 0, Stretch, Center, Start, End, SpaceBetween, SpaceAround, SpaceEvenly
FlexPosition {...}{.size: 4.} = enum
  Relative = 0, Absolute
FlexDirection {...}{.size: 4.} = enum
  Row = 0, RowReverse, Column, ColumnReverse
FlexWrap {...}{.size: 4.} = enum
  NoWrap = 0, Wrap, WrapReverse
FlexItemObj = object
  width*: float32
  height*: float32
  left*: float32
  right*: float32
  top*: float32
  bottom*: float32
  paddingLeft*: float32
  paddingRight*: float32
  paddingTop*: float32
  paddingBottom*: float32
  marginLeft*: float32
  marginRight*: float32
  marginTop*: float32
  marginBottom*: float32
  justifyContent*: FlexAlign
  alignContent*: FlexAlign
  alignItems*: FlexAlign
  alignSelf*: FlexAlign
  position*: FlexPosition
  direction*: FlexDirection
  wrap*: FlexWrap
  grow*: float32
  shrink*: float32
  order*: int
  basis*: float32
  frame: array[4, float32]
  parent: FlexItem
FlexItem = ptr FlexItemObj

Procs

proc newFlexItem(width, height, left, right, top, bottom, paddingLeft,
                 paddingRight, paddingTop, paddingBottom, marginLeft,
                 marginRight, marginTop, marginBottom, grow: float32 = 0.0;
                 shrink: float32 = 1; order: cint = 0;
                 justifyContent: FlexAlign = Start;
                 alignContent: FlexAlign = Stretch;
                 alignItems: FlexAlign = Stretch; alignSelf: FlexAlign = Auto;
                 position: FlexPosition = Relative;
                 direction: FlexDirection = Row; wrap: FlexWrap = NoWrap): FlexItem {...}{.
    raises: [], tags: [].}
proc add(item: FlexItem; child: FlexItem): FlexItem {...}{.discardable, raises: [],
    tags: [].}
Adds a child to a FlexItem. Returns the parent item for convenience chaining.
proc insert(item: FlexItem; child: FlexItem; index: int): FlexItem {...}{.
    discardable, raises: [], tags: [].}
Inserts a child at index. Returns the parent item as for convenience chaining.
proc delete(item: FlexItem; index: int): FlexItem {...}{.raises: [], tags: [].}
Deletes a child at index, returning the deleted item.
proc child(item: FlexItem; index: int): FlexItem {...}{.raises: [], tags: [].}
Retrieves child at index.
proc len(item: FlexItem; index: int): int {...}{.raises: [], tags: [].}
Returns the number of children added to item.
proc root(item: FlexItem): FlexItem {...}{.raises: [], tags: [].}
Starting at item, traverses up to find the root FlexItem.
proc layout(item: FlexItem) {...}{.discardable, raises: [], tags: [].}
Starting at root node item, recursively calculates the layout for all children.
proc x(item: FlexItem): float32 {...}{.raises: [], tags: [].}
Get the item's frame x position. This should only be used after calling layout on the root FlexItem.
proc y(item: FlexItem): float32 {...}{.raises: [], tags: [].}
Get the item's frame y position. This should only be used after calling layout on the root FlexItem.
proc w(item: FlexItem): float32 {...}{.raises: [], tags: [].}
Get the item's frame width. This should only be used after calling layout on the root FlexItem.
proc h(item: FlexItem): float32 {...}{.raises: [], tags: [].}
Get the item's height. This should only be used after calling layout on the root FlexItem.