45
|
1 /**
|
|
2 * Copyright: Copyright (c) 2008 Jacob Carlborg. All rights reserved.
|
|
3 * Authors: Jacob Carlborg
|
|
4 * Version: Initial created: Nov 18, 2008
|
|
5 * License: $(LINK2 http://opensource.org/licenses/bsd-license.php, BSD Style)
|
|
6 *
|
|
7 */
|
|
8 module dwt.internal.c.Carbon;
|
|
9
|
|
10 import dwt.dwthelper.utils;
|
|
11 import bindings = dwt.internal.c.bindings;
|
|
12
|
|
13 // MacTypes.h
|
|
14
|
|
15 /********************************************************************************
|
|
16
|
|
17 Base integer types for all target OS's and CPU's
|
|
18
|
|
19 UInt8 8-bit unsigned integer
|
|
20 SInt8 8-bit signed integer
|
|
21 UInt16 16-bit uinteger
|
|
22 SInt16 16-bit signed integer
|
|
23 UInt32 32-bit uinteger
|
|
24 SInt32 32-bit signed integer
|
|
25 UInt64 64-bit uinteger
|
|
26 SInt64 64-bit integer
|
|
27
|
|
28 *********************************************************************************/
|
|
29 alias ubyte UInt8;
|
|
30 alias byte SInt8;
|
|
31 alias ushort UInt16;
|
|
32 alias short SInt16;
|
|
33 alias uint UInt32;
|
|
34 alias int SInt32;
|
|
35 alias ulong UInt64;
|
|
36 alias long SInt64;
|
|
37
|
|
38 alias byte uint8_t;
|
|
39
|
|
40 /********************************************************************************
|
|
41
|
|
42 Higher level basic types
|
|
43
|
|
44 OSErr 16-bit result error code
|
|
45 OSStatus 32-bit result error code
|
|
46 LogicalAddress Address in the clients virtual address space
|
|
47 ConstLogicalAddress Address in the clients virtual address space that will only be read
|
|
48 PhysicalAddress Real address as used on the hardware bus
|
|
49 BytePtr Pointer to an array of bytes
|
|
50 ByteCount The size of an array of bytes
|
|
51 ByteOffset An offset into an array of bytes
|
|
52 ItemCount 32-bit iteration count
|
|
53 OptionBits Standard 32-bit set of bit flags
|
|
54 PBVersion ?
|
|
55 Duration 32-bit millisecond timer for drivers
|
|
56 AbsoluteTime 64-bit clock
|
|
57 ScriptCode A particular set of written characters (e.g. Roman vs Cyrillic) and their encoding
|
|
58 LangCode A particular language (e.g. English), as represented using a particular ScriptCode
|
|
59 RegionCode Designates a language as used in a particular region (e.g. British vs American
|
|
60 English) together with other region-dependent characteristics (e.g. date format)
|
|
61 FourCharCode A 32-bit value made by packing four 1 byte characters together
|
|
62 OSType A FourCharCode used in the OS and file system (e.g. creator)
|
|
63 ResType A FourCharCode used to tag resources (e.g. 'DLOG')
|
|
64
|
|
65 *********************************************************************************/
|
|
66 alias SInt16 OSErr;
|
|
67 alias SInt32 OSStatus;
|
|
68 alias void* LogicalAddress;
|
|
69 alias /*const*/void* ConstLogicalAddress;
|
|
70 alias void* PhysicalAddress;
|
|
71 alias UInt8* BytePtr;
|
|
72 alias uint ByteCount;
|
|
73 alias uint ByteOffset;
|
|
74 alias SInt32 Duration;
|
|
75 alias UnsignedWide AbsoluteTime;
|
|
76 alias UInt32 OptionBits;
|
|
77 alias uint ItemCount;
|
|
78 alias UInt32 PBVersion;
|
|
79 alias SInt16 ScriptCode;
|
|
80 alias SInt16 LangCode;
|
|
81 alias SInt16 RegionCode;
|
|
82 alias UInt32 FourCharCode;
|
|
83 alias FourCharCode OSType;
|
|
84 alias FourCharCode ResType;
|
|
85 alias OSType* OSTypePtr;
|
|
86 alias ResType* ResTypePtr;
|
|
87
|
|
88 struct UnsignedWide
|
|
89 {
|
|
90 uint hi;
|
|
91 uint lo;
|
|
92 }
|
|
93
|
|
94 struct ProcessSerialNumber
|
|
95 {
|
|
96 uint highLongOfPSN;
|
|
97 uint lowLongOfPSN;
|
|
98 }
|
|
99
|
|
100 struct CPSProcessSerNum
|
|
101 {
|
|
102 uint lo;
|
|
103 uint hi;
|
|
104 }
|
|
105
|
|
106 alias ProcessSerialNumber * ProcessSerialNumberPtr;
|
|
107
|
|
108
|
|
109
|
|
110 // Appearance.h
|
|
111 enum ThemeCursor : uint
|
|
112 {
|
|
113 kThemeArrowCursor = 0,
|
|
114 kThemeCopyArrowCursor = 1,
|
|
115 kThemeAliasArrowCursor = 2,
|
|
116 kThemeContextualMenuArrowCursor = 3,
|
|
117 kThemeIBeamCursor = 4,
|
|
118 kThemeCrossCursor = 5,
|
|
119 kThemePlusCursor = 6,
|
|
120 kThemeWatchCursor = 7,
|
|
121 kThemeClosedHandCursor = 8,
|
|
122 kThemeOpenHandCursor = 9,
|
|
123 kThemePointingHandCursor = 10,
|
|
124 kThemeCountingUpHandCursor = 11,
|
|
125 kThemeCountingDownHandCursor = 12,
|
|
126 kThemeCountingUpAndDownHandCursor = 13,
|
|
127 kThemeSpinningCursor = 14,
|
|
128 kThemeResizeLeftCursor = 15,
|
|
129 kThemeResizeRightCursor = 16,
|
|
130 kThemeResizeLeftRightCursor = 17,
|
|
131 kThemeNotAllowedCursor = 18,
|
|
132 kThemeResizeUpCursor = 19,
|
|
133 kThemeResizeDownCursor = 20,
|
|
134 kThemeResizeUpDownCursor = 21,
|
|
135 kThemePoofCursor = 22
|
|
136 }
|
|
137
|
|
138 alias bindings.SetThemeCursor SetThemeCursor;
|
|
139
|
|
140
|
|
141
|
|
142 // CABase.h
|
|
143 static if ((void*).sizeof > int.sizeof) // 64bit target
|
|
144 alias double CGFloat;
|
|
145
|
|
146 else
|
|
147 alias float CGFloat;
|
|
148
|
|
149
|
|
150
|
|
151 // CarbonEventsCore.h
|
|
152 alias bindings.GetCurrentButtonState GetCurrentButtonState;
|
|
153
|
|
154
|
|
155
|
|
156 // CFBase.h
|
|
157 alias void* CFTypeRef;
|
|
158 alias void* __CFAllocator;
|
|
159 alias __CFAllocator* CFAllocatorRef;
|
|
160 alias void* __CFString;
|
|
161 alias __CFString* CFStringRef;
|
|
162
|
|
163 alias bindings.CFRelease CFRelease;
|
|
164
|
|
165
|
|
166
|
|
167 // CFNumberFormatter.h
|
|
168 enum
|
|
169 {
|
|
170 kCFNumberFormatterPadBeforePrefix = 0,
|
|
171 kCFNumberFormatterPadAfterPrefix = 1,
|
|
172 kCFNumberFormatterPadBeforeSuffix = 2,
|
|
173 kCFNumberFormatterPadAfterSuffix = 3
|
|
174 }
|
|
175
|
|
176 enum CFNumberFormatterRoundingMode
|
|
177 {
|
|
178 kCFNumberFormatterRoundCeiling = 0,
|
|
179 kCFNumberFormatterRoundFloor = 1,
|
|
180 kCFNumberFormatterRoundDown = 2,
|
|
181 kCFNumberFormatterRoundUp = 3,
|
|
182 kCFNumberFormatterRoundHalfEven = 4,
|
|
183 kCFNumberFormatterRoundHalfDown = 5,
|
|
184 kCFNumberFormatterRoundHalfUp = 6
|
|
185 }
|
|
186
|
|
187 enum
|
|
188 {
|
|
189 kCFNumberFormatterNoStyle = 0,
|
|
190 kCFNumberFormatterDecimalStyle = 1,
|
|
191 kCFNumberFormatterCurrencyStyle = 2,
|
|
192 kCFNumberFormatterPercentStyle = 3,
|
|
193 kCFNumberFormatterScientificStyle = 4,
|
|
194 kCFNumberFormatterSpellOutStyle = 5
|
|
195 }
|
|
196
|
|
197
|
|
198
|
|
199 //CFPropertyList.h
|
|
200 enum CFPropertyListFormat
|
|
201 {
|
|
202 kCFPropertyListOpenStepFormat = 1,
|
|
203 kCFPropertyListXMLFormat_v1_0 = 100,
|
|
204 kCFPropertyListBinaryFormat_v1_0 = 200
|
|
205 }
|
|
206
|
|
207 enum CFPropertyListMutabilityOptions
|
|
208 {
|
|
209 kCFPropertyListImmutable = 0,
|
|
210 kCFPropertyListMutableContainers = 1,
|
|
211 kCFPropertyListMutableContainersAndLeaves = 2
|
|
212 }
|
|
213
|
|
214
|
|
215
|
|
216 // CFRunLoop.h
|
|
217 alias void* __CFRunLoop;
|
|
218 alias __CFRunLoop* CFRunLoopRef;
|
|
219
|
|
220
|
|
221
|
|
222 // CFString.h
|
|
223 alias uint CFStringEncoding;
|
|
224
|
|
225
|
|
226
|
|
227 // CFURL.h
|
|
228 alias bindings.CFURLCreateStringByAddingPercentEscapes CFURLCreateStringByAddingPercentEscapes;
|
|
229
|
|
230
|
|
231
|
|
232 // CGColorSpace.h
|
|
233 alias void* CGColorSpace;
|
|
234 alias CGColorSpace* CGColorSpaceRef;
|
|
235
|
|
236
|
|
237
|
|
238 // CGError.h
|
|
239 alias int CGError;
|
|
240
|
|
241
|
|
242
|
|
243 // CGEventTypes.h
|
|
244 alias void* __CGEvent;
|
|
245 alias __CGEvent* CGEventRef;
|
|
246
|
|
247
|
|
248
|
|
249 // CGRemoteOperation.h
|
|
250 alias bindings.CGWarpMouseCursorPosition CGWarpMouseCursorPosition;
|
|
251
|
|
252
|
|
253
|
|
254 // Gestalt.h
|
|
255 alias bindings.Gestalt Gestalt;
|
|
256
|
|
257
|
|
258
|
|
259 // IconsCore.h
|
|
260 alias void* OpaqueIconRef;
|
|
261 alias OpaqueIconRef* IconRef;
|
|
262
|
|
263
|
|
264
|
|
265 // Processes.h
|
|
266 enum ProcessApplicationTransformState : uint
|
|
267 {
|
|
268 kProcessTransformToForegroundApplication = 1
|
|
269 }
|
|
270
|
|
271 alias bindings.GetCurrentProcess GetCurrentProcess;
|
|
272 alias bindings.SetFrontProcess SetFrontProcess;
|
|
273 alias bindings.TransformProcessType TransformProcessType;
|
|
274
|
|
275 short CPSSetProcessName (CPSProcessSerNum* PSN, String processname)
|
|
276 {
|
|
277 return bindings.CPSSetProcessName(PSN, processname.ptr);
|
|
278 }
|
|
279
|
|
280
|
|
281
|
|
282 // Quickdraw.h
|
|
283 struct Rect
|
|
284 {
|
|
285 short top;
|
|
286 short left;
|
|
287 short bottom;
|
|
288 short right;
|
|
289 }
|
|
290
|
|
291 alias int QDRegionParseDirection;
|
|
292 alias extern (C) OSStatus function (ushort message, RgnHandle rgn, /*const*/ Rect* rect, void* refCon) RegionToRectsProcPtr;
|
|
293 alias RegionToRectsProcPtr RegionToRectsUPP;
|
|
294
|
|
295 alias bindings.NewRgn NewRgn;
|
|
296 alias bindings.RectRgn RectRgn;
|
|
297 alias bindings.OpenRgn OpenRgn;
|
|
298 alias bindings.OffsetRgn OffsetRgn;
|
|
299 alias bindings.MoveTo MoveTo;
|
|
300 alias bindings.LineTo LineTo;
|
|
301 alias bindings.UnionRgn UnionRgn;
|
|
302 alias bindings.CloseRgn CloseRgn;
|
|
303 alias bindings.DisposeRgn DisposeRgn;
|
|
304 alias bindings.PtInRgn PtInRgn;
|
|
305 alias bindings.GetRegionBounds GetRegionBounds;
|
|
306 alias bindings.SectRgn SectRgn;
|
|
307 alias bindings.EmptyRgn EmptyRgn;
|
|
308 alias bindings.DiffRgn DiffRgn;
|
|
309 alias bindings.RectInRgn RectInRgn;
|
|
310 alias bindings.QDRegionToRects QDRegionToRects;
|
|
311 alias bindings.CopyRgn CopyRgn;
|
|
312 alias bindings.SetRect SetRect;
|
|
313
|
|
314
|
|
315
|
|
316 // QuickdrawTypes.h
|
|
317 struct MacRegion
|
|
318 {
|
|
319 ushort rgnSize; /* size in bytes; don't rely on it */
|
|
320 Rect rgnBBox; /* enclosing rectangle; in Carbon use GetRegionBounds */
|
|
321 }
|
|
322
|
|
323 struct Point
|
|
324 {
|
|
325 short v;
|
|
326 short h;
|
|
327 }
|
|
328
|
|
329 alias MacRegion Region;
|
|
330 alias MacRegion* RgnPtr;
|
|
331 alias RgnPtr* RgnHandle;
|
|
332
|
|
333 alias bool Boolean;
|
|
334 alias bool BOOL; |