PageRenderTime 27ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/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
  1I;21;Foundation/CPObject.jc;11045;
  2CPLeftMouseDown = 1;
  3CPLeftMouseUp = 2;
  4CPRightMouseDown = 3;
  5CPRightMouseUp = 4;
  6CPMouseMoved = 5;
  7CPLeftMouseDragged = 6;
  8CPRightMouseDragged = 7;
  9CPMouseEntered = 8;
 10CPMouseExited = 9;
 11CPKeyDown = 10;
 12CPKeyUp = 11;
 13CPFlagsChanged = 12;
 14CPAppKitDefined = 13;
 15CPSystemDefined = 14;
 16CPApplicationDefined = 15;
 17CPPeriodic = 16;
 18CPCursorUpdate = 17;
 19CPScrollWheel = 22;
 20CPOtherMouseDown = 25;
 21CPOtherMouseUp = 26;
 22CPOtherMouseDragged = 27;
 23CPTouchStart = 28;
 24CPTouchMove = 29;
 25CPTouchEnd = 30;
 26CPTouchCancel = 31;
 27CPAlphaShiftKeyMask = 1 << 16;
 28CPShiftKeyMask = 1 << 17;
 29CPControlKeyMask = 1 << 18;
 30CPAlternateKeyMask = 1 << 19;
 31CPCommandKeyMask = 1 << 20;
 32CPNumericPadKeyMask = 1 << 21;
 33CPHelpKeyMask = 1 << 22;
 34CPFunctionKeyMask = 1 << 23;
 35CPDeviceIndependentModifierFlagsMask = 0xffff0000;
 36CPLeftMouseDownMask = 1 << CPLeftMouseDown;
 37CPLeftMouseUpMask = 1 << CPLeftMouseUp;
 38CPRightMouseDownMask = 1 << CPRightMouseDown;
 39CPRightMouseUpMask = 1 << CPRightMouseUp;
 40CPOtherMouseDownMask = 1 << CPOtherMouseDown;
 41CPOtherMouseUpMask = 1 << CPOtherMouseUp;
 42CPMouseMovedMask = 1 << CPMouseMoved;
 43CPLeftMouseDraggedMask = 1 << CPLeftMouseDragged;
 44CPRightMouseDraggedMask = 1 << CPRightMouseDragged;
 45CPOtherMouseDragged = 1 << CPOtherMouseDragged;
 46CPMouseEnteredMask = 1 << CPMouseEntered;
 47CPMouseExitedMask = 1 << CPMouseExited;
 48CPCursorUpdateMask = 1 << CPCursorUpdate;
 49CPKeyDownMask = 1 << CPKeyDown;
 50CPKeyUpMask = 1 << CPKeyUp;
 51CPFlagsChangedMask = 1 << CPFlagsChanged;
 52CPAppKitDefinedMask = 1 << CPAppKitDefined;
 53CPSystemDefinedMask = 1 << CPSystemDefined;
 54CPApplicationDefinedMask = 1 << CPApplicationDefined;
 55CPPeriodicMask = 1 << CPPeriodic;
 56CPScrollWheelMask = 1 << CPScrollWheel;
 57CPAnyEventMask = 0xffffffff;
 58CPDOMEventDoubleClick = "dblclick",
 59CPDOMEventMouseDown = "mousedown",
 60CPDOMEventMouseUp = "mouseup",
 61CPDOMEventMouseMoved = "mousemove",
 62CPDOMEventMouseDragged = "mousedrag",
 63CPDOMEventKeyUp = "keyup",
 64CPDOMEventKeyDown = "keydown",
 65CPDOMEventKeyPress = "keypress";
 66CPDOMEventCopy = "copy";
 67CPDOMEventPaste = "paste";
 68CPDOMEventScrollWheel = "mousewheel";
 69CPDOMEventTouchStart = "touchstart";
 70CPDOMEventTouchMove = "touchmove";
 71CPDOMEventTouchEnd = "touchend";
 72CPDOMEventTouchCancel = "touchcancel";
 73var _CPEventPeriodicEventPeriod = 0,
 74    _CPEventPeriodicEventTimer = nil;
 75{var the_class = objj_allocateClassPair(CPObject, "CPEvent"),
 76meta_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")]);
 77objj_registerClassPair(the_class);
 78objj_addClassForBundle(the_class, objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
 79class_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})]);
219class_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}
254