nodesnim/nodescontrol/box

Moves all child nodes at the center of the box.

Types

BoxObj = object of ControlPtr
  child_anchor*: AnchorRef
BoxPtr = ptr BoxObj

Procs

proc Box(name: string; variable: var BoxObj): BoxPtr {...}{.raises: [], tags: [].}

Creates a new Box pointer.

Arguments:

  • name is a node name.
  • variable is a BoxObj variable.

Examples:

var
  box1_obj: BoxObj
  box1 = Box("My box", box1_obj)
proc Box(obj: var BoxObj): BoxPtr {...}{.inline, raises: [], tags: [].}

Creates a new Box pointer with default name "Box"

Arguments:

  • obj is a BoxObj variable.

Examples:

var
  box1_obj: BoxObj
  box1 = Box(box1_obj)

Methods

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

Adds new child in current node.

Arguments:

  • child: other node.
method draw(self: BoxPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
                                     tags: [RootEffect].}
this method uses in the window.nim.
method duplicate(self: BoxPtr; obj: var BoxObj): BoxPtr {...}{.base, raises: [], tags: [].}

Duplicates Box pointer.

Arguments:

  • obj is BoxObj variable.
method resize(self: BoxPtr; w, h: GLfloat) {...}{.raises: [], tags: [].}

Resizes Box node.

Arguments:

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

Changes child anchor.

Arguments:

  • anchor - Anchor object.
method setChildAnchor(self: BoxPtr; 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.