summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/cocoaint/src/appkit/NSEvent.inc
blob: 598e1499965c53948c1569bb2d8bc0a4e0e138f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
{ Parsed from Appkit.framework NSEvent.h }

{$ifdef TYPES}
{$ifndef NSEVENT_PAS_T}
{$define NSEVENT_PAS_T}

{ Constants }

const
  NSLeftMouseDown = 1;
  NSLeftMouseUp = 2;
  NSRightMouseDown = 3;
  NSRightMouseUp = 4;
  NSMouseMoved = 5;
  NSLeftMouseDragged = 6;
  NSRightMouseDragged = 7;
  NSMouseEntered = 8;
  NSMouseExited = 9;
  NSKeyDown = 10;
  NSKeyUp = 11;
  NSFlagsChanged = 12;
  NSAppKitDefined = 13;
  NSSystemDefined = 14;
  NSApplicationDefined = 15;
  NSPeriodic = 16;
  NSCursorUpdate = 17;
  NSScrollWheel = 22;
  NSTabletPoint = 23;
  NSTabletProximity = 24;
  NSOtherMouseDown = 25;
  NSOtherMouseUp = 26;
  NSOtherMouseDragged = 27;
  NSEventTypeGesture = 29;
  NSEventTypeMagnify = 30;
  NSEventTypeSwipe = 31;
  NSEventTypeRotate = 18;
  NSEventTypeBeginGesture = 19;
  NSEventTypeEndGesture = 20;

const
  NSLeftMouseDownMask = 1 shl NSLeftMouseDown;
  NSLeftMouseUpMask = 1 shl NSLeftMouseUp;
  NSRightMouseDownMask = 1 shl NSRightMouseDown;
  NSRightMouseUpMask = 1 shl NSRightMouseUp;
  NSMouseMovedMask = 1 shl NSMouseMoved;
  NSLeftMouseDraggedMask = 1 shl NSLeftMouseDragged;
  NSRightMouseDraggedMask = 1 shl NSRightMouseDragged;
  NSMouseEnteredMask = 1 shl NSMouseEntered;
  NSMouseExitedMask = 1 shl NSMouseExited;
  NSKeyDownMask = 1 shl NSKeyDown;
  NSKeyUpMask = 1 shl NSKeyUp;
  NSFlagsChangedMask = 1 shl NSFlagsChanged;
  NSAppKitDefinedMask = 1 shl NSAppKitDefined;
  NSSystemDefinedMask = 1 shl NSSystemDefined;
  NSApplicationDefinedMask = 1 shl NSApplicationDefined;
  NSPeriodicMask = 1 shl NSPeriodic;
  NSCursorUpdateMask = 1 shl NSCursorUpdate;
  NSScrollWheelMask = 1 shl NSScrollWheel;
  NSTabletPointMask = 1 shl NSTabletPoint;
  NSTabletProximityMask = 1 shl NSTabletProximity;
  NSOtherMouseDownMask = 1 shl NSOtherMouseDown;
  NSOtherMouseUpMask = 1 shl NSOtherMouseUp;
  NSOtherMouseDraggedMask = 1 shl NSOtherMouseDragged;
  NSEventMaskGesture = 1 shl NSEventTypeGesture;
  NSEventMaskMagnify = 1 shl NSEventTypeMagnify;
  NSEventMaskSwipe = 1 shl NSEventTypeSwipe;
  NSEventMaskRotate = 1 shl NSEventTypeRotate;
  NSEventMaskBeginGesture = 1 shl NSEventTypeBeginGesture;
  NSEventMaskEndGesture = 1 shl NSEventTypeEndGesture;
  NSAnyEventMask = NSUIntegerMax;

const
  NSAlphaShiftKeyMask = 1 shl 16;
  NSShiftKeyMask = 1 shl 17;
  NSControlKeyMask = 1 shl 18;
  NSAlternateKeyMask = 1 shl 19;
  NSCommandKeyMask = 1 shl 20;
  NSNumericPadKeyMask = 1 shl 21;
  NSHelpKeyMask = 1 shl 22;
  NSFunctionKeyMask = 1 shl 23;
  NSDeviceIndependentModifierFlagsMask = $ffff0000;

const
  NSUnknownPointingDevice = NX_TABLET_POINTER_UNKNOWN;
  NSPenPointingDevice = NX_TABLET_POINTER_PEN;
  NSCursorPointingDevice = NX_TABLET_POINTER_CURSOR;
  NSEraserPointingDevice = NX_TABLET_POINTER_ERASER;

