nodesnim/nodescontrol/box

Moves all child nodes at the center of the box.

Types

BoxObj = object of ControlRef
  child_anchor*: AnchorObj
BoxRef = ref BoxObj

Procs

proc Box(name: string = "Box"): BoxRef {...}{.raises: [], tags: [].}

Creates a new Box.

Arguments:

  • name is a node name.

Example:

var box1 = Box("My box")

Methods

method getChildSize(self: BoxRef): Vector2Obj {...}{.base, raises: [], tags: [].}
Returns Vector2 of the minimal size of the box pointer.
method addChild(self: BoxRef; child: NodeRef) {...}{.raises: [], tags: [].}

Adds new child in current node.

Arguments:

  • child: other node.
method draw(self: BoxRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
    tags: [RootEffect].}
this method uses in the window.nim.
method duplicate(self: BoxRef): BoxRef {...}{.base, raises: [], tags: [].}
Duplicates Box.
method resize(self: BoxRef; w, h: GLfloat; save_anchor: bool = false) {...}{.
    raises: [], tags: [].}

Resizes Box node.

Arguments:

  • w is a new width.
  • h is a new height.
method setChildAnchor(self: BoxRef; anchor: AnchorObj) {...}{.base, raises: [],
    tags: [].}

Changes child anchor.

Arguments:

  • anchor - Anchor object.

See also:

method setChildAnchor(self: BoxRef; x1, y1, x2, y2: float) {...}{.base, raises: [],
    tags: [].}

Changes child anchor.

Arguments:

  • x1 and y1 is an anchor relative to Box size.
  • x2 and y2 is an anchor relative to child size.

See also: