/Frameworks/Debug/AppKit/rhino.platform/CPEvent.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 254 lines · 253 code · 1 blank · 0 comment · 0 complexity · 5afcefe7ab847c9d8a2f794760e3b5c0 MD5 · raw file

  1. I;21;Foundation/CPObject.jc;11045;
  2. CPLeftMouseDown = 1;
  3. CPLeftMouseUp = 2;
  4. CPRightMouseDown = 3;
  5. CPRightMouseUp = 4;
  6. CPMouseMoved = 5;
  7. CPLeftMouseDragged = 6;
  8. CPRightMouseDragged = 7;
  9. CPMouseEntered = 8;
  10. CPMouseExited = 9;
  11. CPKeyDown = 10;
  12. CPKeyUp = 11;
  13. CPFlagsChanged = 12;
  14. CPAppKitDefined = 13;
  15. CPSystemDefined = 14;
  16. CPApplicationDefined = 15;
  17. CPPeriodic = 16;
  18. CPCursorUpdate = 17;
  19. CPScrollWheel = 22;
  20. CPOtherMouseDown = 25;
  21. CPOtherMouseUp = 26;
  22. CPOtherMouseDragged = 27;
  23. CPTouchStart = 28;
  24. CPTouchMove = 29;
  25. CPTouchEnd = 30;
  26. CPTouchCancel = 31;
  27. CPAlphaShiftKeyMask = 1 << 16;
  28. CPShiftKeyMask = 1 << 17;
  29. CPControlKeyMask = 1 << 18;
  30. CPAlternateKeyMask = 1 << 19;
  31. CPCommandKeyMask = 1 << 20;
  32. CPNumericPadKeyMask = 1 << 21;
  33. CPHelpKeyMask = 1 << 22;
  34. CPFunctionKeyMask = 1 << 23;
  35. CPDeviceIndependentModifierFlagsMask = 0xffff0000;
  36. CPLeftMouseDownMask = 1 << CPLeftMouseDown;
  37. CPLeftMouseUpMask = 1 << CPLeftMouseUp;
  38. CPRightMouseDownMask = 1 << CPRightMouseDown;
  39. CPRightMouseUpMask = 1 << CPRightMouseUp;
  40. CPOtherMouseDownMask = 1 << CPOtherMouseDown;
  41. CPOtherMouseUpMask = 1 << CPOtherMouseUp;
  42. CPMouseMovedMask = 1 << CPMouseMoved;
  43. CPLeftMouseDraggedMask = 1 << CPLeftMouseDragged;
  44. CPRightMouseDraggedMask = 1 << CPRightMouseDragged;
  45. CPOtherMouseDragged = 1 << CPOtherMouseDragged;
  46. CPMouseEnteredMask = 1 << CPMouseEntered;
  47. CPMouseExitedMask = 1 << CPMouseExited;
  48. CPCursorUpdateMask = 1 << CPCursorUpdate;
  49. CPKeyDownMask = 1 << CPKeyDown;
  50. CPKeyUpMask = 1 << CPKeyUp;
  51. CPFlagsChangedMask = 1 << CPFlagsChanged;
  52. CPAppKitDefinedMask = 1 << CPAppKitDefined;
  53. CPSystemDefinedMask = 1 << CPSystemDefined;
  54. CPApplicationDefinedMask = 1 << CPApplicationDefined;
  55. CPPeriodicMask = 1 << CPPeriodic;
  56. CPScrollWheelMask = 1 << CPScrollWheel;
  57. CPAnyEventMask = 0xffffffff;
  58. CPDOMEventDoubleClick = "dblclick",
  59. CPDOMEventMouseDown = "mousedown",
  60. CPDOMEventMouseUp = "mouseup",
  61. CPDOMEventMouseMoved = "mousemove",
  62. CPDOMEventMouseDragged = "mousedrag",
  63. CPDOMEventKeyUp = "keyup",
  64. CPDOMEventKeyDown = "keydown",
  65. CPDOMEventKeyPress = "keypress";
  66. CPDOMEventCopy = "copy";
  67. CPDOMEventPaste = "paste";
  68. CPDOMEventScrollWheel = "mousewheel";
  69. CPDOMEventTouchStart = "touchstart";
  70. CPDOMEventTouchMove = "touchmove";
  71. CPDOMEventTouchEnd = "touchend";
  72. CPDOMEventTouchCancel = "touchcancel";
  73. var _CPEventPeriodicEventPeriod = 0,
  74. _CPEventPeriodicEventTimer = nil;
  75. {var the_class = objj_allocateClassPair(CPObject, "CPEvent"),
  76. meta_class = the_class.isa;class_addIvars(the_class, [new objj_ivar("_type"), new objj_ivar("_location"), new objj_ivar("_modifierFlags"), new objj_ivar("_timestamp"), new objj_ivar("_context"), new objj_ivar("_eventNumber"), new objj_ivar("_clickCount"), new objj_ivar("_pressure"), new objj_ivar("_window"), new objj_ivar("_characters"), new objj_ivar("_isARepeat"), new objj_ivar("_keyCode"), new objj_ivar("_DOMEvent"), new objj_ivar("_deltaX"), new objj_ivar("_deltaY"), new objj_ivar("_deltaZ")]);
  77. objj_registerClassPair(the_class);
  78. objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  79. class_addMethods(the_class, [new objj_method(sel_getUid("_initMouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:"), function $CPEvent___initMouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_(self, _cmd, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, anEventNumber, aClickCount, aPressure)
  80. { with(self)
  81. {
  82. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
  83. if (self)
  84. {
  85. _type = anEventType;
  86. _location = CPPointCreateCopy(aPoint);
  87. _modifierFlags = modifierFlags;
  88. _timestamp = aTimestamp;
  89. _context = aGraphicsContext;
  90. _eventNumber = anEventNumber;
  91. _clickCount = aClickCount;
  92. _pressure = aPressure;
  93. _window = objj_msgSend(CPApp, "windowWithWindowNumber:", aWindowNumber);
  94. }
  95. return self;
  96. }
  97. }), new objj_method(sel_getUid("_initKeyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:"), function $CPEvent___initKeyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_(self, _cmd, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, characters, unmodCharacters, isARepeat, code)
  98. { with(self)
  99. {
  100. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
  101. if (self)
  102. {
  103. _type = anEventType;
  104. _location = CPPointCreateCopy(aPoint);
  105. _modifierFlags = modifierFlags;
  106. _timestamp = aTimestamp;
  107. _context = aGraphicsContext;
  108. _characters = characters;
  109. _charactersIgnoringModifiers = unmodCharacters;
  110. _isARepeat = isARepeat;
  111. _keyCode = code;
  112. _window = objj_msgSend(CPApp, "windowWithWindowNumber:", aWindowNumber);
  113. }
  114. return self;
  115. }
  116. }), new objj_method(sel_getUid("_initOtherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:"), function $CPEvent___initOtherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(self, _cmd, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, aSubtype, aData1, aData2)
  117. { with(self)
  118. {
  119. self = objj_msgSendSuper({ receiver:self, super_class:objj_getClass("CPObject") }, "init");
  120. if (self)
  121. {
  122. _type = anEventType;
  123. _location = CPPointCreateCopy(aPoint);
  124. _modifierFlags = modifierFlags;
  125. _timestamp = aTimestamp;
  126. _context = aGraphicsContext;
  127. _subtype = aSubtype;
  128. _data1 = aData1;
  129. _data2 = aData2;
  130. }
  131. return self;
  132. }
  133. }), new objj_method(sel_getUid("locationInWindow"), function $CPEvent__locationInWindow(self, _cmd)
  134. { with(self)
  135. {
  136. return _location;
  137. }
  138. }), new objj_method(sel_getUid("modifierFlags"), function $CPEvent__modifierFlags(self, _cmd)
  139. { with(self)
  140. {
  141. return _modifierFlags;
  142. }
  143. }), new objj_method(sel_getUid("timestamp"), function $CPEvent__timestamp(self, _cmd)
  144. { with(self)
  145. {
  146. return _timestamp;
  147. }
  148. }), new objj_method(sel_getUid("type"), function $CPEvent__type(self, _cmd)
  149. { with(self)
  150. {
  151. return _type;
  152. }
  153. }), new objj_method(sel_getUid("window"), function $CPEvent__window(self, _cmd)
  154. { with(self)
  155. {
  156. return _window;
  157. }
  158. }), new objj_method(sel_getUid("windowNumber"), function $CPEvent__windowNumber(self, _cmd)
  159. { with(self)
  160. {
  161. return _windowNumber;
  162. }
  163. }), new objj_method(sel_getUid("buttonNumber"), function $CPEvent__buttonNumber(self, _cmd)
  164. { with(self)
  165. {
  166. return _buttonNumber;
  167. }
  168. }), new objj_method(sel_getUid("clickCount"), function $CPEvent__clickCount(self, _cmd)
  169. { with(self)
  170. {
  171. return _clickCount;
  172. }
  173. }), new objj_method(sel_getUid("characters"), function $CPEvent__characters(self, _cmd)
  174. { with(self)
  175. {
  176. return _characters;
  177. }
  178. }), new objj_method(sel_getUid("charactersIgnoringModifiers"), function $CPEvent__charactersIgnoringModifiers(self, _cmd)
  179. { with(self)
  180. {
  181. return _charactersIgnoringModifiers;
  182. }
  183. }), new objj_method(sel_getUid("isARepeat"), function $CPEvent__isARepeat(self, _cmd)
  184. { with(self)
  185. {
  186. return _isARepeat;
  187. }
  188. }), new objj_method(sel_getUid("keyCode"), function $CPEvent__keyCode(self, _cmd)
  189. { with(self)
  190. {
  191. return _keyCode;
  192. }
  193. }), new objj_method(sel_getUid("pressure"), function $CPEvent__pressure(self, _cmd)
  194. { with(self)
  195. {
  196. return _pressure;
  197. }
  198. }), new objj_method(sel_getUid("_DOMEvent"), function $CPEvent___DOMEvent(self, _cmd)
  199. { with(self)
  200. {
  201. return _DOMEvent;
  202. }
  203. }), new objj_method(sel_getUid("deltaX"), function $CPEvent__deltaX(self, _cmd)
  204. { with(self)
  205. {
  206. return _deltaX;
  207. }
  208. }), new objj_method(sel_getUid("deltaY"), function $CPEvent__deltaY(self, _cmd)
  209. { with(self)
  210. {
  211. return _deltaY;
  212. }
  213. }), new objj_method(sel_getUid("deltaZ"), function $CPEvent__deltaZ(self, _cmd)
  214. { with(self)
  215. {
  216. return _deltaZ;
  217. }
  218. })]);
  219. class_addMethods(meta_class, [new objj_method(sel_getUid("keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:"), function $CPEvent__keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_(self, _cmd, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, characters, unmodCharacters, repeatKey, code)
  220. { with(self)
  221. {
  222. return objj_msgSend(objj_msgSend(self, "alloc"), "_initKeyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:", anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, characters, unmodCharacters, repeatKey, code);
  223. }
  224. }), new objj_method(sel_getUid("mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:"), function $CPEvent__mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_(self, _cmd, anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, anEventNumber, aClickCount, aPressure)
  225. { with(self)
  226. {
  227. return objj_msgSend(objj_msgSend(self, "alloc"), "_initMouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:", anEventType, aPoint, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, anEventNumber, aClickCount, aPressure);
  228. }
  229. }), new objj_method(sel_getUid("otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:"), function $CPEvent__otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(self, _cmd, anEventType, aLocation, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, aSubtype, aData1, aData2)
  230. { with(self)
  231. {
  232. return objj_msgSend(objj_msgSend(self, "alloc"), "_initOtherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:", anEventType, aLocation, modifierFlags, aTimestamp, aWindowNumber, aGraphicsContext, aSubtype, aData1, aData2);
  233. }
  234. }), new objj_method(sel_getUid("startPeriodicEventsAfterDelay:withPeriod:"), function $CPEvent__startPeriodicEventsAfterDelay_withPeriod_(self, _cmd, aDelay, aPeriod)
  235. { with(self)
  236. {
  237. _CPEventPeriodicEventPeriod = aPeriod;
  238. _CPEventPeriodicEventTimer = window.setTimeout(function() { _CPEventPeriodicEventTimer = window.setInterval(_CPEventFirePeriodEvent, aPeriod * 1000.0); }, aDelay * 1000.0);
  239. }
  240. }), new objj_method(sel_getUid("stopPeriodicEvents"), function $CPEvent__stopPeriodicEvents(self, _cmd)
  241. { with(self)
  242. {
  243. if (_CPEventPeriodicEventTimer === nil)
  244. return;
  245. window.clearTimeout(_CPEventPeriodicEventTimer);
  246. _CPEventPeriodicEventTimer = nil;
  247. }
  248. })]);
  249. }
  250. _CPEventFirePeriodEvent= function()
  251. {
  252. objj_msgSend(CPApp, "sendEvent:", objj_msgSend(CPEvent, "otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:", CPPeriodic, { x:0.0, y:0.0 }, 0, 0, 0, nil, 0, 0, 0));
  253. }