const
  NSPenTipMask = NX_TABLET_BUTTON_PENTIPMASK;
  NSPenLowerSideMask = NX_TABLET_BUTTON_PENLOWERSIDEMASK;
  NSPenUpperSideMask = NX_TABLET_BUTTON_PENUPPERSIDEMASK;

const
  NSUpArrowFunctionKey = $F700;
  NSDownArrowFunctionKey = $F701;
  NSLeftArrowFunctionKey = $F702;
  NSRightArrowFunctionKey = $F703;
  NSF1FunctionKey = $F704;
  NSF2FunctionKey = $F705;
  NSF3FunctionKey = $F706;
  NSF4FunctionKey = $F707;
  NSF5FunctionKey = $F708;
  NSF6FunctionKey = $F709;
  NSF7FunctionKey = $F70A;
  NSF8FunctionKey = $F70B;
  NSF9FunctionKey = $F70C;
  NSF10FunctionKey = $F70D;
  NSF11FunctionKey = $F70E;
  NSF12FunctionKey = $F70F;
  NSF13FunctionKey = $F710;
  NSF14FunctionKey = $F711;
  NSF15FunctionKey = $F712;
  NSF16FunctionKey = $F713;
  NSF17FunctionKey = $F714;
  NSF18FunctionKey = $F715;
  NSF19FunctionKey = $F716;
  NSF20FunctionKey = $F717;
  NSF21FunctionKey = $F718;
  NSF22FunctionKey = $F719;
  NSF23FunctionKey = $F71A;
  NSF24FunctionKey = $F71B;
  NSF25FunctionKey = $F71C;
  NSF26FunctionKey = $F71D;
  NSF27FunctionKey = $F71E;
  NSF28FunctionKey = $F71F;
  NSF29FunctionKey = $F720;
  NSF30FunctionKey = $F721;
  NSF31FunctionKey = $F722;
  NSF32FunctionKey = $F723;
  NSF33FunctionKey = $F724;
  NSF34FunctionKey = $F725;
  NSF35FunctionKey = $F726;
  NSInsertFunctionKey = $F727;
  NSDeleteFunctionKey = $F728;
  NSHomeFunctionKey = $F729;
  NSBeginFunctionKey = $F72A;
  NSEndFunctionKey = $F72B;
  NSPageUpFunctionKey = $F72C;
  NSPageDownFunctionKey = $F72D;
  NSPrintScreenFunctionKey = $F72E;
  NSScrollLockFunctionKey = $F72F;
  NSPauseFunctionKey = $F730;
  NSSysReqFunctionKey = $F731;
  NSBreakFunctionKey = $F732;
  NSResetFunctionKey = $F733;
  NSStopFunctionKey = $F734;
  NSMenuFunctionKey = $F735;
  NSUserFunctionKey = $F736;
  NSSystemFunctionKey = $F737;
  NSPrintFunctionKey = $F738;
  NSClearLineFunctionKey = $F739;
  NSClearDisplayFunctionKey = $F73A;
  NSInsertLineFunctionKey = $F73B;
  NSDeleteLineFunctionKey = $F73C;
  NSInsertCharFunctionKey = $F73D;
  NSDeleteCharFunctionKey = $F73E;
  NSPrevFunctionKey = $F73F;
  NSNextFunctionKey = $F740;
  NSSelectFunctionKey = $F741;
  NSExecuteFunctionKey = $F742;
  NSUndoFunctionKey = $F743;
  NSRedoFunctionKey = $F744;
  NSFindFunctionKey = $F745;
  NSHelpFunctionKey = $F746;
  NSModeSwitchFunctionKey = $F747;

const
  NSWindowExposedEventType = 0;
  NSApplicationActivatedEventType = 1;
  NSApplicationDeactivatedEventType = 2;
  NSWindowMovedEventType = 4;
  NSScreenChangedEventType = 8;
  NSAWTEventType = 16;

const
  NSPowerOffEventType = 1;

const
  NSMouseEventSubtype = NX_SUBTYPE_DEFAULT;
  NSTabletPointEventSubtype = NX_SUBTYPE_TABLET_POINT;
  NSTabletProximityEventSubtype = NX_SUBTYPE_TABLET_PROXIMITY;
  NSTouchEventSubtype = NX_SUBTYPE_MOUSE_TOUCH;

{ Types }
type
  NSEventType = NSUInteger;
  NSEventTypePtr = ^NSEventType;
  NSPointingDeviceType = NSUInteger;
  NSPointingDeviceTypePtr = ^NSPointingDeviceType;

