Guest User

Untitled

a guest
Jan 18th, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. type
  2.   TEventKind = enum
  3.     nothing,
  4.     resize,
  5.     command,
  6.     mouse,
  7.     systemMouse,
  8.     key,
  9.     keyRepeat,
  10.     lostFocus,
  11.     getFocus,
  12.     tick
  13.  
  14.   PEvent = ref TEvent
  15.   TEvent = object
  16.     case kind: TEventKind
  17.     of nothing: nil
  18.     of resize: nil
  19.     of command:
  20.       data: ref object
  21.       cmd: int
  22.     of mouse:
  23.       localMouseX, localMouseY: int
  24.       doubleClick: bool
  25.     of systemMouse:
  26.       mouseX, mouseY: int
  27.     of key:
  28.       ch: char
  29.       key: int
  30.       modifier: int
  31.     of keyRepeat: nil
  32.     of lostFocus: nil
  33.     of getFocus: nil
  34.     of tick: nil
  35.  
  36. method setProcessed(self: PEvent) = nil
  37. #self.kind = TEventKind.nothing
  38.  
  39.  
  40. when isMainModule:
  41.   import unittest
  42.  
  43.   test "eventsetProcessed":
  44.     #let event = TEvent(kind: TEventKind.mouse)
  45.     #event.setProcessed()
  46.     #check(event.kind == TEventKind.nothing)
Advertisement
Add Comment
Please, Sign In to add comment