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
ScrollRef = ref ScrollObj

Procs

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

Creates a new Scroll.

Arguments:

  • name is a node name.

Example:

var sc = Scroll("Scroll")

Methods

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

Adds a new node in Scroll.

Arguments:

  • other is other Node.
method duplicate(self: ScrollRef): ScrollRef {...}{.base, raises: [], tags: [].}
Duplicates Scroll object and create a new Scroll.
method draw(self: ScrollRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
    tags: [RootEffect].}
This uses in the window.nim.
method scrollBy(self: ScrollRef; x, y: float) {...}{.base, raises: [], tags: [].}
Scrolls by x and y, if available.
method scrollTo(self: ScrollRef; x, y: float) {...}{.base, raises: [], tags: [].}
Scrolls to x and y position.
method handle(self: ScrollRef; event: InputEvent; mouse_on: var NodeRef) {...}{.
    raises: [Exception], tags: [RootEffect].}
handles user input. This uses in the window.nim.
method postdraw(self: ScrollRef; w, h: GLfloat) {...}{.raises: [GLerror], tags: [].}
This uses in the window.nim.