nodesnim/nodescontrol/scroll

It provides primitive scroll box.

Types

ScrollObj = object of ControlObj
  thumb_y_has_mouse*, thumb_x_has_mouse*: bool
  thumb_width*, thumb_height*: float
  viewport_w*, viewport_h*: float
  viewport_x*, viewport_y*: float
  thumb_color*: ColorRef
  back_color*: ColorRef
ScrollPtr = ptr ScrollObj

Procs

proc Scroll(name: string; variable: var ScrollObj): ScrollPtr {...}{.raises: [], tags: [].}

Creates a new Scroll pointer.

Arguments:

  • name is a node name.
  • variable is a ScrollObj variable.

Examples:

var
  scobj: ScrollObj
  sc = Scroll("Scroll", scobj)
proc Scroll(obj: var ScrollObj): ScrollPtr {...}{.inline, raises: [], tags: [].}

Creates a new Scroll pointer with default name "Scroll".

Arguments:

  • variable is a ScrollObj variable.

Examples:

var
  scobj: ScrollObj
  sc = Scroll(scobj)

Methods

method addChild(self: ScrollPtr; other: NodePtr) {...}{.raises: [], tags: [].}

Adds a new node in Scroll.

Arguments:

  • other is other Node.
method duplicate(self: ScrollPtr; obj: var ScrollObj): ScrollPtr {...}{.base, raises: [],
    tags: [].}
Duplicates Scroll object and create a new Scroll pointer.
method resize(canvas: ScrollPtr; w, h: GLfloat) {...}{.raises: [], tags: [].}

Resizes scroll.

Arguments:

  • w is a new width.
  • h is a new height.
method draw(self: ScrollPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
                                        tags: [RootEffect].}
This uses in the window.nim.
method draw2stage(self: ScrollPtr; w, h: GLfloat) {...}{.raises: [GLerror], tags: [].}
This uses in the window.nim.
method scrollBy(self: ScrollPtr; x, y: float) {...}{.base, raises: [], tags: [].}
Scrolls by x and y, if available.
method scrollTo(self: ScrollPtr; x, y: float) {...}{.base, raises: [], tags: [].}
Scrolls to x and y position.
method handle(self: ScrollPtr; event: InputEvent; mouse_on: var NodePtr) {...}{.
    raises: [Exception], tags: [RootEffect].}
handles user input. This uses in the window.nim.