src/sigui/mouseArea

Source   Edit  

Types

MouseArea = ref object of Uiobj
  acceptedButtons*: Property[set[MouseButton]] = (unsafeVal: {left},
      changed: (p: nil, firstHandHandler: nil, firstHandHandlerEnv: nil)) ## handle only events of these buttons
  pressed*: Property[bool]   ## is mouse button (any of accepted) pressed inside this area (or was pressed inside) and is pressed now
  hovered*: Property[bool]   ## is mouse over this area now
  mouseX*, mouseY*: Property[float32] ## current mouse position, relative to this area (see also: mouseXy)
  grabbed*: Property[bool] ## sets to true when mouse was pressed inside and started moving while in this area
                           ## sets to false when mouse was released
  mouseButton*: Event[MouseButtonEvent] ## mouse pressed or released inside this area (doesn't require pressed[] to be true)
  clicked*: Event[ClickEvent] ## mouse pressed and released without movement
  mouseDownAndUpInside*: Event[void] ## mouse button pressed and released inside this area (also if pressed, leaved, re-entered and released)
  scrolled*: Event[Vec2] ## mouse scrolled inside this area
                         ## emits scroll delta (both x and y)
                         ## y > 0 - scroll down (clockwise on default mouse wheel, looking from left side)
                         ## y < 0 - scroll up (anti-clockwise on default mouse wheel, looking from left side)
                         ## x > 0 - scroll right
                         ## x < 0 - scroll left
                         ## scroll delta is usualy -1, 0, or 1
  moved*: Event[MouseMoveEvent] ## mouse moved to position while hovered or pressed(grabbed) over this area
                                ## emits when mouse entered the area, with .hovered[] == true
                                ## does NOT emit when mouse leaved the area
                                ## use `on this.hovered[] == false: ...` to track mouse leaving
                                ## use `on this.hovered[] == true: ...` to track mouse entering
                                ## if mouse leaves the area with .pressed[] == true, this event will still trigger (until mouse button is released)
                                ## event pos is relative to the window,
                                ##   use `posToLocal(this)` to convert it to same coordinates as this.mouseXy, or use mouseXy directly
  cursor*: Property[ref Cursor] ## cursor for mouse when inside this area
                                ## if nil, this mouse area will not affect mouse cursor in any way
  allowEventFallthrough*: Property[bool] ## if true, this mouse area will not mark MouseButton window events as handled
  pressedButtons*: set[MouseButton]
  pressWindowPos*: Vec2
Source   Edit  
UiMouseArea {....deprecated: "use MouseArea instead".} = MouseArea
Deprecated: use MouseArea instead
Source   Edit  

Procs

proc firstHandHandler_MouseArea_cursor(env {.inject.}: pointer) {.nimcall,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc firstHandHandler_MouseArea_globalX(env {.inject.}: pointer) {.nimcall,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc firstHandHandler_MouseArea_globalY(env {.inject.}: pointer) {.nimcall,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc firstHandHandler_MouseArea_hovered(env {.inject.}: pointer) {.nimcall,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc firstHandHandler_MouseArea_visibility(env {.inject.}: pointer) {.nimcall,
    ...raises: [Exception], tags: [RootEffect], forbids: [].}
Source   Edit  
proc mouseXy(this: MouseArea): CustomProperty[Vec2] {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc newMouseArea(): MouseArea {....raises: [], tags: [], forbids: [].}
Source   Edit  

Methods

method connectFirstHandHandlers(this`gensym16: MouseArea) {....raises: [],
    tags: [], forbids: [].}
Source   Edit  
method deteach(this`gensym15: MouseArea) {....raises: [Exception],
    tags: [RootEffect], forbids: [].}
Source   Edit  
method recieve(this: MouseArea; signal: Signal) {....raises: [Exception],
    tags: [RootEffect], forbids: [].}
Source   Edit  
method shouldAutoredraw(this`gensym17: MouseArea): bool {....raises: [], tags: [],
    forbids: [].}
Source   Edit