nodesnim/nodescontrol/switch

    Dark Mode
Search:
Group by:

Displays colour rectangle.

Types

SwitchHandler = proc (self: SwitchRef; toggled: bool)
SwitchObj = object of ControlRef
  value*: bool
  color_enable*, color_disable*: ColorRef
  back_enable*, back_disable*: ColorRef
  on_switch*: SwitchHandler  ## This called when switch toggled.
  
SwitchRef = ref SwitchObj

Procs

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

Creates a new Switch.

Arguments:

  • name is a node name.

Example:

var colorrect1 = Switch("Switch")

Methods

method draw(self: SwitchRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
    tags: [RootEffect].}
this method uses in the window.nim.
method duplicate(self: SwitchRef): SwitchRef {...}{.base, raises: [], tags: [].}
Duplicates Switch object and create a new Switch.
method handle(self: SwitchRef; event: InputEvent; mouse_on: var NodeRef) {...}{.
    raises: [Exception], tags: [RootEffect].}
Handles user input. This uses in the window.nim.
method toggle(self: SwitchRef) {...}{.base, raises: [], tags: [].}
Toggles value.