Handles mouse clicks.
Types
ButtonObj = object of LabelObj button_mask*: cint ## Mask for handle clicks action_mask*: cint ## BUTTON_RELEASE or BUTTON_CLICK. normal_background_color*: ColorRef ## color, when button is not pressed and not hovered. hover_background_color*: ColorRef ## color, when button hovered. press_background_color*: ColorRef ## color, when button pressed. normal_color*: ColorRef ## text color, whenwhen button is not pressed and not hovered. hover_color*: ColorRef ## text color, when button hovered. press_color*: ColorRef ## text color, when button pressed. on_click*: proc (x, y: float): void ## This called, when user clicks on button.
ButtonPtr = ptr ButtonObj
Procs
proc Button(name: string; variable: var ButtonObj): ButtonPtr {...}{.raises: [], tags: [].}
-
Creates a new Button node pointer.
Arguments:
- name is a node name.
- variable is a ButtonObj variable.
Examples:
var my_button_obj: ButtonObj my_button = Button("Button", my_button_obj)
proc Button(obj: var ButtonObj): ButtonPtr {...}{.inline, raises: [], tags: [].}
-
Creates a new Button node pointer with default node name "Button".
Arguments:
- variable is a ButtonObj variable.
Examples:
var my_button_obj: ButtonObj my_button = Button(my_button_obj)
Methods
method draw(self: ButtonPtr; w, h: GLfloat) {...}{.raises: [GLerror, Exception], tags: [RootEffect].}
- this method uses in the window.nim.
method duplicate(self: ButtonPtr; obj: var ButtonObj): ButtonPtr {...}{.base, raises: [], tags: [].}
- Duplicates Button object and creates a new Button node pointer.
method handle(self: ButtonPtr; event: InputEvent; mouse_on: var NodePtr) {...}{. raises: [Exception], tags: [RootEffect].}
- Handles user input. This uses in the window.nim.