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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
|
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software",, to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2005 Novell, Inc.
//
// Authors:
// Geoff Norton <gnorton@customerdna.com>
//
// NOT COMPLETE
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Runtime.InteropServices;
/// Mac OSX Version
namespace System.Windows.Forms {
internal class OSXConstants {
#region EventClass constants
internal const uint kEventClassMouse = 1836021107;
internal const uint kEventClassKeyboard = 1801812322;
internal const uint kEventClassTextInput = 1952807028;
internal const uint kEventClassApplication = 1634758764;
internal const uint kEventClassAppleEvent = 1701867619;
internal const uint kEventClassMenu = 1835363957;
internal const uint kEventClassWindow = 2003398244;
internal const uint kEventClassControl = 1668183148;
internal const uint kEventClassCommand = 1668113523;
internal const uint kEventClassTablet = 1952607348;
internal const uint kEventClassVolume = 1987013664;
internal const uint kEventClassAppearance = 1634758765;
internal const uint kEventClassService = 1936028278;
internal const uint kEventClassToolbar = 1952604530;
internal const uint kEventClassToolbarItem = 1952606580;
internal const uint kEventClassAccessibility = 1633903461;
#endregion
#region kEventClassMouse constants
internal const uint kEventMouseDown = 1;
internal const uint kEventMouseUp = 2;
internal const uint kEventMouseMoved = 5;
internal const uint kEventMouseDragged = 6;
internal const uint kEventMouseEntered = 8;
internal const uint kEventMouseExited = 9;
internal const uint kEventMouseWheelMoved = 10;
#endregion
#region kEventClassKeyboard constants
internal const uint kEventRawKeyDown = 1;
internal const uint kEventRawKeyRepeat = 2;
internal const uint kEventRawKeyUp = 3;
internal const uint kEventRawKeyModifiersChanged = 4;
internal const uint kEventHotKeyPressed = 5;
internal const uint kEventHotKeyReleased = 6;
#endregion
#region kEventClassTextInput constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassApplication constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassAppleEvent constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassMenu constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassWindow constants
internal const uint kEventWindowUpdate = 1;
internal const uint kEventWindowDrawContent = 2;
internal const uint kEventWindowActivated = 5;
internal const uint kEventWindowDeactivated = 6;
internal const uint kEventWindowGetClickActivation = 7;
internal const uint kEventWindowShowing = 22;
internal const uint kEventWindowHiding = 23;
internal const uint kEventWindowShown = 24;
internal const uint kEventWindowHidden = 25;
internal const uint kEventWindowCollapsing = 86;
internal const uint kEventWindowExpanding = 87;
internal const uint kEventWindowZoomed = 76;
internal const uint kEventWindowBoundsChanging = 26;
internal const uint kEventWindowBoundsChanged = 27;
internal const uint kEventWindowResizeStarted = 28;
internal const uint kEventWindowResizeCompleted = 29;
internal const uint kEventWindowDragStarted = 30;
internal const uint kEventWindowDragCompleted = 31;
internal const uint kEventWindowTransitionStarted = 88;
internal const uint kEventWindowTransitionCompleted = 89;
internal const uint kEventWindowClickDragRgn = 32;
internal const uint kEventWindowClickResizeRgn = 33;
internal const uint kEventWindowClickCollapseRgn = 34;
internal const uint kEventWindowClickCloseRgn = 35;
internal const uint kEventWindowClickZoomRgn = 36;
internal const uint kEventWindowClickContentRgn = 37;
internal const uint kEventWindowClickProxyIconRgn = 38;
internal const uint kEventWindowClickToolbarButtonRgn = 41;
internal const uint kEventWindowClickStructureRgn = 42;
internal const uint kEventWindowCursorChange = 40;
internal const uint kEventWindowCollapse = 66;
internal const uint kEventWindowCollapsed = 67;
internal const uint kEventWindowCollapseAll = 68;
internal const uint kEventWindowExpand = 69;
internal const uint kEventWindowExpanded = 70;
internal const uint kEventWindowExpandAll = 71;
internal const uint kEventWindowClose = 72;
internal const uint kEventWindowClosed = 73;
internal const uint kEventWindowCloseAll = 74;
internal const uint kEventWindowZoom = 75;
internal const uint kEventWindowZoomAll = 77;
internal const uint kEventWindowContextualMenuSelect = 78;
internal const uint kEventWindowPathSelect = 79;
internal const uint kEventWindowGetIdealSize = 80;
internal const uint kEventWindowGetMinimumSize = 81;
internal const uint kEventWindowGetMaximumSize = 82;
internal const uint kEventWindowConstrain = 83;
internal const uint kEventWindowHandleContentClick = 85;
internal const uint kEventWindowGetDockTileMenu = 90;
internal const uint kEventWindowHandleActivate = 91;
internal const uint kEventWindowHandleDeactivate = 92;
internal const uint kEventWindowProxyBeginDrag = 128;
internal const uint kEventWindowProxyEndDrag = 129;
internal const uint kEventWindowToolbarSwitchMode = 150;
internal const uint kEventWindowFocusAcquired = 200;
internal const uint kEventWindowFocusRelinquish = 201;
internal const uint kEventWindowFocusContent = 202;
internal const uint kEventWindowFocusToolbar = 203;
internal const uint kEventWindowDrawerOpening = 220;
internal const uint kEventWindowDrawerOpened = 221;
internal const uint kEventWindowDrawerClosing = 222;
internal const uint kEventWindowDrawerClosed = 223;
internal const uint kEventWindowDrawFrame = 1000;
internal const uint kEventWindowDrawPart = 1001;
internal const uint kEventWindowGetRegion = 1002;
internal const uint kEventWindowHitTest = 1003;
internal const uint kEventWindowInit = 1004;
internal const uint kEventWindowDispose = 1005;
internal const uint kEventWindowDragHilite = 1006;
internal const uint kEventWindowModified = 1007;
internal const uint kEventWindowSetupProxyDragImage = 1008;
internal const uint kEventWindowStateChanged = 1009;
internal const uint kEventWindowMeasureTitle = 1010;
internal const uint kEventWindowDrawGrowBox = 1011;
internal const uint kEventWindowGetGrowImageRegion = 1012;
internal const uint kEventWindowPaint = 1013;
#endregion
#region kEventClassControl constants
internal const uint kEventControlInitialize = 1000;
internal const uint kEventControlDispose = 1001;
internal const uint kEventControlGetOptimalBounds = 1003;
internal const uint kEventControlDefInitialize = kEventControlInitialize;
internal const uint kEventControlDefDispose = kEventControlDispose;
internal const uint kEventControlHit = 1;
internal const uint kEventControlSimulateHit = 2;
internal const uint kEventControlHitTest = 3;
internal const uint kEventControlDraw = 4;
internal const uint kEventControlApplyBackground = 5;
internal const uint kEventControlApplyTextColor = 6;
internal const uint kEventControlSetFocusPart = 7;
internal const uint kEventControlGetFocusPart = 8;
internal const uint kEventControlActivate = 9;
internal const uint kEventControlDeactivate = 10;
internal const uint kEventControlSetCursor = 11;
internal const uint kEventControlContextualMenuClick = 12;
internal const uint kEventControlClick = 13;
internal const uint kEventControlGetNextFocusCandidate = 14;
internal const uint kEventControlGetAutoToggleValue = 15;
internal const uint kEventControlInterceptSubviewClick = 16;
internal const uint kEventControlGetClickActivation = 17;
internal const uint kEventControlDragEnter = 18;
internal const uint kEventControlDragWithin = 19;
internal const uint kEventControlDragLeave = 20;
internal const uint kEventControlDragReceive = 21;
internal const uint kEventControlInvalidateForSizeChange = 22;
internal const uint kEventControlTrackingAreaEntered = 23;
internal const uint kEventControlTrackingAreaExited = 24;
internal const uint kEventControlTrack = 51;
internal const uint kEventControlGetScrollToHereStartPoint = 52;
internal const uint kEventControlGetIndicatorDragConstraint = 53;
internal const uint kEventControlIndicatorMoved = 54;
internal const uint kEventControlGhostingFinished = 55;
internal const uint kEventControlGetActionProcPart = 56;
internal const uint kEventControlGetPartRegion = 101;
internal const uint kEventControlGetPartBounds = 102;
internal const uint kEventControlSetData = 103;
internal const uint kEventControlGetData = 104;
internal const uint kEventControlGetSizeConstraints= 105;
internal const uint kEventControlGetFrameMetrics = 106;
internal const uint kEventControlValueFieldChanged = 151;
internal const uint kEventControlAddedSubControl = 152;
internal const uint kEventControlRemovingSubControl = 153;
internal const uint kEventControlBoundsChanged = 154;
internal const uint kEventControlVisibilityChanged = 157;
internal const uint kEventControlTitleChanged = 158;
internal const uint kEventControlOwningWindowChanged = 159;
internal const uint kEventControlHiliteChanged = 160;
internal const uint kEventControlEnabledStateChanged = 161;
internal const uint kEventControlLayoutInfoChanged = 162;
internal const uint kEventControlArbitraryMessage = 201;
#endregion
#region kEventClassCommand constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassTablet constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassVolume constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassAppearance constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassService constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassToolbar constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassToolbarItem constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventClassAccessibility constants
// TODO: We dont use these yet; fill if needed
#endregion
#region kEventParam constants
internal enum EventParamName : uint {
// source: /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEvents.h
/* Keyboard event parameter and types*/
kEventParamKeyMacCharCodes = 1801676914, // 'kchr'
/* Mouse event parameters and types*/
kEventParamMouseLocation = 1835822947, // 'mloc', /* typeHIPoint*/
kEventParamMouseButton = 1835168878, // 'mbtn' /* type MouseButton*/
/* Generic toolbox parameters and types */
kEventParamCGContextRef = 1668183160, // 'cntx' /* typeCGContextRef*/
kEventParamRgnHandle = 1919381096, // 'rgnh'
/* Control event parameters and types */
kEventParamControlPart = 1668313716, // 'cprt' /* typeControlPartCode*/
// source: /System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/Headers/CarbonEventsCore.h
/* Core Event Types */
kEventParamDirectObject = 757935405, // '----' /* type varies depending on event*/
}
internal enum EventParamType : uint {
typeControlPartCode = 1668313716, // 'cprt' /* ControlPartCode*/
typeQDPoint = 1363439732, // 'QDpt'
typeControlRef = 1668575852, // 'ctrl'
typeCGContextRef = 1668183160, // 'cntx' /* CGContextRef*/
typeMouseButton = 1835168878, // 'mbtn' /* EventMouseButton*/
typeQDRgnHandle = 1919381096, // 'rgnh'
typeChar = 1413830740, // 'TEXT'
}
#endregion
}
internal enum WindowClass : uint {
kAlertWindowClass = 1,
kMovableAlertWindowClass = 2,
kModalWindowClass = 3,
kMovableModalWindowClass = 4,
kFloatingWindowClass = 5,
kDocumentWindowClass = 6,
kUtilityWindowClass = 8,
kHelpWindowClass = 10,
kSheetWindowClass = 11,
kToolbarWindowClass = 12,
kPlainWindowClass = 13,
kOverlayWindowClass = 14,
kSheetAlertWindowClass = 15,
kAltPlainWindowClass = 16,
kDrawerWindowClass = 20,
kAllWindowClasses = 0xFFFFFFFF
}
internal enum WindowAttributes : uint {
kWindowNoAttributes = 0,
kWindowCloseBoxAttribute = (1u << 0),
kWindowHorizontalZoomAttribute = (1u << 1),
kWindowVerticalZoomAttribute = (1u << 2),
kWindowFullZoomAttribute = (kWindowVerticalZoomAttribute | kWindowHorizontalZoomAttribute),
kWindowCollapseBoxAttribute = (1u << 3),
kWindowResizableAttribute = (1u << 4),
kWindowSideTitlebarAttribute = (1u << 5),
kWindowToolbarButtonAttribute = (1u << 6),
kWindowMetalAttribute = (1u << 8),
kWindowNoUpdatesAttribute = (1u << 16),
kWindowNoActivatesAttribute = (1u << 17),
kWindowOpaqueForEventsAttribute = (1u << 18),
kWindowCompositingAttribute = (1u << 19),
kWindowNoShadowAttribute = (1u << 21),
kWindowHideOnSuspendAttribute = (1u << 24),
kWindowStandardHandlerAttribute = (1u << 25),
kWindowHideOnFullScreenAttribute = (1u << 26),
kWindowInWindowMenuAttribute = (1u << 27),
kWindowuiveResizeAttribute = (1u << 28),
kWindowIgnoreClicksAttribute = (1u << 29),
kWindowNoConstrainAttribute = (1u << 31),
kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute),
kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
}
internal enum ThemeCursor : uint {
kThemeArrowCursor = 0,
kThemeCopyArrowCursor = 1,
kThemeAliasArrowCursor = 2,
kThemeContextualMenuArrowCursor = 3,
kThemeIBeamCursor = 4,
kThemeCrossCursor = 5,
kThemePlusCursor = 6,
kThemeWatchCursor = 7,
kThemeClosedHandCursor = 8,
kThemeOpenHandCursor = 9,
kThemePointingHandCursor = 10,
kThemeCountingUpHandCursor = 11,
kThemeCountingDownHandCursor = 12,
kThemeCountingUpAndDownHandCursor = 13,
kThemeSpinningCursor = 14,
kThemeResizeLeftCursor = 15,
kThemeResizeRightCursor = 16,
kThemeResizeLeftRightCursor = 17,
kThemeNotAllowedCursor = 18
}
internal struct CGSize {
public float width;
public float height;
public CGSize (int w, int h) {
this.width = (float)w;
this.height = (float)h;
}
}
internal struct QDPoint {
public short y;
public short x;
public QDPoint (short x, short y) {
this.x = x;
this.y = y;
}
}
internal struct CGPoint {
public float x;
public float y;
public CGPoint (int x, int y) {
this.x = (float)x;
this.y = (float)y;
}
}
internal struct HIRect {
public CGPoint origin;
public CGSize size;
public HIRect (int x, int y, int w, int h) {
this.origin = new CGPoint (x, y);
this.size = new CGSize (w, h);
}
}
internal struct HIViewID {
public uint type;
public uint id;
public HIViewID (uint type, uint id) {
this.type = type;
this.id = id;
}
}
internal struct EventTypeSpec
{
public UInt32 eventClass;
public UInt32 eventKind;
public EventTypeSpec (UInt32 eventClass, UInt32 eventKind)
{
this.eventClass = eventClass;
this.eventKind = eventKind;
}
}
internal struct CarbonEvent
{
public IntPtr hWnd;
public IntPtr evt;
public CarbonEvent (IntPtr hWnd, IntPtr evt)
{
this.hWnd = hWnd;
this.evt = evt;
}
}
internal struct RGBColor
{
public short red;
public short green;
public short blue;
}
internal struct Rect
{
public short top;
public short left;
public short bottom;
public short right;
}
internal struct OSXCaret
{
internal Timer Timer;
internal IntPtr Hwnd;
internal int X;
internal int Y;
internal int Width;
internal int Height;
internal int Visible;
internal bool On;
internal bool Paused;
}
internal struct OSXHover {
internal Timer Timer;
internal IntPtr Hwnd;
internal int X;
internal int Y;
internal int Interval;
}
internal struct CGAffineTransform
{
internal float a;
internal float b;
internal float c;
internal float d;
internal float tx;
internal float ty;
}
internal enum MouseTrackingResult : ushort
{
kMouseTrackingMouseDown = 1,
kMouseTrackingMouseUp = 2,
kMouseTrackingMouseExited = 3,
kMouseTrackingMouseEntered = 4,
kMouseTrackingMouseDragged = 5,
kMouseTrackingKeyModifiersChanged = 6,
kMouseTrackingUserCancelled = 7,
kMouseTrackingTimedOut = 8,
kMouseTrackingMouseMoved = 9
}
internal struct MouseTrackingRegionID
{
uint signature;
uint id;
public MouseTrackingRegionID (uint signature, uint id) {
this.signature = signature;
this.id = id;
}
}
}
|