The base of other Control nodes.
Types
ControlObj = object of CanvasObj hovered*: bool pressed*: bool focused*: bool mousemode*: MouseMode background_color*: ColorRef mouse_enter*: proc (x, y: float): void ## This called when the mouse enters the Control node. mouse_exit*: proc (x, y: float): void ## This called when the mouse exit from the Control node. click*: proc (x, y: float): void ## This called when the user clicks on the Control node. press*: proc (x, y: float): void ## This called when the user holds on the mouse on the Control node. release*: proc (x, y: float): void ## This called when the user no more holds on the mouse. focus*: proc (): void ## This called when the Control node gets focus. unfocus*: proc (): void ## This called when the Control node loses focus.
ControlPtr = ptr ControlObj
Procs
proc Control(name: string; variable: var ControlObj): ControlPtr {...}{.raises: [], tags: [].}
-
Creates a new Control pointer.
Arguments:
- name is a node name.
- variable is a ControlObj variable.
Examples:
var ctrl_obj: ControlObj ctrl = Control("Control", ctrl_obj)
proc Control(obj: var ControlObj): ControlPtr {...}{.inline, raises: [], tags: [].}
-
Creates a new Control pointer with deffault node name "Control".
Arguments:
- variable is a ControlObj variable.
Examples:
var ctrl_obj: ControlObj ctrl = Control(ctrl_obj)
Methods
method calcPositionAnchor(self: ControlPtr) {...}{.raises: [], tags: [].}
- Calculates node position. This uses in the scene.nim.
method draw(self: ControlPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception], tags: [RootEffect].}
- this method uses in the window.nim.
method duplicate(self: ControlPtr; obj: var ControlObj): ControlPtr {...}{.base, raises: [], tags: [].}
- Duplicates Control object and create a new Control pointer.
method getGlobalMousePosition(self: ControlPtr): Vector2Ref {...}{.base, inline, raises: [], tags: [].}
- Returns mouse position.
method handle(self: ControlPtr; event: InputEvent; mouse_on: var NodePtr) {...}{. raises: [Exception], tags: [RootEffect].}
- Handles user input. This uses in the window.nim.
method setBackgroundColor(self: ControlPtr; color: ColorRef) {...}{.base, raises: [], tags: [].}
- Changes Control background color.
Templates
template controlpattern(): untyped