{$endif}
{$endif}

{$ifdef RECORDS}
{$ifndef NSEVENT_PAS_R}
{$define NSEVENT_PAS_R}

{$endif}
{$endif}

{$ifdef FUNCTIONS}
{$ifndef NSEVENT_PAS_F}
{$define NSEVENT_PAS_F}

{$endif}
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
{$ifndef NSEVENT_PAS_S}
{$define NSEVENT_PAS_S}

{$endif}
{$endif}

{$ifdef FORWARD}
  NSEvent = objcclass;
  NSEventPointer = ^NSEvent;
  NSEventPtr = NSEventPointer;

{$endif}

{$ifdef CLASSES}
{$ifndef NSEVENT_PAS_C}
{$define NSEVENT_PAS_C}

{ NSEvent }
  NSEvent = objcclass external (NSObject, NSCopyingProtocol, NSCodingProtocol)
  private
    _type: NSEventType;
    _location: NSPoint;
    _modifierFlags: cuint;
    _WSTimestamp: id;
    _timestamp: NSTimeInterval;
    _windowNumber: NSInteger;
    _window: NSWindow;
    _context: NSGraphicsContext;
    _data: record
      case byte of
        1: (
    _mouse: record
        _eventNumber: cint;
        _clickCount: cint;
        _pressure: single;
        {$ifdef cpu64}
        _deltaX: CGFloat;
        _deltaY: CGFloat;
        _subtype: cint;
        _buttonNumber: cshort;
        reserved1: cshort;
        reserved2: array[0..(3)-1] of cint;
        {$endif}
      end;
           );
        2: (
    _key: record
        keys: NSString;
        unmodKeys: NSString;
        _keyCode: cushort;
        _isARepeat: Boolean;
        {$ifdef cpu64}
        eventFlags: cint;
        reserved: array[0..(5)-1] of cint;
        {$endif}
      end;
           );
        3: (
    _tracking: record
        _eventNumber: cint;
        _trackingNumber: NSInteger;
        _userData: Pointer;
        {$ifdef cpu64}
        reserved: array[0..(6)-1] of cint;
        {$endif}
      end;
           );
        4: (
    _scrollWheel: record
        _deltaX: CGFloat;
        _deltaY: CGFloat;
        _deltaZ: CGFloat;
        {$ifdef cpu64}
        _subtype: cshort;
        reserved1: cshort;
        reserved2: array[0..(6)-1] of cint;
        {$endif}
      end;
           );
        5: (
    _axisGesture: record
        _deltaX: CGFloat;
        _deltaY: CGFloat;
        _deltaZ: CGFloat;
        {$ifdef cpu64}
        reserved: array[0..(7)-1] of cint;
        {$endif}
      end;
           );
        6: (
    _miscGesture: record
        _subtype: cshort;
        gestureEnded: Boolean;
        reserved: Boolean;
        value: cint;
        percentage: single;
        {$ifdef cpu64}
        reserved2: array[0..(7)-1] of cint;
        {$endif}
      end;
          );
       7: (
    _misc: record
        _subtype: cint;
        _data1: NSInteger;
        _data2: NSInteger;
        {$ifdef cpu64}
        reserved: array[0..(6)-1] of cint;
        {$endif}
      end;
          );
    {$ifdef cpu64}
       8: (
    tabletPointData: array[0..(14)-1] of cint;
          );
       9: (
    tabletProximityData: array[0..(14)-1] of cint;
          );
    {$endif}
    end;
    _eventRef: Pointer;
    {$ifdef cpu64}
    reserved1: Pointer;
    reserved2: Pointer;
    {$endif}
    
  public
    function type_: NSEventType; message 'type';
    function modifierFlags: NSUInteger; message 'modifierFlags';
    function timestamp: NSTimeInterval; message 'timestamp';
    function window: NSWindow; message 'window';
    function windowNumber: NSInteger; message 'windowNumber';
    function context: NSGraphicsContext; message 'context';
    function clickCount: NSInteger; message 'clickCount';
    function buttonNumber: NSInteger; message 'buttonNumber';
    function eventNumber: NSInteger; message 'eventNumber';
    function pressure: single; message 'pressure';
    function locationInWindow: NSPoint; message 'locationInWindow';
    function deltaX: CGFloat; message 'deltaX';
    function deltaY: CGFloat; message 'deltaY';
    function deltaZ: CGFloat; message 'deltaZ';
    function characters: NSString; message 'characters';
    function charactersIgnoringModifiers: NSString; message 'charactersIgnoringModifiers';
    function isARepeat: Boolean; message 'isARepeat';
    function keyCode: cushort; message 'keyCode';
    function trackingNumber: NSInteger; message 'trackingNumber';
    function userData: Pointer; message 'userData';
    function trackingArea: NSTrackingArea; message 'trackingArea';
    function subtype: cshort; message 'subtype';
    function data1: NSInteger; message 'data1';
    function data2: NSInteger; message 'data2';
    function eventRef: Pointer; message 'eventRef';
    class function eventWithEventRef(eventRef_: Pointer): NSEvent; message 'eventWithEventRef:';
    function CGEvent: CGEventRef; message 'CGEvent';
    class function eventWithCGEvent(cgEvent_: CGEventRef): NSEvent; message 'eventWithCGEvent:';
    class procedure setMouseCoalescingEnabled(flag: Boolean); message 'setMouseCoalescingEnabled:';
    class function isMouseCoalescingEnabled: Boolean; message 'isMouseCoalescingEnabled';
    function magnification: CGFloat; message 'magnification';
    function deviceID: NSUInteger; message 'deviceID';
    function rotation: single; message 'rotation';
    function absoluteX: NSInteger; message 'absoluteX';
    function absoluteY: NSInteger; message 'absoluteY';
    function absoluteZ: NSInteger; message 'absoluteZ';
    function buttonMask: NSUInteger; message 'buttonMask';
    function tilt: NSPoint; message 'tilt';
    function tangentialPressure: single; message 'tangentialPressure';
    function vendorDefined: id; message 'vendorDefined';
    function vendorID: NSUInteger; message 'vendorID';
    function tabletID: NSUInteger; message 'tabletID';
    function pointingDeviceID: NSUInteger; message 'pointingDeviceID';
    function systemTabletID: NSUInteger; message 'systemTabletID';
    function vendorPointingDeviceType: NSUInteger; message 'vendorPointingDeviceType';
    function pointingDeviceSerialNumber: NSUInteger; message 'pointingDeviceSerialNumber';
    function uniqueID: culonglong; message 'uniqueID';
    function capabilityMask: NSUInteger; message 'capabilityMask';
    function pointingDeviceType: NSPointingDeviceType; message 'pointingDeviceType';
    function isEnteringProximity: Boolean; message 'isEnteringProximity';
    function touchesMatchingPhase_inView(phase: NSTouchPhase; view: NSView): NSSet; message 'touchesMatchingPhase:inView:';
    class procedure startPeriodicEventsAfterDelay_withPeriod(delay: NSTimeInterval; period: NSTimeInterval); message 'startPeriodicEventsAfterDelay:withPeriod:';
    class procedure stopPeriodicEvents; message 'stopPeriodicEvents';
    class function mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure(type__: NSEventType; location: NSPoint; flags: NSUInteger; time: NSTimeInterval; wNum: NSInteger; context_: NSGraphicsContext; eNum: NSInteger; cNum: NSInteger; pressure_: single): NSEvent; message 'mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:';
    class function keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode(type__: NSEventType; location: NSPoint; flags: NSUInteger; time: NSTimeInterval; wNum: NSInteger; context_: NSGraphicsContext; keys: NSString; ukeys: NSString; flag: Boolean; code: cushort): NSEvent; message 'keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:';
    class function enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData(type__: NSEventType; location: NSPoint; flags: NSUInteger; time: NSTimeInterval; wNum: NSInteger; context_: NSGraphicsContext; eNum: NSInteger; tNum: NSInteger; data: Pointer): NSEvent; message 'enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:';
    class function otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(type__: NSEventType; location: NSPoint; flags: NSUInteger; time: NSTimeInterval; wNum: NSInteger; context_: NSGraphicsContext; subtype_: cshort; d: NSInteger; d1: NSInteger): NSEvent; message 'otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:';
    class function mouseLocation: NSPoint; message 'mouseLocation';
    class function pressedMouseButtons: NSUInteger; message 'pressedMouseButtons';
    class function doubleClickInterval: NSTimeInterval; message 'doubleClickInterval';
    class function keyRepeatDelay: NSTimeInterval; message 'keyRepeatDelay';
    class function keyRepeatInterval: NSTimeInterval; message 'keyRepeatInterval';

    { Adopted Protocols }
    function copyWithZone(zone_: NSZonePtr): id;
    procedure encodeWithCoder(aCoder: NSCoder);
    function initWithCoder(aDecoder: NSCoder): id;
  end;

{$endif}
{$endif}