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
                           ## emits start position (relative to screen)
                           ## 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
  cursor*: Property[ref Cursor] ## cursor for mouse when inside this area
  allowEventFallthrough*: Property[bool] ## if true, this mouse area will not mark MouseButton window events as handled
  pressedButtons*: set[MouseButton]
  pressWindowPos*: Vec2
Source   Edit  

Procs

proc firstHandHandler_hook(this: MouseArea; name: static string;
                           origType: typedesc)
Source   Edit  
proc firstHandHandler_hook_redraw(thisT: typedesc[MouseArea];
                                  name: static string): bool
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: MouseArea) {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
method deteach(this: MouseArea) {....raises: [Exception], tags: [RootEffect],
                                  forbids: [].}
Source   Edit  
method recieve(this: MouseArea; signal: Signal) {....raises: [Exception],
    tags: [RootEffect], forbids: [].}
Source   Edit