1 // Copyright 2013 The Servo Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution.
3 //
4 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7 // option. This file may not be copied, modified, or distributed
8 // except according to those terms.
9
10 #![allow(non_upper_case_globals)]
11
12 use base::{id, BOOL, SEL};
13 use block::Block;
14 use foundation::{NSInteger, NSUInteger, NSTimeInterval,
15 NSPoint, NSSize, NSRect, NSRange, NSRectEdge};
16 use libc;
17
18 pub use core_graphics::base::CGFloat;
19 pub use core_graphics::geometry::CGPoint;
20
21 pub use self::NSApplicationActivationPolicy::*;
22 pub use self::NSApplicationActivationOptions::*;
23 pub use self::NSBackingStoreType::*;
24 pub use self::NSOpenGLPixelFormatAttribute::*;
25 pub use self::NSOpenGLPFAOpenGLProfiles::*;
26 pub use self::NSEventType::*;
27 use std::os::raw::c_void;
28
29 pub type CGLContextObj = *mut c_void;
30
31 pub type GLint = i32;
32
33 #[link(name = "AppKit", kind = "framework")]
34 extern {
35 pub static NSAppKitVersionNumber: f64;
36
37 // Types for Standard Data - OS X v10.6 and later. (NSString *const)
38 pub static NSPasteboardTypeString: id;
39 pub static NSPasteboardTypePDF: id;
40 pub static NSPasteboardTypeTIFF: id;
41 pub static NSPasteboardTypePNG: id;
42 pub static NSPasteboardTypeRTF: id;
43 pub static NSPasteboardTypeRTFD: id;
44 pub static NSPasteboardTypeHTML: id;
45 pub static NSPasteboardTypeTabularText: id;
46 pub static NSPasteboardTypeFont: id;
47 pub static NSPasteboardTypeRuler: id;
48 pub static NSPasteboardTypeColor: id;
49 pub static NSPasteboardTypeSound: id;
50 pub static NSPasteboardTypeMultipleTextSelection: id;
51 pub static NSPasteboardTypeFindPanelSearchOptions: id;
52
53 // Types for Standard Data - OS X v10.5 and earlier. (NSString *)
54 pub static NSStringPboardType: id;
55 pub static NSFilenamesPboardType: id;
56 pub static NSPostScriptPboardType: id;
57 pub static NSTIFFPboardType: id;
58 pub static NSRTFPboardType: id;
59 pub static NSTabularTextPboardType: id;
60 pub static NSFontPboardType: id;
61 pub static NSRulerPboardType: id;
62 pub static NSFileContentsPboardType: id;
63 pub static NSColorPboardType: id;
64 pub static NSRTFDPboardType: id;
65 pub static NSHTMLPboardType: id;
66 pub static NSPICTPboardType: id;
67 pub static NSURLPboardType: id;
68 pub static NSPDFPboardType: id;
69 pub static NSVCardPboardType: id;
70 pub static NSFilesPromisePboardType: id;
71 pub static NSMultipleTextSelectionPboardType: id;
72 pub static NSSoundPboardType: id;
73
74 // Names of provided pasteboards. (NSString *)
75 pub static NSGeneralPboard: id;
76 pub static NSFontPboard: id;
77 pub static NSRulerPboard: id;
78 pub static NSFindPboard: id;
79 pub static NSDragPboard: id;
80
81 // Pasteboard reading options - OS X v10.6 and later. (NSString *)
82 pub static NSPasteboardURLReadingFileURLsOnlyKey: id;
83 pub static NSPasteboardURLReadingContentsConformToTypesKey: id;
84
85 // NSAppearance names. (NSString *)
86 pub static NSAppearanceNameVibrantDark: id;
87 pub static NSAppearanceNameVibrantLight: id;
88
89 // Fullscreen mode options - OS X v10.5 and later. (NSString *)
90 pub static NSFullScreenModeAllScreens: id;
91 pub static NSFullScreenModeSetting: id;
92 pub static NSFullScreenModeWindowLevel: id;
93 pub static NSFullScreenModeApplicationPresentationOptions: id;
94 }
95
96 pub const NSAppKitVersionNumber10_0: f64 = 577.0;
97 pub const NSAppKitVersionNumber10_1: f64 = 620.0;
98 pub const NSAppKitVersionNumber10_2: f64 = 663.0;
99 pub const NSAppKitVersionNumber10_2_3: f64 = 663.6;
100 pub const NSAppKitVersionNumber10_3: f64 = 743.0;
101 pub const NSAppKitVersionNumber10_3_2: f64 = 743.14;
102 pub const NSAppKitVersionNumber10_3_3: f64 = 743.2;
103 pub const NSAppKitVersionNumber10_3_5: f64 = 743.24;
104 pub const NSAppKitVersionNumber10_3_7: f64 = 743.33;
105 pub const NSAppKitVersionNumber10_3_9: f64 = 743.36;
106 pub const NSAppKitVersionNumber10_4: f64 = 824.0;
107 pub const NSAppKitVersionNumber10_4_1: f64 = 824.1;
108 pub const NSAppKitVersionNumber10_4_3: f64 = 824.23;
109 pub const NSAppKitVersionNumber10_4_4: f64 = 824.33;
110 pub const NSAppKitVersionNumber10_4_7: f64 = 824.41;
111 pub const NSAppKitVersionNumber10_5: f64 = 949.0;
112 pub const NSAppKitVersionNumber10_5_2: f64 = 949.27;
113 pub const NSAppKitVersionNumber10_5_3: f64 = 949.33;
114 pub const NSAppKitVersionNumber10_6: f64 = 1038.0;
115 pub const NSAppKitVersionNumber10_7: f64 = 1138.0;
116 pub const NSAppKitVersionNumber10_7_2: f64 = 1138.23;
117 pub const NSAppKitVersionNumber10_7_3: f64 = 1138.32;
118 pub const NSAppKitVersionNumber10_7_4: f64 = 1138.47;
119 pub const NSAppKitVersionNumber10_8: f64 = 1187.0;
120 pub const NSAppKitVersionNumber10_9: f64 = 1265.0;
121 pub const NSAppKitVersionNumber10_10: f64 = 1343.0;
122 pub const NSAppKitVersionNumber10_10_2: f64 = 1344.0;
123 pub const NSAppKitVersionNumber10_10_3: f64 = 1347.0;
124 pub const NSAppKitVersionNumber10_10_4: f64 = 1348.0;
125 pub const NSAppKitVersionNumber10_10_5: f64 = 1348.0;
126 pub const NSAppKitVersionNumber10_10_Max: f64 = 1349.0;
127 pub const NSAppKitVersionNumber10_11: f64 = 1404.0;
128 pub const NSAppKitVersionNumber10_11_1: f64 = 1404.13;
129 pub const NSAppKitVersionNumber10_11_2: f64 = 1404.34;
130 pub const NSAppKitVersionNumber10_11_3: f64 = 1404.34;
131 pub const NSAppKitVersionNumber10_12: f64 = 1504.0;
132 pub const NSAppKitVersionNumber10_12_1: f64 = 1504.60;
133 pub const NSAppKitVersionNumber10_12_2: f64 = 1504.76;
134 pub const NSAppKitVersionNumber10_13: f64 = 1561.0;
135 pub const NSAppKitVersionNumber10_13_1: f64 = 1561.1;
136 pub const NSAppKitVersionNumber10_13_2: f64 = 1561.2;
137 pub const NSAppKitVersionNumber10_13_4: f64 = 1561.4;
138
NSApp() -> id139 pub unsafe fn NSApp() -> id {
140 msg_send![class!(NSApplication), sharedApplication]
141 }
142
143 #[repr(i64)]
144 #[derive(Clone, Copy, Debug, PartialEq)]
145 pub enum NSApplicationActivationPolicy {
146 NSApplicationActivationPolicyRegular = 0,
147 NSApplicationActivationPolicyAccessory = 1,
148 NSApplicationActivationPolicyProhibited = 2,
149 NSApplicationActivationPolicyERROR = -1
150 }
151
152 #[repr(u64)]
153 #[derive(Clone, Copy, Debug, PartialEq)]
154 pub enum NSApplicationActivationOptions {
155 NSApplicationActivateAllWindows = 1 << 0,
156 NSApplicationActivateIgnoringOtherApps = 1 << 1
157 }
158
159 #[repr(u64)]
160 #[derive(Clone, Copy, Debug, PartialEq)]
161 pub enum NSApplicationTerminateReply {
162 NSTerminateCancel = 0,
163 NSTerminateNow = 1,
164 NSTerminateLater = 2,
165 }
166
167 bitflags! {
168 pub struct NSApplicationPresentationOptions : NSUInteger {
169 const NSApplicationPresentationDefault = 0;
170 const NSApplicationPresentationAutoHideDock = 1 << 0;
171 const NSApplicationPresentationHideDock = 1 << 1;
172 const NSApplicationPresentationAutoHideMenuBar = 1 << 2;
173 const NSApplicationPresentationHideMenuBar = 1 << 3;
174 const NSApplicationPresentationDisableAppleMenu = 1 << 4;
175 const NSApplicationPresentationDisableProcessSwitching = 1 << 5;
176 const NSApplicationPresentationDisableForceQuit = 1 << 6;
177 const NSApplicationPresentationDisableSessionTermination = 1 << 7;
178 const NSApplicationPresentationDisableHideApplication = 1 << 8;
179 const NSApplicationPresentationDisableMenuBarTransparency = 1 << 9;
180 const NSApplicationPresentationFullScreen = 1 << 10;
181 const NSApplicationPresentationAutoHideToolbar = 1 << 11;
182 }
183 }
184
185 bitflags! {
186 pub struct NSWindowStyleMask: NSUInteger {
187 const NSBorderlessWindowMask = 0;
188 const NSTitledWindowMask = 1 << 0;
189 const NSClosableWindowMask = 1 << 1;
190 const NSMiniaturizableWindowMask = 1 << 2;
191 const NSResizableWindowMask = 1 << 3;
192
193 const NSTexturedBackgroundWindowMask = 1 << 8;
194
195 const NSUnifiedTitleAndToolbarWindowMask = 1 << 12;
196
197 const NSFullScreenWindowMask = 1 << 14;
198
199 const NSFullSizeContentViewWindowMask = 1 << 15;
200 }
201 }
202
203 #[repr(u64)]
204 #[derive(Clone, Copy, Debug, PartialEq)]
205 pub enum NSWindowTitleVisibility {
206 NSWindowTitleVisible = 0,
207 NSWindowTitleHidden = 1
208 }
209
210 #[repr(i64)]
211 #[derive(Clone, Copy, Debug, PartialEq)]
212 pub enum NSWindowTabbingMode {
213 NSWindowTabbingModeAutomatic = 0,
214 NSWindowTabbingModeDisallowed = 1,
215 NSWindowTabbingModePreferred = 2
216 }
217
218 #[repr(u64)]
219 #[derive(Clone, Copy, Debug, PartialEq)]
220 pub enum NSBackingStoreType {
221 NSBackingStoreRetained = 0,
222 NSBackingStoreNonretained = 1,
223 NSBackingStoreBuffered = 2
224 }
225
226 bitflags! {
227 pub struct NSWindowOrderingMode: NSInteger {
228 const NSWindowAbove = 1;
229 const NSWindowBelow = -1;
230 const NSWindowOut = 0;
231 }
232 }
233
234 bitflags! {
235 pub struct NSAlignmentOptions: libc::c_ulonglong {
236 const NSAlignMinXInward = 1 << 0;
237 const NSAlignMinYInward = 1 << 1;
238 const NSAlignMaxXInward = 1 << 2;
239 const NSAlignMaxYInward = 1 << 3;
240 const NSAlignWidthInward = 1 << 4;
241 const NSAlignHeightInward = 1 << 5;
242 const NSAlignMinXOutward = 1 << 8;
243 const NSAlignMinYOutward = 1 << 9;
244 const NSAlignMaxXOutward = 1 << 10;
245 const NSAlignMaxYOutward = 1 << 11;
246 const NSAlignWidthOutward = 1 << 12;
247 const NSAlignHeightOutward = 1 << 13;
248 const NSAlignMinXNearest = 1 << 16;
249 const NSAlignMinYNearest = 1 << 17;
250 const NSAlignMaxXNearest = 1 << 18;
251 const NSAlignMaxYNearest = 1 << 19;
252 const NSAlignWidthNearest = 1 << 20;
253 const NSAlignHeightNearest = 1 << 21;
254 const NSAlignRectFlipped = 1 << 63;
255 const NSAlignAllEdgesInward = NSAlignmentOptions::NSAlignMinXInward.bits
256 | NSAlignmentOptions::NSAlignMaxXInward.bits
257 | NSAlignmentOptions::NSAlignMinYInward.bits
258 | NSAlignmentOptions::NSAlignMaxYInward.bits;
259 const NSAlignAllEdgesOutward = NSAlignmentOptions::NSAlignMinXOutward.bits
260 | NSAlignmentOptions::NSAlignMaxXOutward.bits
261 | NSAlignmentOptions::NSAlignMinYOutward.bits
262 | NSAlignmentOptions::NSAlignMaxYOutward.bits;
263 const NSAlignAllEdgesNearest = NSAlignmentOptions::NSAlignMinXNearest.bits
264 | NSAlignmentOptions::NSAlignMaxXNearest.bits
265 | NSAlignmentOptions::NSAlignMinYNearest.bits
266 | NSAlignmentOptions::NSAlignMaxYNearest.bits;
267 }
268 }
269
270 #[repr(u64)]
271 #[derive(Clone, Copy, Debug, PartialEq)]
272 pub enum NSOpenGLPixelFormatAttribute {
273 NSOpenGLPFAAllRenderers = 1,
274 NSOpenGLPFATripleBuffer = 3,
275 NSOpenGLPFADoubleBuffer = 5,
276 NSOpenGLPFAStereo = 6,
277 NSOpenGLPFAAuxBuffers = 7,
278 NSOpenGLPFAColorSize = 8,
279 NSOpenGLPFAAlphaSize = 11,
280 NSOpenGLPFADepthSize = 12,
281 NSOpenGLPFAStencilSize = 13,
282 NSOpenGLPFAAccumSize = 14,
283 NSOpenGLPFAMinimumPolicy = 51,
284 NSOpenGLPFAMaximumPolicy = 52,
285 NSOpenGLPFAOffScreen = 53,
286 NSOpenGLPFAFullScreen = 54,
287 NSOpenGLPFASampleBuffers = 55,
288 NSOpenGLPFASamples = 56,
289 NSOpenGLPFAAuxDepthStencil = 57,
290 NSOpenGLPFAColorFloat = 58,
291 NSOpenGLPFAMultisample = 59,
292 NSOpenGLPFASupersample = 60,
293 NSOpenGLPFASampleAlpha = 61,
294 NSOpenGLPFARendererID = 70,
295 NSOpenGLPFASingleRenderer = 71,
296 NSOpenGLPFANoRecovery = 72,
297 NSOpenGLPFAAccelerated = 73,
298 NSOpenGLPFAClosestPolicy = 74,
299 NSOpenGLPFARobust = 75,
300 NSOpenGLPFABackingStore = 76,
301 NSOpenGLPFAMPSafe = 78,
302 NSOpenGLPFAWindow = 80,
303 NSOpenGLPFAMultiScreen = 81,
304 NSOpenGLPFACompliant = 83,
305 NSOpenGLPFAScreenMask = 84,
306 NSOpenGLPFAPixelBuffer = 90,
307 NSOpenGLPFARemotePixelBuffer = 91,
308 NSOpenGLPFAAllowOfflineRenderers = 96,
309 NSOpenGLPFAAcceleratedCompute = 97,
310 NSOpenGLPFAOpenGLProfile = 99,
311 NSOpenGLPFAVirtualScreenCount = 128,
312 }
313
314 #[repr(u64)]
315 #[allow(non_camel_case_types)]
316 #[derive(Clone, Copy, Debug, PartialEq)]
317 pub enum NSOpenGLPFAOpenGLProfiles {
318 NSOpenGLProfileVersionLegacy = 0x1000,
319 NSOpenGLProfileVersion3_2Core = 0x3200,
320 NSOpenGLProfileVersion4_1Core = 0x4100,
321 }
322
323 #[repr(u64)]
324 #[derive(Clone, Copy, Debug, PartialEq)]
325 pub enum NSOpenGLContextParameter {
326 NSOpenGLCPSwapInterval = 222,
327 NSOpenGLCPSurfaceOrder = 235,
328 NSOpenGLCPSurfaceOpacity = 236,
329 NSOpenGLCPSurfaceBackingSize = 304,
330 NSOpenGLCPReclaimResources = 308,
331 NSOpenGLCPCurrentRendererID = 309,
332 NSOpenGLCPGPUVertexProcessing = 310,
333 NSOpenGLCPGPUFragmentProcessing = 311,
334 NSOpenGLCPHasDrawable = 314,
335 NSOpenGLCPMPSwapsInFlight = 315,
336 }
337
338 #[repr(u64)]
339 #[derive(Clone, Copy, Debug, PartialEq)]
340 pub enum NSWindowButton {
341 NSWindowCloseButton = 0,
342 NSWindowMiniaturizeButton = 1,
343 NSWindowZoomButton = 2,
344 NSWindowToolbarButton = 3,
345 NSWindowDocumentIconButton = 4,
346 NSWindowDocumentVersionsButton = 6,
347 NSWindowFullScreenButton = 7,
348 }
349
350 #[repr(u64)]
351 #[derive(Clone, Copy, Debug, PartialEq)]
352 pub enum NSBezelStyle {
353 NSRoundedBezelStyle = 1,
354 NSRegularSquareBezelStyle = 2,
355 NSDisclosureBezelStyle = 5,
356 NSShadowlessSquareBezelStyle = 6,
357 NSCircularBezelStyle = 7,
358 NSTexturedSquareBezelStyle = 8,
359 NSHelpButtonBezelStyle = 9,
360 NSSmallSquareBezelStyle = 10,
361 NSTexturedRoundedBezelStyle = 11,
362 NSRoundRectBezelStyle = 12,
363 NSRecessedBezelStyle = 13,
364 NSRoundedDisclosureBezelStyle = 14,
365 }
366
367 #[repr(u64)]
368 #[derive(Clone, Copy, Debug, PartialEq)]
369 pub enum NSRequestUserAttentionType {
370 NSCriticalRequest = 0,
371 NSInformationalRequest = 10,
372 }
373
374 pub static NSMainMenuWindowLevel: i32 = 24;
375
376 pub trait NSApplication: Sized {
sharedApplication(_: Self) -> id377 unsafe fn sharedApplication(_: Self) -> id {
378 msg_send![class!(NSApplication), sharedApplication]
379 }
380
mainMenu(self) -> id381 unsafe fn mainMenu(self) -> id;
setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> BOOL382 unsafe fn setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> BOOL;
setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL383 unsafe fn setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL;
presentationOptions_(self) -> NSApplicationPresentationOptions384 unsafe fn presentationOptions_(self) -> NSApplicationPresentationOptions;
setMainMenu_(self, menu: id)385 unsafe fn setMainMenu_(self, menu: id);
setServicesMenu_(self, menu: id)386 unsafe fn setServicesMenu_(self, menu: id);
setWindowsMenu_(self, menu: id)387 unsafe fn setWindowsMenu_(self, menu: id);
activateIgnoringOtherApps_(self, ignore: BOOL)388 unsafe fn activateIgnoringOtherApps_(self, ignore: BOOL);
run(self)389 unsafe fn run(self);
finishLaunching(self)390 unsafe fn finishLaunching(self);
nextEventMatchingMask_untilDate_inMode_dequeue_(self, mask: NSUInteger, expiration: id, in_mode: id, dequeue: BOOL) -> id391 unsafe fn nextEventMatchingMask_untilDate_inMode_dequeue_(self,
392 mask: NSUInteger,
393 expiration: id,
394 in_mode: id,
395 dequeue: BOOL) -> id;
sendEvent_(self, an_event: id)396 unsafe fn sendEvent_(self, an_event: id);
postEvent_atStart_(self, anEvent: id, flag: BOOL)397 unsafe fn postEvent_atStart_(self, anEvent: id, flag: BOOL);
stop_(self, sender: id)398 unsafe fn stop_(self, sender: id);
setApplicationIconImage_(self, image: id)399 unsafe fn setApplicationIconImage_(self, image: id);
requestUserAttention_(self, requestType: NSRequestUserAttentionType)400 unsafe fn requestUserAttention_(self, requestType: NSRequestUserAttentionType);
401 }
402
403 impl NSApplication for id {
mainMenu(self) -> id404 unsafe fn mainMenu(self) -> id {
405 msg_send![self, mainMenu]
406 }
407
setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> BOOL408 unsafe fn setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> BOOL {
409 msg_send![self, setActivationPolicy:policy as NSInteger]
410 }
411
setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL412 unsafe fn setPresentationOptions_(self, options: NSApplicationPresentationOptions) -> BOOL {
413 msg_send![self, setPresentationOptions:options.bits]
414 }
415
presentationOptions_(self) -> NSApplicationPresentationOptions416 unsafe fn presentationOptions_(self) -> NSApplicationPresentationOptions {
417 let options = msg_send![self, presentationOptions];
418 return NSApplicationPresentationOptions::from_bits(options).unwrap();
419 }
420
setMainMenu_(self, menu: id)421 unsafe fn setMainMenu_(self, menu: id) {
422 msg_send![self, setMainMenu:menu]
423 }
424
setServicesMenu_(self, menu: id)425 unsafe fn setServicesMenu_(self, menu: id) {
426 msg_send![self, setServicesMenu:menu]
427 }
428
setWindowsMenu_(self, menu: id)429 unsafe fn setWindowsMenu_(self, menu: id) {
430 msg_send![self, setWindowsMenu:menu]
431 }
432
activateIgnoringOtherApps_(self, ignore: BOOL)433 unsafe fn activateIgnoringOtherApps_(self, ignore: BOOL) {
434 msg_send![self, activateIgnoringOtherApps:ignore]
435 }
436
run(self)437 unsafe fn run(self) {
438 msg_send![self, run]
439 }
440
finishLaunching(self)441 unsafe fn finishLaunching(self) {
442 msg_send![self, finishLaunching]
443 }
444
nextEventMatchingMask_untilDate_inMode_dequeue_(self, mask: NSUInteger, expiration: id, in_mode: id, dequeue: BOOL) -> id445 unsafe fn nextEventMatchingMask_untilDate_inMode_dequeue_(self,
446 mask: NSUInteger,
447 expiration: id,
448 in_mode: id,
449 dequeue: BOOL) -> id {
450 msg_send![self, nextEventMatchingMask:mask
451 untilDate:expiration
452 inMode:in_mode
453 dequeue:dequeue]
454 }
455
sendEvent_(self, an_event: id)456 unsafe fn sendEvent_(self, an_event: id) {
457 msg_send![self, sendEvent:an_event]
458 }
459
postEvent_atStart_(self, anEvent: id, flag: BOOL)460 unsafe fn postEvent_atStart_(self, anEvent: id, flag: BOOL) {
461 msg_send![self, postEvent:anEvent atStart:flag]
462 }
463
stop_(self, sender: id)464 unsafe fn stop_(self, sender: id) {
465 msg_send![self, stop:sender]
466 }
467
setApplicationIconImage_(self, icon: id)468 unsafe fn setApplicationIconImage_(self, icon: id) {
469 msg_send![self, setApplicationIconImage:icon]
470 }
471
requestUserAttention_(self, requestType: NSRequestUserAttentionType)472 unsafe fn requestUserAttention_(self, requestType: NSRequestUserAttentionType) {
473 msg_send![self, requestUserAttention:requestType]
474 }
475 }
476
477 pub trait NSRunningApplication: Sized {
currentApplication(_: Self) -> id478 unsafe fn currentApplication(_: Self) -> id {
479 msg_send![class!(NSRunningApplication), currentApplication]
480 }
activateWithOptions_(self, options: NSApplicationActivationOptions) -> BOOL481 unsafe fn activateWithOptions_(self, options: NSApplicationActivationOptions) -> BOOL;
482 }
483
484 impl NSRunningApplication for id {
activateWithOptions_(self, options: NSApplicationActivationOptions) -> BOOL485 unsafe fn activateWithOptions_(self, options: NSApplicationActivationOptions) -> BOOL {
486 msg_send![self, activateWithOptions:options as NSUInteger]
487 }
488 }
489
490 pub trait NSPasteboard: Sized {
generalPasteboard(_: Self) -> id491 unsafe fn generalPasteboard(_: Self) -> id {
492 msg_send![class!(NSPasteboard), generalPasteboard]
493 }
494
pasteboardByFilteringData_ofType(_: Self, data: id, _type: id) -> id495 unsafe fn pasteboardByFilteringData_ofType(_: Self, data: id, _type: id) -> id {
496 msg_send![class!(NSPasteboard), pasteboardByFilteringData:data ofType:_type]
497 }
498
pasteboardByFilteringFile(_: Self, file: id) -> id499 unsafe fn pasteboardByFilteringFile(_: Self, file: id) -> id {
500 msg_send![class!(NSPasteboard), pasteboardByFilteringFile:file]
501 }
502
pasteboardByFilteringTypesInPasteboard(_: Self, pboard: id) -> id503 unsafe fn pasteboardByFilteringTypesInPasteboard(_: Self, pboard: id) -> id {
504 msg_send![class!(NSPasteboard), pasteboardByFilteringTypesInPasteboard:pboard]
505 }
506
pasteboardWithName(_: Self, name: id) -> id507 unsafe fn pasteboardWithName(_: Self, name: id) -> id {
508 msg_send![class!(NSPasteboard), pasteboardWithName:name]
509 }
510
pasteboardWithUniqueName(_: Self) -> id511 unsafe fn pasteboardWithUniqueName(_: Self) -> id {
512 msg_send![class!(NSPasteboard), pasteboardWithUniqueName]
513 }
514
releaseGlobally(self)515 unsafe fn releaseGlobally(self);
516
clearContents(self) -> NSInteger517 unsafe fn clearContents(self) -> NSInteger;
writeObjects(self, objects: id) -> BOOL518 unsafe fn writeObjects(self, objects: id) -> BOOL;
setData_forType(self, data: id, dataType: id) -> BOOL519 unsafe fn setData_forType(self, data: id, dataType: id) -> BOOL;
setPropertyList_forType(self, plist: id, dataType: id) -> BOOL520 unsafe fn setPropertyList_forType(self, plist: id, dataType: id) -> BOOL;
setString_forType(self, string: id, dataType: id) -> BOOL521 unsafe fn setString_forType(self, string: id, dataType: id) -> BOOL;
522
readObjectsForClasses_options(self, classArray: id, options: id) -> id523 unsafe fn readObjectsForClasses_options(self, classArray: id, options: id) -> id;
pasteboardItems(self) -> id524 unsafe fn pasteboardItems(self) -> id;
indexOfPasteboardItem(self, pasteboardItem: id) -> NSInteger525 unsafe fn indexOfPasteboardItem(self, pasteboardItem: id) -> NSInteger;
dataForType(self, dataType: id) -> id526 unsafe fn dataForType(self, dataType: id) -> id;
propertyListForType(self, dataType: id) -> id527 unsafe fn propertyListForType(self, dataType: id) -> id;
stringForType(self, dataType: id) -> id528 unsafe fn stringForType(self, dataType: id) -> id;
529
availableTypeFromArray(self, types: id) -> id530 unsafe fn availableTypeFromArray(self, types: id) -> id;
canReadItemWithDataConformingToTypes(self, types: id) -> BOOL531 unsafe fn canReadItemWithDataConformingToTypes(self, types: id) -> BOOL;
canReadObjectForClasses_options(self, classArray: id, options: id) -> BOOL532 unsafe fn canReadObjectForClasses_options(self, classArray: id, options: id) -> BOOL;
types(self) -> id533 unsafe fn types(self) -> id;
typesFilterableTo(_: Self, _type: id) -> id534 unsafe fn typesFilterableTo(_: Self, _type: id) -> id {
535 msg_send![class!(NSPasteboard), typesFilterableTo:_type]
536 }
537
name(self) -> id538 unsafe fn name(self) -> id;
changeCount(self) -> NSInteger539 unsafe fn changeCount(self) -> NSInteger;
540
declareTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger541 unsafe fn declareTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger;
addTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger542 unsafe fn addTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger;
writeFileContents(self, filename: id) -> BOOL543 unsafe fn writeFileContents(self, filename: id) -> BOOL;
writeFileWrapper(self, wrapper: id) -> BOOL544 unsafe fn writeFileWrapper(self, wrapper: id) -> BOOL;
545
readFileContentsType_toFile(self, _type: id, filename: id) -> id546 unsafe fn readFileContentsType_toFile(self, _type: id, filename: id) -> id;
readFileWrapper(self) -> id547 unsafe fn readFileWrapper(self) -> id;
548 }
549
550 impl NSPasteboard for id {
releaseGlobally(self)551 unsafe fn releaseGlobally(self) {
552 msg_send![self, releaseGlobally]
553 }
554
clearContents(self) -> NSInteger555 unsafe fn clearContents(self) -> NSInteger {
556 msg_send![self, clearContents]
557 }
558
writeObjects(self, objects: id) -> BOOL559 unsafe fn writeObjects(self, objects: id) -> BOOL {
560 msg_send![self, writeObjects:objects]
561 }
562
setData_forType(self, data: id, dataType: id) -> BOOL563 unsafe fn setData_forType(self, data: id, dataType: id) -> BOOL {
564 msg_send![self, setData:data forType:dataType]
565 }
566
setPropertyList_forType(self, plist: id, dataType: id) -> BOOL567 unsafe fn setPropertyList_forType(self, plist: id, dataType: id) -> BOOL {
568 msg_send![self, setPropertyList:plist forType:dataType]
569 }
570
setString_forType(self, string: id, dataType: id) -> BOOL571 unsafe fn setString_forType(self, string: id, dataType: id) -> BOOL {
572 msg_send![self, setString:string forType:dataType]
573 }
574
readObjectsForClasses_options(self, classArray: id, options: id) -> id575 unsafe fn readObjectsForClasses_options(self, classArray: id, options: id) -> id {
576 msg_send![self, readObjectsForClasses:classArray options:options]
577 }
578
pasteboardItems(self) -> id579 unsafe fn pasteboardItems(self) -> id {
580 msg_send![self, pasteboardItems]
581 }
582
indexOfPasteboardItem(self, pasteboardItem: id) -> NSInteger583 unsafe fn indexOfPasteboardItem(self, pasteboardItem: id) -> NSInteger {
584 msg_send![self, indexOfPasteboardItem:pasteboardItem]
585 }
586
dataForType(self, dataType: id) -> id587 unsafe fn dataForType(self, dataType: id) -> id {
588 msg_send![self, dataForType:dataType]
589 }
590
propertyListForType(self, dataType: id) -> id591 unsafe fn propertyListForType(self, dataType: id) -> id {
592 msg_send![self, propertyListForType:dataType]
593 }
594
stringForType(self, dataType: id) -> id595 unsafe fn stringForType(self, dataType: id) -> id {
596 msg_send![self, stringForType:dataType]
597 }
598
availableTypeFromArray(self, types: id) -> id599 unsafe fn availableTypeFromArray(self, types: id) -> id {
600 msg_send![self, availableTypeFromArray:types]
601 }
602
canReadItemWithDataConformingToTypes(self, types: id) -> BOOL603 unsafe fn canReadItemWithDataConformingToTypes(self, types: id) -> BOOL {
604 msg_send![self, canReadItemWithDataConformingToTypes:types]
605 }
606
canReadObjectForClasses_options(self, classArray: id, options: id) -> BOOL607 unsafe fn canReadObjectForClasses_options(self, classArray: id, options: id) -> BOOL {
608 msg_send![self, canReadObjectForClasses:classArray options:options]
609 }
610
types(self) -> id611 unsafe fn types(self) -> id {
612 msg_send![self, types]
613 }
614
name(self) -> id615 unsafe fn name(self) -> id {
616 msg_send![self, name]
617 }
618
changeCount(self) -> NSInteger619 unsafe fn changeCount(self) -> NSInteger {
620 msg_send![self, changeCount]
621 }
622
declareTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger623 unsafe fn declareTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger {
624 msg_send![self, declareTypes:newTypes owner:newOwner]
625 }
626
addTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger627 unsafe fn addTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger {
628 msg_send![self, addTypes:newTypes owner:newOwner]
629 }
630
writeFileContents(self, filename: id) -> BOOL631 unsafe fn writeFileContents(self, filename: id) -> BOOL {
632 msg_send![self, writeFileContents:filename]
633 }
634
writeFileWrapper(self, wrapper: id) -> BOOL635 unsafe fn writeFileWrapper(self, wrapper: id) -> BOOL {
636 msg_send![self, writeFileWrapper:wrapper]
637 }
638
readFileContentsType_toFile(self, _type: id, filename: id) -> id639 unsafe fn readFileContentsType_toFile(self, _type: id, filename: id) -> id {
640 msg_send![self, readFileContentsType:_type toFile:filename]
641 }
642
readFileWrapper(self) -> id643 unsafe fn readFileWrapper(self) -> id {
644 msg_send![self, readFileWrapper]
645 }
646
647 }
648
649 pub trait NSPasteboardItem: Sized {
types(self) -> id650 unsafe fn types(self) -> id;
651
setDataProvider_forTypes(self, dataProvider: id, types: id) -> BOOL652 unsafe fn setDataProvider_forTypes(self, dataProvider: id, types: id) -> BOOL;
setData_forType(self, data: id, _type: id) -> BOOL653 unsafe fn setData_forType(self, data: id, _type: id) -> BOOL;
setString_forType(self, string: id, _type: id) -> BOOL654 unsafe fn setString_forType(self, string: id, _type: id) -> BOOL;
setPropertyList_forType(self, propertyList: id, _type: id) -> BOOL655 unsafe fn setPropertyList_forType(self, propertyList: id, _type: id) -> BOOL;
656
dataForType(self, _type: id) -> id657 unsafe fn dataForType(self, _type: id) -> id;
stringForType(self, _type: id) -> id658 unsafe fn stringForType(self, _type: id) -> id;
propertyListForType(self, _type: id) -> id659 unsafe fn propertyListForType(self, _type: id) -> id;
660 }
661
662 impl NSPasteboardItem for id {
types(self) -> id663 unsafe fn types(self) -> id {
664 msg_send![self, types]
665 }
666
setDataProvider_forTypes(self, dataProvider: id, types: id) -> BOOL667 unsafe fn setDataProvider_forTypes(self, dataProvider: id, types: id) -> BOOL {
668 msg_send![self, setDataProvider:dataProvider forTypes:types]
669 }
670
setData_forType(self, data: id, _type: id) -> BOOL671 unsafe fn setData_forType(self, data: id, _type: id) -> BOOL {
672 msg_send![self, setData:data forType:_type]
673 }
674
setString_forType(self, string: id, _type: id) -> BOOL675 unsafe fn setString_forType(self, string: id, _type: id) -> BOOL {
676 msg_send![self, setString:string forType:_type]
677 }
678
setPropertyList_forType(self, propertyList: id, _type: id) -> BOOL679 unsafe fn setPropertyList_forType(self, propertyList: id, _type: id) -> BOOL {
680 msg_send![self, setPropertyList:propertyList forType:_type]
681 }
682
dataForType(self, _type: id) -> id683 unsafe fn dataForType(self, _type: id) -> id {
684 msg_send![self, dataForType:_type]
685 }
686
stringForType(self, _type: id) -> id687 unsafe fn stringForType(self, _type: id) -> id {
688 msg_send![self, stringForType:_type]
689 }
690
propertyListForType(self, _type: id) -> id691 unsafe fn propertyListForType(self, _type: id) -> id {
692 msg_send![self, propertyListForType:_type]
693 }
694 }
695
696 pub trait NSPasteboardItemDataProvider: Sized {
pasteboard_item_provideDataForType(self, pasteboard: id, item: id, _type: id)697 unsafe fn pasteboard_item_provideDataForType(self, pasteboard: id, item: id, _type: id);
pasteboardFinishedWithDataProvider(self, pasteboard: id)698 unsafe fn pasteboardFinishedWithDataProvider(self, pasteboard: id);
699 }
700
701 impl NSPasteboardItemDataProvider for id {
pasteboard_item_provideDataForType(self, pasteboard: id, item: id, _type: id)702 unsafe fn pasteboard_item_provideDataForType(self, pasteboard: id, item: id, _type: id) {
703 msg_send![self, pasteboard:pasteboard item:item provideDataForType:_type]
704 }
705
pasteboardFinishedWithDataProvider(self, pasteboard: id)706 unsafe fn pasteboardFinishedWithDataProvider(self, pasteboard: id) {
707 msg_send![self, pasteboardFinishedWithDataProvider:pasteboard]
708 }
709 }
710
711 pub trait NSPasteboardWriting: Sized {
writableTypesForPasteboard(self, pasteboard: id) -> id712 unsafe fn writableTypesForPasteboard(self, pasteboard: id) -> id;
writingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardWritingOptions713 unsafe fn writingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardWritingOptions;
714
pasteboardPropertyListForType(self, _type: id) -> id715 unsafe fn pasteboardPropertyListForType(self, _type: id) -> id;
716 }
717
718 impl NSPasteboardWriting for id {
writableTypesForPasteboard(self, pasteboard: id) -> id719 unsafe fn writableTypesForPasteboard(self, pasteboard: id) -> id {
720 msg_send![self, writableTypesForPasteboard:pasteboard]
721 }
722
writingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardWritingOptions723 unsafe fn writingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardWritingOptions {
724 msg_send![self, writingOptionsForType:_type pasteboard:pasteboard]
725 }
726
pasteboardPropertyListForType(self, _type: id) -> id727 unsafe fn pasteboardPropertyListForType(self, _type: id) -> id {
728 msg_send![self, pasteboardPropertyListForType:_type]
729 }
730 }
731
732 pub trait NSPasteboardReading: Sized {
initWithPasteboardPropertyList_ofType(self, propertyList: id, _type: id) -> id733 unsafe fn initWithPasteboardPropertyList_ofType(self, propertyList: id, _type: id) -> id;
734
readableTypesForPasteboard(self, pasteboard: id) -> id735 unsafe fn readableTypesForPasteboard(self, pasteboard: id) -> id;
readingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardReadingOptions736 unsafe fn readingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardReadingOptions;
737 }
738
739 impl NSPasteboardReading for id {
initWithPasteboardPropertyList_ofType(self, propertyList: id, _type: id) -> id740 unsafe fn initWithPasteboardPropertyList_ofType(self, propertyList: id, _type: id) -> id {
741 msg_send![self, initWithPasteboardPropertyList:propertyList ofType:_type]
742 }
743
readableTypesForPasteboard(self, pasteboard: id) -> id744 unsafe fn readableTypesForPasteboard(self, pasteboard: id) -> id {
745 let class: id = msg_send![self, class];
746 msg_send![class, readableTypesForPasteboard:pasteboard]
747 }
readingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardReadingOptions748 unsafe fn readingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardReadingOptions {
749 let class: id = msg_send![self, class];
750 msg_send![class, readingOptionsForType:_type pasteboard:pasteboard]
751 }
752 }
753
754 #[repr(u64)]
755 #[derive(Clone, Copy, Debug, PartialEq)]
756 pub enum NSPasteboardReadingOptions {
757 NSPasteboardReadingAsData = 0,
758 NSPasteboardReadingAsString = 1 << 0,
759 NSPasteboardReadingAsPropertyList = 1 << 1,
760 NSPasteboardReadingAsKeyedArchive = 1 << 2
761 }
762
763 #[repr(u64)]
764 #[derive(Clone, Copy, Debug, PartialEq)]
765 pub enum NSPasteboardWritingOptions {
766 NSPasteboardWritingPromised = 1 << 9,
767 }
768
769 pub trait NSMenu: Sized {
alloc(_: Self) -> id770 unsafe fn alloc(_: Self) -> id {
771 msg_send![class!(NSMenu), alloc]
772 }
773
new(_: Self) -> id774 unsafe fn new(_: Self) -> id {
775 msg_send![class!(NSMenu), new]
776 }
777
initWithTitle_(self, title: id ) -> id778 unsafe fn initWithTitle_(self, title: id /* NSString */) -> id;
setAutoenablesItems(self, state: BOOL)779 unsafe fn setAutoenablesItems(self, state: BOOL);
780
addItem_(self, menu_item: id)781 unsafe fn addItem_(self, menu_item: id);
addItemWithTitle_action_keyEquivalent(self, title: id, action: SEL, key: id) -> id782 unsafe fn addItemWithTitle_action_keyEquivalent(self, title: id, action: SEL, key: id) -> id;
itemAtIndex_(self, index: NSInteger) -> id783 unsafe fn itemAtIndex_(self, index: NSInteger) -> id;
784 }
785
786 impl NSMenu for id {
initWithTitle_(self, title: id ) -> id787 unsafe fn initWithTitle_(self, title: id /* NSString */) -> id {
788 msg_send![self, initWithTitle:title]
789 }
790
setAutoenablesItems(self, state: BOOL)791 unsafe fn setAutoenablesItems(self, state: BOOL) {
792 msg_send![self, setAutoenablesItems: state]
793 }
794
addItem_(self, menu_item: id)795 unsafe fn addItem_(self, menu_item: id) {
796 msg_send![self, addItem:menu_item]
797 }
798
addItemWithTitle_action_keyEquivalent(self, title: id, action: SEL, key: id) -> id799 unsafe fn addItemWithTitle_action_keyEquivalent(self, title: id, action: SEL, key: id) -> id {
800 msg_send![self, addItemWithTitle:title action:action keyEquivalent:key]
801 }
802
itemAtIndex_(self, index: NSInteger) -> id803 unsafe fn itemAtIndex_(self, index: NSInteger) -> id {
804 msg_send![self, itemAtIndex:index]
805 }
806 }
807
808 pub trait NSMenuItem: Sized {
alloc(_: Self) -> id809 unsafe fn alloc(_: Self) -> id {
810 msg_send![class!(NSMenuItem), alloc]
811 }
812
new(_: Self) -> id813 unsafe fn new(_: Self) -> id {
814 msg_send![class!(NSMenuItem), new]
815 }
816
separatorItem(_: Self) -> id817 unsafe fn separatorItem(_: Self) -> id {
818 msg_send![class!(NSMenuItem), separatorItem]
819 }
820
initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id821 unsafe fn initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id;
setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags)822 unsafe fn setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags);
setSubmenu_(self, submenu: id)823 unsafe fn setSubmenu_(self, submenu: id);
setTarget_(self, target: id)824 unsafe fn setTarget_(self, target: id);
825 }
826
827 impl NSMenuItem for id {
initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id828 unsafe fn initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id {
829 msg_send![self, initWithTitle:title action:action keyEquivalent:key]
830 }
831
setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags)832 unsafe fn setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags) {
833 msg_send![self, setKeyEquivalentModifierMask:mask]
834 }
835
setSubmenu_(self, submenu: id)836 unsafe fn setSubmenu_(self, submenu: id) {
837 msg_send![self, setSubmenu:submenu]
838 }
839
setTarget_(self, target: id)840 unsafe fn setTarget_(self, target: id) {
841 msg_send![self, setTarget:target]
842 }
843 }
844
845 pub type NSWindowDepth = libc::c_int;
846
847 bitflags! {
848 pub struct NSWindowCollectionBehavior: NSUInteger {
849 const NSWindowCollectionBehaviorDefault = 0;
850 const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0;
851 const NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1;
852
853 const NSWindowCollectionBehaviorManaged = 1 << 2;
854 const NSWindowCollectionBehaviorTransient = 1 << 3;
855 const NSWindowCollectionBehaviorStationary = 1 << 4;
856
857 const NSWindowCollectionBehaviorParticipatesInCycle = 1 << 5;
858 const NSWindowCollectionBehaviorIgnoresCycle = 1 << 6;
859
860 const NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7;
861 const NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8;
862 }
863 }
864
865 bitflags! {
866 pub struct NSWindowOcclusionState: NSUInteger {
867 const NSWindowOcclusionStateVisible = 1 << 1;
868 }
869 }
870
871 pub trait NSWindow: Sized {
alloc(_: Self) -> id872 unsafe fn alloc(_: Self) -> id {
873 msg_send![class!(NSWindow), alloc]
874 }
875
876 // Creating Windows
initWithContentRect_styleMask_backing_defer_(self, rect: NSRect, style: NSWindowStyleMask, backing: NSBackingStoreType, defer: BOOL) -> id877 unsafe fn initWithContentRect_styleMask_backing_defer_(self,
878 rect: NSRect,
879 style: NSWindowStyleMask,
880 backing: NSBackingStoreType,
881 defer: BOOL) -> id;
initWithContentRect_styleMask_backing_defer_screen_(self, rect: NSRect, style: NSWindowStyleMask, backing: NSBackingStoreType, defer: BOOL, screen: id) -> id882 unsafe fn initWithContentRect_styleMask_backing_defer_screen_(self,
883 rect: NSRect,
884 style: NSWindowStyleMask,
885 backing: NSBackingStoreType,
886 defer: BOOL,
887 screen: id) -> id;
888
889 // Configuring Windows
styleMask(self) -> NSWindowStyleMask890 unsafe fn styleMask(self) -> NSWindowStyleMask;
setStyleMask_(self, styleMask: NSWindowStyleMask)891 unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask);
toggleFullScreen_(self, sender: id)892 unsafe fn toggleFullScreen_(self, sender: id);
worksWhenModal(self) -> BOOL893 unsafe fn worksWhenModal(self) -> BOOL;
alphaValue(self) -> CGFloat894 unsafe fn alphaValue(self) -> CGFloat;
setAlphaValue_(self, windowAlpha: CGFloat)895 unsafe fn setAlphaValue_(self, windowAlpha: CGFloat);
backgroundColor(self) -> id896 unsafe fn backgroundColor(self) -> id;
setBackgroundColor_(self, color: id)897 unsafe fn setBackgroundColor_(self, color: id);
colorSpace(self) -> id898 unsafe fn colorSpace(self) -> id;
setColorSpace_(self, colorSpace: id)899 unsafe fn setColorSpace_(self, colorSpace: id);
contentView(self) -> id900 unsafe fn contentView(self) -> id;
setContentView_(self, view: id)901 unsafe fn setContentView_(self, view: id);
canHide(self) -> BOOL902 unsafe fn canHide(self) -> BOOL;
setCanHide_(self, canHide: BOOL)903 unsafe fn setCanHide_(self, canHide: BOOL);
hidesOnDeactivate(self) -> BOOL904 unsafe fn hidesOnDeactivate(self) -> BOOL;
setHidesOnDeactivate_(self, hideOnDeactivate: BOOL)905 unsafe fn setHidesOnDeactivate_(self, hideOnDeactivate: BOOL);
collectionBehavior(self) -> NSWindowCollectionBehavior906 unsafe fn collectionBehavior(self) -> NSWindowCollectionBehavior;
setCollectionBehavior_(self, collectionBehavior: NSWindowCollectionBehavior)907 unsafe fn setCollectionBehavior_(self, collectionBehavior: NSWindowCollectionBehavior);
setOpaque_(self, opaque: BOOL)908 unsafe fn setOpaque_(self, opaque: BOOL);
hasShadow(self) -> BOOL909 unsafe fn hasShadow(self) -> BOOL;
setHasShadow_(self, hasShadow: BOOL)910 unsafe fn setHasShadow_(self, hasShadow: BOOL);
invalidateShadow(self)911 unsafe fn invalidateShadow(self);
autorecalculatesContentBorderThicknessForEdge_(self, edge: NSRectEdge) -> BOOL912 unsafe fn autorecalculatesContentBorderThicknessForEdge_(self, edge: NSRectEdge) -> BOOL;
setAutorecalculatesContentBorderThickness_forEdge_(self, autorecalculateContentBorderThickness: BOOL, edge: NSRectEdge) -> BOOL913 unsafe fn setAutorecalculatesContentBorderThickness_forEdge_(self,
914 autorecalculateContentBorderThickness: BOOL,
915 edge: NSRectEdge) -> BOOL;
contentBorderThicknessForEdge_(self, edge: NSRectEdge) -> CGFloat916 unsafe fn contentBorderThicknessForEdge_(self, edge: NSRectEdge) -> CGFloat;
setContentBorderThickness_forEdge_(self, borderThickness: CGFloat, edge: NSRectEdge)917 unsafe fn setContentBorderThickness_forEdge_(self, borderThickness: CGFloat, edge: NSRectEdge);
delegate(self) -> id918 unsafe fn delegate(self) -> id;
setDelegate_(self, delegate: id)919 unsafe fn setDelegate_(self, delegate: id);
preventsApplicationTerminationWhenModal(self) -> BOOL920 unsafe fn preventsApplicationTerminationWhenModal(self) -> BOOL;
setPreventsApplicationTerminationWhenModal_(self, flag: BOOL)921 unsafe fn setPreventsApplicationTerminationWhenModal_(self, flag: BOOL);
922
923 // TODO: Accessing Window Information
924
925 // Getting Layout Information
contentRectForFrameRect_styleMask_(self, windowFrame: NSRect, windowStyle: NSWindowStyleMask) -> NSRect926 unsafe fn contentRectForFrameRect_styleMask_(self, windowFrame: NSRect, windowStyle: NSWindowStyleMask) -> NSRect;
frameRectForContentRect_styleMask_(self, windowContentRect: NSRect, windowStyle: NSWindowStyleMask) -> NSRect927 unsafe fn frameRectForContentRect_styleMask_(self, windowContentRect: NSRect, windowStyle: NSWindowStyleMask) -> NSRect;
minFrameWidthWithTitle_styleMask_(self, windowTitle: id, windowStyle: NSWindowStyleMask) -> CGFloat928 unsafe fn minFrameWidthWithTitle_styleMask_(self, windowTitle: id, windowStyle: NSWindowStyleMask) -> CGFloat;
contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect929 unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect;
frameRectForContentRect_(self, windowContent: NSRect) -> NSRect930 unsafe fn frameRectForContentRect_(self, windowContent: NSRect) -> NSRect;
931
932 // Managing Windows
drawers(self) -> id933 unsafe fn drawers(self) -> id;
windowController(self) -> id934 unsafe fn windowController(self) -> id;
setWindowController_(self, windowController: id)935 unsafe fn setWindowController_(self, windowController: id);
936
937 // TODO: Managing Sheets
938
939 // Sizing Windows
frame(self) -> NSRect940 unsafe fn frame(self) -> NSRect;
setFrameOrigin_(self, point: NSPoint)941 unsafe fn setFrameOrigin_(self, point: NSPoint);
setFrameTopLeftPoint_(self, point: NSPoint)942 unsafe fn setFrameTopLeftPoint_(self, point: NSPoint);
constrainFrameRect_toScreen_(self, frameRect: NSRect, screen: id)943 unsafe fn constrainFrameRect_toScreen_(self, frameRect: NSRect, screen: id);
cascadeTopLeftFromPoint_(self, topLeft: NSPoint) -> NSPoint944 unsafe fn cascadeTopLeftFromPoint_(self, topLeft: NSPoint) -> NSPoint;
setFrame_display_(self, windowFrame: NSRect, display: BOOL)945 unsafe fn setFrame_display_(self, windowFrame: NSRect, display: BOOL);
setFrame_displayViews_(self, windowFrame: NSRect, display: BOOL)946 unsafe fn setFrame_displayViews_(self, windowFrame: NSRect, display: BOOL);
aspectRatio(self) -> NSSize947 unsafe fn aspectRatio(self) -> NSSize;
setAspectRatio_(self, aspectRatio: NSSize)948 unsafe fn setAspectRatio_(self, aspectRatio: NSSize);
minSize(self) -> NSSize949 unsafe fn minSize(self) -> NSSize;
setMinSize_(self, minSize: NSSize)950 unsafe fn setMinSize_(self, minSize: NSSize);
maxSize(self) -> NSSize951 unsafe fn maxSize(self) -> NSSize;
setMaxSize_(self, maxSize: NSSize)952 unsafe fn setMaxSize_(self, maxSize: NSSize);
performZoom_(self, sender: id)953 unsafe fn performZoom_(self, sender: id);
zoom_(self, sender: id)954 unsafe fn zoom_(self, sender: id);
resizeFlags(self) -> NSInteger955 unsafe fn resizeFlags(self) -> NSInteger;
showsResizeIndicator(self) -> BOOL956 unsafe fn showsResizeIndicator(self) -> BOOL;
setShowsResizeIndicator_(self, showsResizeIndicator: BOOL)957 unsafe fn setShowsResizeIndicator_(self, showsResizeIndicator: BOOL);
resizeIncrements(self) -> NSSize958 unsafe fn resizeIncrements(self) -> NSSize;
setResizeIncrements_(self, resizeIncrements: NSSize)959 unsafe fn setResizeIncrements_(self, resizeIncrements: NSSize);
preservesContentDuringLiveResize(self) -> BOOL960 unsafe fn preservesContentDuringLiveResize(self) -> BOOL;
setPreservesContentDuringLiveResize_(self, preservesContentDuringLiveResize: BOOL)961 unsafe fn setPreservesContentDuringLiveResize_(self, preservesContentDuringLiveResize: BOOL);
inLiveResize(self) -> BOOL962 unsafe fn inLiveResize(self) -> BOOL;
963
964 // Sizing Content
contentAspectRatio(self) -> NSSize965 unsafe fn contentAspectRatio(self) -> NSSize;
setContentAspectRatio_(self, contentAspectRatio: NSSize)966 unsafe fn setContentAspectRatio_(self, contentAspectRatio: NSSize);
contentMinSize(self) -> NSSize967 unsafe fn contentMinSize(self) -> NSSize;
setContentMinSize_(self, contentMinSize: NSSize)968 unsafe fn setContentMinSize_(self, contentMinSize: NSSize);
contentSize(self) -> NSSize969 unsafe fn contentSize(self) -> NSSize;
setContentSize_(self, contentSize: NSSize)970 unsafe fn setContentSize_(self, contentSize: NSSize);
contentMaxSize(self) -> NSSize971 unsafe fn contentMaxSize(self) -> NSSize;
setContentMaxSize_(self, contentMaxSize: NSSize)972 unsafe fn setContentMaxSize_(self, contentMaxSize: NSSize);
contentResizeIncrements(self) -> NSSize973 unsafe fn contentResizeIncrements(self) -> NSSize;
setContentResizeIncrements_(self, contentResizeIncrements: NSSize)974 unsafe fn setContentResizeIncrements_(self, contentResizeIncrements: NSSize);
975
976 // Managing Window Visibility and Occlusion State
isVisible(self) -> BOOL977 unsafe fn isVisible(self) -> BOOL; // NOTE: Deprecated in 10.9
occlusionState(self) -> NSWindowOcclusionState978 unsafe fn occlusionState(self) -> NSWindowOcclusionState;
979
980 // Managing Window Layers
orderOut_(self, sender: id)981 unsafe fn orderOut_(self, sender: id);
orderBack_(self, sender: id)982 unsafe fn orderBack_(self, sender: id);
orderFront_(self, sender: id)983 unsafe fn orderFront_(self, sender: id);
orderFrontRegardless(self)984 unsafe fn orderFrontRegardless(self);
orderFrontWindow_relativeTo_(self, orderingMode: NSWindowOrderingMode, otherWindowNumber: NSInteger)985 unsafe fn orderFrontWindow_relativeTo_(self, orderingMode: NSWindowOrderingMode, otherWindowNumber: NSInteger);
level(self) -> NSInteger986 unsafe fn level(self) -> NSInteger;
setLevel_(self, level: NSInteger)987 unsafe fn setLevel_(self, level: NSInteger);
988
989 // Managing Key Status
canBecomeKeyWindow(self) -> BOOL990 unsafe fn canBecomeKeyWindow(self) -> BOOL;
makeKeyWindow(self)991 unsafe fn makeKeyWindow(self);
makeKeyAndOrderFront_(self, sender: id)992 unsafe fn makeKeyAndOrderFront_(self, sender: id);
993 // skipped: becomeKeyWindow (should not be invoked directly, according to Apple's documentation)
994 // skipped: resignKeyWindow (should not be invoked directly, according to Apple's documentation)
995
996 // Managing Main Status
canBecomeMainWindow(self) -> BOOL997 unsafe fn canBecomeMainWindow(self) -> BOOL;
makeMainWindow(self)998 unsafe fn makeMainWindow(self);
999 // skipped: becomeMainWindow (should not be invoked directly, according to Apple's documentation)
1000 // skipped: resignMainWindow (should not be invoked directly, according to Apple's documentation)
1001
1002 // Managing Toolbars
toolbar(self) -> id1003 unsafe fn toolbar(self) -> id /* NSToolbar */;
setToolbar_(self, toolbar: id )1004 unsafe fn setToolbar_(self, toolbar: id /* NSToolbar */);
runToolbarCustomizationPalette(self, sender: id)1005 unsafe fn runToolbarCustomizationPalette(self, sender: id);
1006
1007 // TODO: Managing Attached Windows
1008 // TODO: Managing Window Buffers
1009 // TODO: Managing Default Buttons
1010 // TODO: Managing Field Editors
1011 // TODO: Managing the Window Menu
1012 // TODO: Managing Cursor Rectangles
1013
1014 // Managing Title Bars
standardWindowButton_(self, windowButtonKind: NSWindowButton) -> id1015 unsafe fn standardWindowButton_(self, windowButtonKind: NSWindowButton) -> id;
1016
1017 // Managing Window Tabs
allowsAutomaticWindowTabbing(_: Self) -> BOOL1018 unsafe fn allowsAutomaticWindowTabbing(_: Self) -> BOOL;
setAllowsAutomaticWindowTabbing_(_: Self, allowsAutomaticWindowTabbing: BOOL)1019 unsafe fn setAllowsAutomaticWindowTabbing_(_: Self, allowsAutomaticWindowTabbing: BOOL);
tabbingIdentifier(self) -> id1020 unsafe fn tabbingIdentifier(self) -> id;
tabbingMode(self) -> NSWindowTabbingMode1021 unsafe fn tabbingMode(self) -> NSWindowTabbingMode;
setTabbingMode_(self, tabbingMode: NSWindowTabbingMode)1022 unsafe fn setTabbingMode_(self, tabbingMode: NSWindowTabbingMode);
addTabbedWindow_ordered_(self, window: id, ordering_mode: NSWindowOrderingMode)1023 unsafe fn addTabbedWindow_ordered_(self, window: id, ordering_mode: NSWindowOrderingMode);
toggleTabBar_(self, sender: id)1024 unsafe fn toggleTabBar_(self, sender: id);
1025
1026 // TODO: Managing Tooltips
1027 // TODO: Handling Events
1028
1029 // Managing Responders
initialFirstResponder(self) -> id1030 unsafe fn initialFirstResponder(self) -> id;
firstResponder(self) -> id1031 unsafe fn firstResponder(self) -> id;
setInitialFirstResponder_(self, responder: id)1032 unsafe fn setInitialFirstResponder_(self, responder: id);
makeFirstResponder_(self, responder: id) -> BOOL1033 unsafe fn makeFirstResponder_(self, responder: id) -> BOOL;
1034
1035 // TODO: Managing the Key View Loop
1036
1037 // Handling Keyboard Events
keyDown_(self, event: id)1038 unsafe fn keyDown_(self, event: id);
1039
1040 // Handling Mouse Events
acceptsMouseMovedEvents(self) -> BOOL1041 unsafe fn acceptsMouseMovedEvents(self) -> BOOL;
ignoresMouseEvents(self) -> BOOL1042 unsafe fn ignoresMouseEvents(self) -> BOOL;
setIgnoresMouseEvents_(self, ignoreMouseEvents: BOOL)1043 unsafe fn setIgnoresMouseEvents_(self, ignoreMouseEvents: BOOL);
mouseLocationOutsideOfEventStream(self) -> NSPoint1044 unsafe fn mouseLocationOutsideOfEventStream(self) -> NSPoint;
setAcceptsMouseMovedEvents_(self, acceptMouseMovedEvents: BOOL)1045 unsafe fn setAcceptsMouseMovedEvents_(self, acceptMouseMovedEvents: BOOL);
windowNumberAtPoint_belowWindowWithWindowNumber_(self, point: NSPoint, windowNumber: NSInteger) -> NSInteger1046 unsafe fn windowNumberAtPoint_belowWindowWithWindowNumber_(self,
1047 point: NSPoint,
1048 windowNumber: NSInteger) -> NSInteger;
1049
1050 // TODO: Handling Window Restoration
1051 // TODO: Bracketing Drawing Operations
1052 // TODO: Drawing Windows
1053 // TODO: Window Animation
1054 // TODO: Updating Windows
1055 // TODO: Dragging Items
1056
1057 // Converting Coordinates
backingScaleFactor(self) -> CGFloat1058 unsafe fn backingScaleFactor(self) -> CGFloat;
backingAlignedRect_options_(self, rect: NSRect, options: NSAlignmentOptions) -> NSRect1059 unsafe fn backingAlignedRect_options_(self, rect: NSRect, options: NSAlignmentOptions) -> NSRect;
convertRectFromBacking_(self, rect: NSRect) -> NSRect1060 unsafe fn convertRectFromBacking_(self, rect: NSRect) -> NSRect;
convertRectToBacking_(self, rect: NSRect) -> NSRect1061 unsafe fn convertRectToBacking_(self, rect: NSRect) -> NSRect;
convertRectToScreen_(self, rect: NSRect) -> NSRect1062 unsafe fn convertRectToScreen_(self, rect: NSRect) -> NSRect;
convertRectFromScreen_(self, rect: NSRect) -> NSRect1063 unsafe fn convertRectFromScreen_(self, rect: NSRect) -> NSRect;
1064
1065 // Accessing Edited Status
setDocumentEdited_(self, documentEdited: BOOL)1066 unsafe fn setDocumentEdited_(self, documentEdited: BOOL);
1067
1068 // Managing Titles
title(self) -> id1069 unsafe fn title(self) -> id;
setTitle_(self, title: id)1070 unsafe fn setTitle_(self, title: id);
setTitleWithRepresentedFilename_(self, filePath: id)1071 unsafe fn setTitleWithRepresentedFilename_(self, filePath: id);
setTitleVisibility_(self, visibility: NSWindowTitleVisibility)1072 unsafe fn setTitleVisibility_(self, visibility: NSWindowTitleVisibility);
setTitlebarAppearsTransparent_(self, transparent: BOOL)1073 unsafe fn setTitlebarAppearsTransparent_(self, transparent: BOOL);
representedFilename(self) -> id1074 unsafe fn representedFilename(self) -> id;
setRepresentedFilename_(self, filePath: id)1075 unsafe fn setRepresentedFilename_(self, filePath: id);
representedURL(self) -> id1076 unsafe fn representedURL(self) -> id;
setRepresentedURL_(self, representedURL: id)1077 unsafe fn setRepresentedURL_(self, representedURL: id);
1078
1079 // Accessing Screen Information
screen(self) -> id1080 unsafe fn screen(self) -> id;
deepestScreen(self) -> id1081 unsafe fn deepestScreen(self) -> id;
displaysWhenScreenProfileChanges(self) -> BOOL1082 unsafe fn displaysWhenScreenProfileChanges(self) -> BOOL;
setDisplaysWhenScreenProfileChanges_(self, displaysWhenScreenProfileChanges: BOOL)1083 unsafe fn setDisplaysWhenScreenProfileChanges_(self, displaysWhenScreenProfileChanges: BOOL);
1084
1085 // Moving Windows
setMovableByWindowBackground_(self, movableByWindowBackground: BOOL)1086 unsafe fn setMovableByWindowBackground_(self, movableByWindowBackground: BOOL);
setMovable_(self, movable: BOOL)1087 unsafe fn setMovable_(self, movable: BOOL);
center(self)1088 unsafe fn center(self);
1089
1090 // Closing Windows
performClose_(self, sender: id)1091 unsafe fn performClose_(self, sender: id);
close(self)1092 unsafe fn close(self);
setReleasedWhenClosed_(self, releasedWhenClosed: BOOL)1093 unsafe fn setReleasedWhenClosed_(self, releasedWhenClosed: BOOL);
1094
1095 // Minimizing Windows
performMiniaturize_(self, sender: id)1096 unsafe fn performMiniaturize_(self, sender: id);
miniaturize_(self, sender: id)1097 unsafe fn miniaturize_(self, sender: id);
deminiaturize_(self, sender: id)1098 unsafe fn deminiaturize_(self, sender: id);
miniwindowImage(self) -> id1099 unsafe fn miniwindowImage(self) -> id;
setMiniwindowImage_(self, miniwindowImage: id)1100 unsafe fn setMiniwindowImage_(self, miniwindowImage: id);
miniwindowTitle(self) -> id1101 unsafe fn miniwindowTitle(self) -> id;
setMiniwindowTitle_(self, miniwindowTitle: id)1102 unsafe fn setMiniwindowTitle_(self, miniwindowTitle: id);
1103
1104 // TODO: Getting the Dock Tile
1105 // TODO: Printing Windows
1106 // TODO: Providing Services
1107 // TODO: Working with Carbon
1108 // TODO: Triggering Constraint-Based Layout
1109 // TODO: Debugging Constraint-Based Layout
1110 // TODO: Constraint-Based Layouts
1111 }
1112
1113 impl NSWindow for id {
1114 // Creating Windows
1115
initWithContentRect_styleMask_backing_defer_(self, rect: NSRect, style: NSWindowStyleMask, backing: NSBackingStoreType, defer: BOOL) -> id1116 unsafe fn initWithContentRect_styleMask_backing_defer_(self,
1117 rect: NSRect,
1118 style: NSWindowStyleMask,
1119 backing: NSBackingStoreType,
1120 defer: BOOL) -> id {
1121 msg_send![self, initWithContentRect:rect
1122 styleMask:style.bits
1123 backing:backing as NSUInteger
1124 defer:defer]
1125 }
1126
initWithContentRect_styleMask_backing_defer_screen_(self, rect: NSRect, style: NSWindowStyleMask, backing: NSBackingStoreType, defer: BOOL, screen: id) -> id1127 unsafe fn initWithContentRect_styleMask_backing_defer_screen_(self,
1128 rect: NSRect,
1129 style: NSWindowStyleMask,
1130 backing: NSBackingStoreType,
1131 defer: BOOL,
1132 screen: id) -> id {
1133 msg_send![self, initWithContentRect:rect
1134 styleMask:style.bits
1135 backing:backing as NSUInteger
1136 defer:defer
1137 screen:screen]
1138 }
1139
1140 // Configuring Windows
1141
styleMask(self) -> NSWindowStyleMask1142 unsafe fn styleMask(self) -> NSWindowStyleMask {
1143 NSWindowStyleMask::from_bits_truncate(msg_send![self, styleMask])
1144 }
1145
setStyleMask_(self, styleMask: NSWindowStyleMask)1146 unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask) {
1147 msg_send![self, setStyleMask:styleMask.bits]
1148 }
1149
toggleFullScreen_(self, sender: id)1150 unsafe fn toggleFullScreen_(self, sender: id) {
1151 msg_send![self, toggleFullScreen:sender]
1152 }
1153
worksWhenModal(self) -> BOOL1154 unsafe fn worksWhenModal(self) -> BOOL {
1155 msg_send![self, worksWhenModal]
1156 }
1157
alphaValue(self) -> CGFloat1158 unsafe fn alphaValue(self) -> CGFloat {
1159 msg_send![self, alphaValue]
1160 }
1161
setAlphaValue_(self, windowAlpha: CGFloat)1162 unsafe fn setAlphaValue_(self, windowAlpha: CGFloat) {
1163 msg_send![self, setAlphaValue:windowAlpha]
1164 }
1165
backgroundColor(self) -> id1166 unsafe fn backgroundColor(self) -> id {
1167 msg_send![self, backgroundColor]
1168 }
1169
setBackgroundColor_(self, color: id)1170 unsafe fn setBackgroundColor_(self, color: id) {
1171 msg_send![self, setBackgroundColor:color]
1172 }
1173
colorSpace(self) -> id1174 unsafe fn colorSpace(self) -> id {
1175 msg_send![self, colorSpace]
1176 }
1177
setColorSpace_(self, colorSpace: id)1178 unsafe fn setColorSpace_(self, colorSpace: id) {
1179 msg_send![self, setColorSpace:colorSpace]
1180 }
1181
contentView(self) -> id1182 unsafe fn contentView(self) -> id {
1183 msg_send![self, contentView]
1184 }
1185
setContentView_(self, view: id)1186 unsafe fn setContentView_(self, view: id) {
1187 msg_send![self, setContentView:view]
1188 }
1189
canHide(self) -> BOOL1190 unsafe fn canHide(self) -> BOOL {
1191 msg_send![self, canHide]
1192 }
1193
setCanHide_(self, canHide: BOOL)1194 unsafe fn setCanHide_(self, canHide: BOOL) {
1195 msg_send![self, setCanHide:canHide]
1196 }
1197
hidesOnDeactivate(self) -> BOOL1198 unsafe fn hidesOnDeactivate(self) -> BOOL {
1199 msg_send![self, hidesOnDeactivate]
1200 }
1201
setHidesOnDeactivate_(self, hideOnDeactivate: BOOL)1202 unsafe fn setHidesOnDeactivate_(self, hideOnDeactivate: BOOL) {
1203 msg_send![self, setHidesOnDeactivate:hideOnDeactivate]
1204 }
1205
collectionBehavior(self) -> NSWindowCollectionBehavior1206 unsafe fn collectionBehavior(self) -> NSWindowCollectionBehavior {
1207 msg_send![self, collectionBehavior]
1208 }
1209
setCollectionBehavior_(self, collectionBehavior: NSWindowCollectionBehavior)1210 unsafe fn setCollectionBehavior_(self, collectionBehavior: NSWindowCollectionBehavior) {
1211 msg_send![self, setCollectionBehavior:collectionBehavior]
1212 }
1213
setOpaque_(self, opaque: BOOL)1214 unsafe fn setOpaque_(self, opaque: BOOL) {
1215 msg_send![self, setOpaque:opaque]
1216 }
1217
hasShadow(self) -> BOOL1218 unsafe fn hasShadow(self) -> BOOL {
1219 msg_send![self, hasShadow]
1220 }
1221
setHasShadow_(self, hasShadow: BOOL)1222 unsafe fn setHasShadow_(self, hasShadow: BOOL) {
1223 msg_send![self, setHasShadow:hasShadow]
1224 }
1225
invalidateShadow(self)1226 unsafe fn invalidateShadow(self) {
1227 msg_send![self, invalidateShadow]
1228 }
1229
autorecalculatesContentBorderThicknessForEdge_(self, edge: NSRectEdge) -> BOOL1230 unsafe fn autorecalculatesContentBorderThicknessForEdge_(self, edge: NSRectEdge) -> BOOL {
1231 msg_send![self, autorecalculatesContentBorderThicknessForEdge:edge]
1232 }
1233
setAutorecalculatesContentBorderThickness_forEdge_(self, autorecalculateContentBorderThickness: BOOL, edge: NSRectEdge) -> BOOL1234 unsafe fn setAutorecalculatesContentBorderThickness_forEdge_(self,
1235 autorecalculateContentBorderThickness: BOOL,
1236 edge: NSRectEdge) -> BOOL {
1237 msg_send![self, setAutorecalculatesContentBorderThickness:
1238 autorecalculateContentBorderThickness forEdge:edge]
1239 }
1240
contentBorderThicknessForEdge_(self, edge: NSRectEdge) -> CGFloat1241 unsafe fn contentBorderThicknessForEdge_(self, edge: NSRectEdge) -> CGFloat {
1242 msg_send![self, contentBorderThicknessForEdge:edge]
1243 }
1244
setContentBorderThickness_forEdge_(self, borderThickness: CGFloat, edge: NSRectEdge)1245 unsafe fn setContentBorderThickness_forEdge_(self, borderThickness: CGFloat, edge: NSRectEdge) {
1246 msg_send![self, setContentBorderThickness:borderThickness forEdge:edge]
1247 }
1248
delegate(self) -> id1249 unsafe fn delegate(self) -> id {
1250 msg_send![self, delegate]
1251 }
1252
setDelegate_(self, delegate: id)1253 unsafe fn setDelegate_(self, delegate: id) {
1254 msg_send![self, setDelegate:delegate]
1255 }
1256
preventsApplicationTerminationWhenModal(self) -> BOOL1257 unsafe fn preventsApplicationTerminationWhenModal(self) -> BOOL {
1258 msg_send![self, preventsApplicationTerminationWhenModal]
1259 }
1260
setPreventsApplicationTerminationWhenModal_(self, flag: BOOL)1261 unsafe fn setPreventsApplicationTerminationWhenModal_(self, flag: BOOL) {
1262 msg_send![self, setPreventsApplicationTerminationWhenModal:flag]
1263 }
1264
1265 // TODO: Accessing Window Information
1266
1267 // Getting Layout Information
1268
contentRectForFrameRect_styleMask_(self, windowFrame: NSRect, windowStyle: NSWindowStyleMask) -> NSRect1269 unsafe fn contentRectForFrameRect_styleMask_(self, windowFrame: NSRect, windowStyle: NSWindowStyleMask) -> NSRect {
1270 msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits]
1271 }
1272
frameRectForContentRect_styleMask_(self, windowContentRect: NSRect, windowStyle: NSWindowStyleMask) -> NSRect1273 unsafe fn frameRectForContentRect_styleMask_(self, windowContentRect: NSRect, windowStyle: NSWindowStyleMask) -> NSRect {
1274 msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits]
1275 }
1276
minFrameWidthWithTitle_styleMask_(self, windowTitle: id, windowStyle: NSWindowStyleMask) -> CGFloat1277 unsafe fn minFrameWidthWithTitle_styleMask_(self, windowTitle: id, windowStyle: NSWindowStyleMask) -> CGFloat {
1278 msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits]
1279 }
1280
contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect1281 unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect {
1282 msg_send![self, contentRectForFrameRect:windowFrame]
1283 }
1284
frameRectForContentRect_(self, windowContent: NSRect) -> NSRect1285 unsafe fn frameRectForContentRect_(self, windowContent: NSRect) -> NSRect {
1286 msg_send![self, frameRectForContentRect:windowContent]
1287 }
1288
1289 // Managing Windows
1290
drawers(self) -> id1291 unsafe fn drawers(self) -> id {
1292 msg_send![self, drawers]
1293 }
1294
windowController(self) -> id1295 unsafe fn windowController(self) -> id {
1296 msg_send![self, windowController]
1297 }
1298
setWindowController_(self, windowController: id)1299 unsafe fn setWindowController_(self, windowController: id) {
1300 msg_send![self, setWindowController:windowController]
1301 }
1302
1303 // TODO: Managing Sheets
1304
1305 // Sizing Windows
1306
frame(self) -> NSRect1307 unsafe fn frame(self) -> NSRect {
1308 msg_send![self, frame]
1309 }
1310
setFrameOrigin_(self, point: NSPoint)1311 unsafe fn setFrameOrigin_(self, point: NSPoint) {
1312 msg_send![self, setFrameOrigin:point]
1313 }
1314
setFrameTopLeftPoint_(self, point: NSPoint)1315 unsafe fn setFrameTopLeftPoint_(self, point: NSPoint) {
1316 msg_send![self, setFrameTopLeftPoint:point]
1317 }
1318
constrainFrameRect_toScreen_(self, frameRect: NSRect, screen: id)1319 unsafe fn constrainFrameRect_toScreen_(self, frameRect: NSRect, screen: id) {
1320 msg_send![self, constrainFrameRect:frameRect toScreen:screen]
1321 }
1322
cascadeTopLeftFromPoint_(self, topLeft: NSPoint) -> NSPoint1323 unsafe fn cascadeTopLeftFromPoint_(self, topLeft: NSPoint) -> NSPoint {
1324 msg_send![self, cascadeTopLeftFromPoint:topLeft]
1325 }
1326
setFrame_display_(self, windowFrame: NSRect, display: BOOL)1327 unsafe fn setFrame_display_(self, windowFrame: NSRect, display: BOOL) {
1328 msg_send![self, setFrame:windowFrame display:display]
1329 }
1330
setFrame_displayViews_(self, windowFrame: NSRect, display: BOOL)1331 unsafe fn setFrame_displayViews_(self, windowFrame: NSRect, display: BOOL) {
1332 msg_send![self, setFrame:windowFrame displayViews:display]
1333 }
1334
aspectRatio(self) -> NSSize1335 unsafe fn aspectRatio(self) -> NSSize {
1336 msg_send![self, aspectRatio]
1337 }
1338
setAspectRatio_(self, aspectRatio: NSSize)1339 unsafe fn setAspectRatio_(self, aspectRatio: NSSize) {
1340 msg_send![self, setAspectRatio:aspectRatio]
1341 }
1342
minSize(self) -> NSSize1343 unsafe fn minSize(self) -> NSSize {
1344 msg_send![self, minSize]
1345 }
1346
setMinSize_(self, minSize: NSSize)1347 unsafe fn setMinSize_(self, minSize: NSSize) {
1348 msg_send![self, setMinSize:minSize]
1349 }
1350
maxSize(self) -> NSSize1351 unsafe fn maxSize(self) -> NSSize {
1352 msg_send![self, maxSize]
1353 }
1354
setMaxSize_(self, maxSize: NSSize)1355 unsafe fn setMaxSize_(self, maxSize: NSSize) {
1356 msg_send![self, setMaxSize:maxSize]
1357 }
1358
performZoom_(self, sender: id)1359 unsafe fn performZoom_(self, sender: id) {
1360 msg_send![self, performZoom:sender]
1361 }
1362
zoom_(self, sender: id)1363 unsafe fn zoom_(self, sender: id) {
1364 msg_send![self, zoom:sender]
1365 }
1366
resizeFlags(self) -> NSInteger1367 unsafe fn resizeFlags(self) -> NSInteger {
1368 msg_send![self, resizeFlags]
1369 }
1370
showsResizeIndicator(self) -> BOOL1371 unsafe fn showsResizeIndicator(self) -> BOOL {
1372 msg_send![self, showsResizeIndicator]
1373 }
1374
setShowsResizeIndicator_(self, showsResizeIndicator: BOOL)1375 unsafe fn setShowsResizeIndicator_(self, showsResizeIndicator: BOOL) {
1376 msg_send![self, setShowsResizeIndicator:showsResizeIndicator]
1377 }
1378
resizeIncrements(self) -> NSSize1379 unsafe fn resizeIncrements(self) -> NSSize {
1380 msg_send![self, resizeIncrements]
1381 }
1382
setResizeIncrements_(self, resizeIncrements: NSSize)1383 unsafe fn setResizeIncrements_(self, resizeIncrements: NSSize) {
1384 msg_send![self, setResizeIncrements:resizeIncrements]
1385 }
1386
preservesContentDuringLiveResize(self) -> BOOL1387 unsafe fn preservesContentDuringLiveResize(self) -> BOOL {
1388 msg_send![self, preservesContentDuringLiveResize]
1389 }
1390
setPreservesContentDuringLiveResize_(self, preservesContentDuringLiveResize: BOOL)1391 unsafe fn setPreservesContentDuringLiveResize_(self, preservesContentDuringLiveResize: BOOL) {
1392 msg_send![self, setPreservesContentDuringLiveResize:preservesContentDuringLiveResize]
1393 }
1394
inLiveResize(self) -> BOOL1395 unsafe fn inLiveResize(self) -> BOOL {
1396 msg_send![self, inLiveResize]
1397 }
1398
1399 // Sizing Content
1400
contentAspectRatio(self) -> NSSize1401 unsafe fn contentAspectRatio(self) -> NSSize {
1402 msg_send![self, contentAspectRatio]
1403 }
1404
setContentAspectRatio_(self, contentAspectRatio: NSSize)1405 unsafe fn setContentAspectRatio_(self, contentAspectRatio: NSSize) {
1406 msg_send![self, setContentAspectRatio:contentAspectRatio]
1407 }
1408
contentMinSize(self) -> NSSize1409 unsafe fn contentMinSize(self) -> NSSize {
1410 msg_send![self, contentMinSize]
1411 }
1412
setContentMinSize_(self, contentMinSize: NSSize)1413 unsafe fn setContentMinSize_(self, contentMinSize: NSSize) {
1414 msg_send![self, setContentMinSize:contentMinSize]
1415 }
1416
contentSize(self) -> NSSize1417 unsafe fn contentSize(self) -> NSSize {
1418 msg_send![self, contentSize]
1419 }
1420
setContentSize_(self, contentSize: NSSize)1421 unsafe fn setContentSize_(self, contentSize: NSSize) {
1422 msg_send![self, setContentSize:contentSize]
1423 }
1424
contentMaxSize(self) -> NSSize1425 unsafe fn contentMaxSize(self) -> NSSize {
1426 msg_send![self, contentMaxSize]
1427 }
1428
setContentMaxSize_(self, contentMaxSize: NSSize)1429 unsafe fn setContentMaxSize_(self, contentMaxSize: NSSize) {
1430 msg_send![self, setContentMaxSize:contentMaxSize]
1431 }
1432
contentResizeIncrements(self) -> NSSize1433 unsafe fn contentResizeIncrements(self) -> NSSize {
1434 msg_send![self, contentResizeIncrements]
1435 }
1436
setContentResizeIncrements_(self, contentResizeIncrements: NSSize)1437 unsafe fn setContentResizeIncrements_(self, contentResizeIncrements: NSSize) {
1438 msg_send![self, setContentResizeIncrements:contentResizeIncrements]
1439 }
1440
1441 // Managing Window Visibility and Occlusion State
1442
isVisible(self) -> BOOL1443 unsafe fn isVisible(self) -> BOOL {
1444 msg_send![self, isVisible]
1445 }
1446
occlusionState(self) -> NSWindowOcclusionState1447 unsafe fn occlusionState(self) -> NSWindowOcclusionState {
1448 msg_send![self, occlusionState]
1449 }
1450
1451 // Managing Window Layers
1452
orderOut_(self, sender: id)1453 unsafe fn orderOut_(self, sender: id) {
1454 msg_send![self, orderOut:sender]
1455 }
1456
orderBack_(self, sender: id)1457 unsafe fn orderBack_(self, sender: id) {
1458 msg_send![self, orderBack:sender]
1459 }
1460
orderFront_(self, sender: id)1461 unsafe fn orderFront_(self, sender: id) {
1462 msg_send![self, orderFront:sender]
1463 }
1464
orderFrontRegardless(self)1465 unsafe fn orderFrontRegardless(self) {
1466 msg_send![self, orderFrontRegardless]
1467 }
1468
orderFrontWindow_relativeTo_(self, ordering_mode: NSWindowOrderingMode, other_window_number: NSInteger)1469 unsafe fn orderFrontWindow_relativeTo_(self, ordering_mode: NSWindowOrderingMode, other_window_number: NSInteger) {
1470 msg_send![self, orderWindow:ordering_mode relativeTo:other_window_number]
1471 }
1472
level(self) -> NSInteger1473 unsafe fn level(self) -> NSInteger {
1474 msg_send![self, level]
1475 }
1476
setLevel_(self, level: NSInteger)1477 unsafe fn setLevel_(self, level: NSInteger) {
1478 msg_send![self, setLevel:level]
1479 }
1480
1481 // Managing Key Status
1482
canBecomeKeyWindow(self) -> BOOL1483 unsafe fn canBecomeKeyWindow(self) -> BOOL {
1484 msg_send![self, canBecomeKeyWindow]
1485 }
1486
makeKeyWindow(self)1487 unsafe fn makeKeyWindow(self) {
1488 msg_send![self, makeKeyWindow]
1489 }
1490
makeKeyAndOrderFront_(self, sender: id)1491 unsafe fn makeKeyAndOrderFront_(self, sender: id) {
1492 msg_send![self, makeKeyAndOrderFront:sender]
1493 }
1494
1495 // Managing Main Status
1496
canBecomeMainWindow(self) -> BOOL1497 unsafe fn canBecomeMainWindow(self) -> BOOL {
1498 msg_send![self, canBecomeMainWindow]
1499 }
1500
makeMainWindow(self)1501 unsafe fn makeMainWindow(self) {
1502 msg_send![self, makeMainWindow]
1503 }
1504
1505 // Managing Toolbars
1506
toolbar(self) -> id1507 unsafe fn toolbar(self) -> id /* NSToolbar */ {
1508 msg_send![self, toolbar]
1509 }
1510
setToolbar_(self, toolbar: id )1511 unsafe fn setToolbar_(self, toolbar: id /* NSToolbar */) {
1512 msg_send![self, setToolbar:toolbar]
1513 }
1514
runToolbarCustomizationPalette(self, sender: id)1515 unsafe fn runToolbarCustomizationPalette(self, sender: id) {
1516 msg_send![self, runToolbarCustomizationPalette:sender]
1517 }
1518
1519 // TODO: Managing Attached Windows
1520 // TODO: Managing Window Buffers
1521 // TODO: Managing Default Buttons
1522 // TODO: Managing Field Editors
1523 // TODO: Managing the Window Menu
1524 // TODO: Managing Cursor Rectangles
1525
1526 // Managing Title Bars
1527
standardWindowButton_(self, windowButtonKind: NSWindowButton) -> id1528 unsafe fn standardWindowButton_(self, windowButtonKind: NSWindowButton) -> id {
1529 msg_send![self, standardWindowButton:windowButtonKind]
1530 }
1531
1532 // Managing Window Tabs
allowsAutomaticWindowTabbing(_: Self) -> BOOL1533 unsafe fn allowsAutomaticWindowTabbing(_: Self) -> BOOL {
1534 msg_send![class!(NSWindow), allowsAutomaticWindowTabbing]
1535 }
1536
setAllowsAutomaticWindowTabbing_(_: Self, allowsAutomaticWindowTabbing: BOOL)1537 unsafe fn setAllowsAutomaticWindowTabbing_(_: Self, allowsAutomaticWindowTabbing: BOOL) {
1538 msg_send![class!(NSWindow), setAllowsAutomaticWindowTabbing:allowsAutomaticWindowTabbing]
1539 }
1540
tabbingIdentifier(self) -> id1541 unsafe fn tabbingIdentifier(self) -> id {
1542 msg_send![self, tabbingIdentifier]
1543 }
1544
tabbingMode(self) -> NSWindowTabbingMode1545 unsafe fn tabbingMode(self) -> NSWindowTabbingMode {
1546 msg_send!(self, tabbingMode)
1547 }
1548
setTabbingMode_(self, tabbingMode: NSWindowTabbingMode)1549 unsafe fn setTabbingMode_(self, tabbingMode: NSWindowTabbingMode) {
1550 msg_send![self, setTabbingMode: tabbingMode]
1551 }
1552
addTabbedWindow_ordered_(self, window: id, ordering_mode: NSWindowOrderingMode)1553 unsafe fn addTabbedWindow_ordered_(self, window: id, ordering_mode: NSWindowOrderingMode) {
1554 msg_send![self, addTabbedWindow:window ordered: ordering_mode]
1555 }
1556
toggleTabBar_(self, sender: id)1557 unsafe fn toggleTabBar_(self, sender: id) {
1558 msg_send![self, toggleTabBar:sender]
1559 }
1560 // TODO: Managing Tooltips
1561 // TODO: Handling Events
1562
1563 // Managing Responders
1564
initialFirstResponder(self) -> id1565 unsafe fn initialFirstResponder(self) -> id {
1566 msg_send![self, initialFirstResponder]
1567 }
1568
firstResponder(self) -> id1569 unsafe fn firstResponder(self) -> id {
1570 msg_send![self, firstResponder]
1571 }
1572
setInitialFirstResponder_(self, responder: id)1573 unsafe fn setInitialFirstResponder_(self, responder: id) {
1574 msg_send![self, setInitialFirstResponder:responder]
1575 }
1576
makeFirstResponder_(self, responder: id) -> BOOL1577 unsafe fn makeFirstResponder_(self, responder: id) -> BOOL {
1578 msg_send![self, makeFirstResponder:responder]
1579 }
1580
1581 // TODO: Managing the Key View Loop
1582
1583 // Handling Keyboard Events
1584
keyDown_(self, event: id)1585 unsafe fn keyDown_(self, event: id) {
1586 msg_send![self, keyDown:event]
1587 }
1588
1589 // Handling Mouse Events
1590
acceptsMouseMovedEvents(self) -> BOOL1591 unsafe fn acceptsMouseMovedEvents(self) -> BOOL {
1592 msg_send![self, acceptsMouseMovedEvents]
1593 }
1594
ignoresMouseEvents(self) -> BOOL1595 unsafe fn ignoresMouseEvents(self) -> BOOL {
1596 msg_send![self, ignoresMouseEvents]
1597 }
1598
setIgnoresMouseEvents_(self, ignoreMouseEvents: BOOL)1599 unsafe fn setIgnoresMouseEvents_(self, ignoreMouseEvents: BOOL) {
1600 msg_send![self, setIgnoresMouseEvents:ignoreMouseEvents]
1601 }
1602
mouseLocationOutsideOfEventStream(self) -> NSPoint1603 unsafe fn mouseLocationOutsideOfEventStream(self) -> NSPoint {
1604 msg_send![self, mouseLocationOutsideOfEventStream]
1605 }
1606
setAcceptsMouseMovedEvents_(self, acceptMouseMovedEvents: BOOL)1607 unsafe fn setAcceptsMouseMovedEvents_(self, acceptMouseMovedEvents: BOOL) {
1608 msg_send![self, setAcceptsMouseMovedEvents:acceptMouseMovedEvents]
1609 }
1610
windowNumberAtPoint_belowWindowWithWindowNumber_(self, point: NSPoint, windowNumber: NSInteger) -> NSInteger1611 unsafe fn windowNumberAtPoint_belowWindowWithWindowNumber_(self,
1612 point: NSPoint,
1613 windowNumber: NSInteger) -> NSInteger {
1614 msg_send![self, windowNumberAtPoint:point belowWindowWithWindowNumber:windowNumber]
1615 }
1616
1617 // Converting Coordinates
1618
backingScaleFactor(self) -> CGFloat1619 unsafe fn backingScaleFactor(self) -> CGFloat {
1620 msg_send![self, backingScaleFactor]
1621 }
1622
backingAlignedRect_options_(self, rect: NSRect, options: NSAlignmentOptions) -> NSRect1623 unsafe fn backingAlignedRect_options_(self, rect: NSRect, options: NSAlignmentOptions) -> NSRect {
1624 msg_send![self, backingAlignedRect:rect options:options]
1625 }
1626
convertRectFromBacking_(self, rect: NSRect) -> NSRect1627 unsafe fn convertRectFromBacking_(self, rect: NSRect) -> NSRect {
1628 msg_send![self, convertRectFromBacking:rect]
1629 }
1630
convertRectToBacking_(self, rect: NSRect) -> NSRect1631 unsafe fn convertRectToBacking_(self, rect: NSRect) -> NSRect {
1632 msg_send![self, convertRectToBacking:rect]
1633 }
1634
convertRectToScreen_(self, rect: NSRect) -> NSRect1635 unsafe fn convertRectToScreen_(self, rect: NSRect) -> NSRect {
1636 msg_send![self, convertRectToScreen:rect]
1637 }
1638
convertRectFromScreen_(self, rect: NSRect) -> NSRect1639 unsafe fn convertRectFromScreen_(self, rect: NSRect) -> NSRect {
1640 msg_send![self, convertRectFromScreen:rect]
1641 }
1642
1643 // Accessing Edited Status
1644
setDocumentEdited_(self, documentEdited: BOOL)1645 unsafe fn setDocumentEdited_(self, documentEdited: BOOL) {
1646 msg_send![self, setDocumentEdited:documentEdited]
1647 }
1648
1649 // Managing Titles
1650
title(self) -> id1651 unsafe fn title(self) -> id {
1652 msg_send![self, title]
1653 }
1654
setTitle_(self, title: id)1655 unsafe fn setTitle_(self, title: id) {
1656 msg_send![self, setTitle:title]
1657 }
1658
setTitleWithRepresentedFilename_(self, filePath: id)1659 unsafe fn setTitleWithRepresentedFilename_(self, filePath: id) {
1660 msg_send![self, setTitleWithRepresentedFilename:filePath]
1661 }
1662
setTitleVisibility_(self, visibility: NSWindowTitleVisibility)1663 unsafe fn setTitleVisibility_(self, visibility: NSWindowTitleVisibility) {
1664 msg_send![self, setTitleVisibility:visibility]
1665 }
1666
setTitlebarAppearsTransparent_(self, transparent: BOOL)1667 unsafe fn setTitlebarAppearsTransparent_(self, transparent: BOOL) {
1668 msg_send![self, setTitlebarAppearsTransparent:transparent]
1669 }
1670
representedFilename(self) -> id1671 unsafe fn representedFilename(self) -> id {
1672 msg_send![self, representedFilename]
1673 }
1674
setRepresentedFilename_(self, filePath: id)1675 unsafe fn setRepresentedFilename_(self, filePath: id) {
1676 msg_send![self, setRepresentedFilename:filePath]
1677 }
1678
representedURL(self) -> id1679 unsafe fn representedURL(self) -> id {
1680 msg_send![self, representedURL]
1681 }
1682
setRepresentedURL_(self, representedURL: id)1683 unsafe fn setRepresentedURL_(self, representedURL: id) {
1684 msg_send![self, setRepresentedURL:representedURL]
1685 }
1686
1687 // Accessing Screen Information
1688
screen(self) -> id1689 unsafe fn screen(self) -> id {
1690 msg_send![self, screen]
1691 }
1692
deepestScreen(self) -> id1693 unsafe fn deepestScreen(self) -> id {
1694 msg_send![self, deepestScreen]
1695 }
1696
displaysWhenScreenProfileChanges(self) -> BOOL1697 unsafe fn displaysWhenScreenProfileChanges(self) -> BOOL {
1698 msg_send![self, displaysWhenScreenProfileChanges]
1699 }
1700
setDisplaysWhenScreenProfileChanges_(self, displaysWhenScreenProfileChanges: BOOL)1701 unsafe fn setDisplaysWhenScreenProfileChanges_(self, displaysWhenScreenProfileChanges: BOOL) {
1702 msg_send![self, setDisplaysWhenScreenProfileChanges:displaysWhenScreenProfileChanges]
1703 }
1704
1705 // Moving Windows
1706
setMovableByWindowBackground_(self, movableByWindowBackground: BOOL)1707 unsafe fn setMovableByWindowBackground_(self, movableByWindowBackground: BOOL) {
1708 msg_send![self, setMovableByWindowBackground:movableByWindowBackground]
1709 }
1710
setMovable_(self, movable: BOOL)1711 unsafe fn setMovable_(self, movable: BOOL) {
1712 msg_send![self, setMovable:movable]
1713 }
1714
center(self)1715 unsafe fn center(self) {
1716 msg_send![self, center]
1717 }
1718
1719 // Closing Windows
1720
performClose_(self, sender: id)1721 unsafe fn performClose_(self, sender: id) {
1722 msg_send![self, performClose:sender]
1723 }
1724
close(self)1725 unsafe fn close(self) {
1726 msg_send![self, close]
1727 }
1728
setReleasedWhenClosed_(self, releasedWhenClosed: BOOL)1729 unsafe fn setReleasedWhenClosed_(self, releasedWhenClosed: BOOL) {
1730 msg_send![self, setReleasedWhenClosed:releasedWhenClosed]
1731 }
1732
1733 // Minimizing Windows
1734
performMiniaturize_(self, sender: id)1735 unsafe fn performMiniaturize_(self, sender: id) {
1736 msg_send![self, performMiniaturize:sender]
1737 }
1738
miniaturize_(self, sender: id)1739 unsafe fn miniaturize_(self, sender: id) {
1740 msg_send![self, miniaturize:sender]
1741 }
1742
deminiaturize_(self, sender: id)1743 unsafe fn deminiaturize_(self, sender: id) {
1744 msg_send![self, deminiaturize:sender]
1745 }
1746
miniwindowImage(self) -> id1747 unsafe fn miniwindowImage(self) -> id {
1748 msg_send![self, miniwindowImage]
1749 }
1750
setMiniwindowImage_(self, miniwindowImage: id)1751 unsafe fn setMiniwindowImage_(self, miniwindowImage: id) {
1752 msg_send![self, setMiniwindowImage:miniwindowImage]
1753 }
1754
miniwindowTitle(self) -> id1755 unsafe fn miniwindowTitle(self) -> id {
1756 msg_send![self, miniwindowTitle]
1757 }
1758
setMiniwindowTitle_(self, miniwindowTitle: id)1759 unsafe fn setMiniwindowTitle_(self, miniwindowTitle: id) {
1760 msg_send![self, setMiniwindowTitle:miniwindowTitle]
1761 }
1762
1763 // TODO: Getting the Dock Tile
1764 // TODO: Printing Windows
1765 // TODO: Providing Services
1766 // TODO: Working with Carbon
1767 // TODO: Triggering Constraint-Based Layout
1768 // TODO: Debugging Constraint-Based Layout
1769 // TODO: Constraint-Based Layouts
1770 }
1771
1772 pub trait NSView: Sized {
alloc(_: Self) -> id1773 unsafe fn alloc(_: Self) -> id {
1774 msg_send![class!(NSView), alloc]
1775 }
1776
init(self) -> id1777 unsafe fn init(self) -> id;
initWithFrame_(self, frameRect: NSRect) -> id1778 unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
bounds(self) -> NSRect1779 unsafe fn bounds(self) -> NSRect;
frame(self) -> NSRect1780 unsafe fn frame(self) -> NSRect;
display_(self)1781 unsafe fn display_(self);
setWantsBestResolutionOpenGLSurface_(self, flag: BOOL)1782 unsafe fn setWantsBestResolutionOpenGLSurface_(self, flag: BOOL);
convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint1783 unsafe fn convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint;
addSubview_(self, view: id)1784 unsafe fn addSubview_(self, view: id);
superview(self) -> id1785 unsafe fn superview(self) -> id;
removeFromSuperview(self)1786 unsafe fn removeFromSuperview(self);
setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions)1787 unsafe fn setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions);
1788
wantsLayer(self) -> BOOL1789 unsafe fn wantsLayer(self) -> BOOL;
setWantsLayer(self, wantsLayer: BOOL)1790 unsafe fn setWantsLayer(self, wantsLayer: BOOL);
layer(self) -> id1791 unsafe fn layer(self) -> id;
setLayer(self, layer: id)1792 unsafe fn setLayer(self, layer: id);
1793
widthAnchor(self) -> id1794 unsafe fn widthAnchor(self) -> id;
heightAnchor(self) -> id1795 unsafe fn heightAnchor(self) -> id;
convertRectToBacking(self, rect: NSRect) -> NSRect1796 unsafe fn convertRectToBacking(self, rect: NSRect) -> NSRect;
1797 }
1798
1799 impl NSView for id {
init(self) -> id1800 unsafe fn init(self) -> id {
1801 msg_send![self, init]
1802 }
1803
initWithFrame_(self, frameRect: NSRect) -> id1804 unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
1805 msg_send![self, initWithFrame:frameRect]
1806 }
1807
bounds(self) -> NSRect1808 unsafe fn bounds(self) -> NSRect {
1809 msg_send![self, bounds]
1810 }
1811
frame(self) -> NSRect1812 unsafe fn frame(self) -> NSRect {
1813 msg_send![self, frame]
1814 }
1815
display_(self)1816 unsafe fn display_(self) {
1817 msg_send![self, display]
1818 }
1819
setWantsBestResolutionOpenGLSurface_(self, flag: BOOL)1820 unsafe fn setWantsBestResolutionOpenGLSurface_(self, flag: BOOL) {
1821 msg_send![self, setWantsBestResolutionOpenGLSurface:flag]
1822 }
1823
convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint1824 unsafe fn convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint {
1825 msg_send![self, convertPoint:point fromView:view]
1826 }
1827
addSubview_(self, view: id)1828 unsafe fn addSubview_(self, view: id) {
1829 msg_send![self, addSubview:view]
1830 }
1831
superview(self) -> id1832 unsafe fn superview(self) -> id {
1833 msg_send![self, superview]
1834 }
1835
removeFromSuperview(self)1836 unsafe fn removeFromSuperview(self) {
1837 msg_send![self, removeFromSuperview]
1838 }
1839
setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions)1840 unsafe fn setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions) {
1841 msg_send![self, setAutoresizingMask:autoresizingMask]
1842 }
1843
wantsLayer(self) -> BOOL1844 unsafe fn wantsLayer(self) -> BOOL {
1845 msg_send![self, wantsLayer]
1846 }
1847
setWantsLayer(self, wantsLayer: BOOL)1848 unsafe fn setWantsLayer(self, wantsLayer: BOOL) {
1849 msg_send![self, setWantsLayer:wantsLayer]
1850 }
1851
layer(self) -> id1852 unsafe fn layer(self) -> id {
1853 msg_send![self, layer]
1854 }
1855
setLayer(self, layer: id)1856 unsafe fn setLayer(self, layer: id) {
1857 msg_send![self, setLayer:layer]
1858 }
1859
widthAnchor(self) -> id1860 unsafe fn widthAnchor(self) -> id {
1861 msg_send![self, widthAnchor]
1862 }
1863
heightAnchor(self) -> id1864 unsafe fn heightAnchor(self) -> id {
1865 msg_send![self, heightAnchor]
1866 }
1867
convertRectToBacking(self, rect: NSRect) -> NSRect1868 unsafe fn convertRectToBacking(self, rect: NSRect) -> NSRect {
1869 msg_send![self, convertRectToBacking:rect]
1870 }
1871 }
1872
1873 pub type NSAutoresizingMaskOptions = u64;
1874
1875 pub const NSViewNotSizable: u64 = 0;
1876 pub const NSViewMinXMargin: u64 = 1;
1877 pub const NSViewWidthSizable: u64 = 2;
1878 pub const NSViewMaxXMargin: u64 = 4;
1879 pub const NSViewMinYMargin: u64 = 8;
1880 pub const NSViewHeightSizable: u64 = 16;
1881 pub const NSViewMaxYMargin: u64 = 32;
1882
1883 pub trait NSOpenGLView: Sized {
alloc(_: Self) -> id1884 unsafe fn alloc(_: Self) -> id {
1885 msg_send![class!(NSOpenGLView), alloc]
1886 }
1887
initWithFrame_pixelFormat_(self, frameRect: NSRect, format: id) -> id1888 unsafe fn initWithFrame_pixelFormat_(self, frameRect: NSRect, format: id) -> id;
display_(self)1889 unsafe fn display_(self);
setOpenGLContext_(self, context: id)1890 unsafe fn setOpenGLContext_(self, context: id);
setPixelFormat_(self, pixelformat: id)1891 unsafe fn setPixelFormat_(self, pixelformat: id);
1892 }
1893
1894 impl NSOpenGLView for id {
initWithFrame_pixelFormat_(self, frameRect: NSRect, format: id) -> id1895 unsafe fn initWithFrame_pixelFormat_(self, frameRect: NSRect, format: id) -> id {
1896 msg_send![self, initWithFrame:frameRect pixelFormat:format]
1897 }
1898
display_(self)1899 unsafe fn display_(self) {
1900 msg_send![self, display]
1901 }
1902
setOpenGLContext_(self, context: id)1903 unsafe fn setOpenGLContext_(self, context: id) {
1904 msg_send![self, setOpenGLContext:context]
1905 }
1906
setPixelFormat_(self, pixelformat: id)1907 unsafe fn setPixelFormat_(self, pixelformat: id) {
1908 msg_send![self, setPixelFormat:pixelformat]
1909 }
1910 }
1911
1912 pub trait NSOpenGLPixelFormat: Sized {
alloc(_: Self) -> id1913 unsafe fn alloc(_: Self) -> id {
1914 msg_send![class!(NSOpenGLPixelFormat), alloc]
1915 }
1916
1917 // Creating an NSOpenGLPixelFormat Object
1918
initWithAttributes_(self, attributes: &[u32]) -> id1919 unsafe fn initWithAttributes_(self, attributes: &[u32]) -> id;
1920
1921 // Managing the Pixel Format
1922
getValues_forAttribute_forVirtualScreen_(self, val: *mut GLint, attrib: NSOpenGLPixelFormatAttribute, screen: GLint)1923 unsafe fn getValues_forAttribute_forVirtualScreen_(self, val: *mut GLint, attrib: NSOpenGLPixelFormatAttribute, screen: GLint);
numberOfVirtualScreens(self) -> GLint1924 unsafe fn numberOfVirtualScreens(self) -> GLint;
1925
1926 }
1927
1928 impl NSOpenGLPixelFormat for id {
1929 // Creating an NSOpenGLPixelFormat Object
1930
initWithAttributes_(self, attributes: &[u32]) -> id1931 unsafe fn initWithAttributes_(self, attributes: &[u32]) -> id {
1932 msg_send![self, initWithAttributes:attributes]
1933 }
1934
1935 // Managing the Pixel Format
1936
getValues_forAttribute_forVirtualScreen_(self, val: *mut GLint, attrib: NSOpenGLPixelFormatAttribute, screen: GLint)1937 unsafe fn getValues_forAttribute_forVirtualScreen_(self, val: *mut GLint, attrib: NSOpenGLPixelFormatAttribute, screen: GLint) {
1938 msg_send![self, getValues:val forAttribute:attrib forVirtualScreen:screen]
1939 }
1940
numberOfVirtualScreens(self) -> GLint1941 unsafe fn numberOfVirtualScreens(self) -> GLint {
1942 msg_send![self, numberOfVirtualScreens]
1943 }
1944 }
1945
1946 pub trait NSOpenGLContext: Sized {
alloc(_: Self) -> id1947 unsafe fn alloc(_: Self) -> id {
1948 msg_send![class!(NSOpenGLContext), alloc]
1949 }
1950
1951 // Context Creation
initWithFormat_shareContext_(self, format: id , shareContext: id ) -> id1952 unsafe fn initWithFormat_shareContext_(self, format: id /* (NSOpenGLPixelFormat *) */, shareContext: id /* (NSOpenGLContext *) */) -> id /* (instancetype) */;
initWithCGLContextObj_(self, context: CGLContextObj) -> id1953 unsafe fn initWithCGLContextObj_(self, context: CGLContextObj) -> id /* (instancetype) */;
1954
1955 // Managing the Current Context
clearCurrentContext(_: Self)1956 unsafe fn clearCurrentContext(_: Self);
currentContext(_: Self) -> id1957 unsafe fn currentContext(_: Self) -> id /* (NSOpenGLContext *) */;
makeCurrentContext(self)1958 unsafe fn makeCurrentContext(self);
1959
1960 // Drawable Object Management
setView_(self, view: id )1961 unsafe fn setView_(self, view: id /* (NSView *) */);
view(self) -> id1962 unsafe fn view(self) -> id /* (NSView *) */;
clearDrawable(self)1963 unsafe fn clearDrawable(self);
update(self)1964 unsafe fn update(self);
1965
1966 // Flushing the Drawing Buffer
flushBuffer(self)1967 unsafe fn flushBuffer(self);
1968
1969 // Context Parameter Handling
setValues_forParameter_(self, vals: *const GLint, param: NSOpenGLContextParameter)1970 unsafe fn setValues_forParameter_(self, vals: *const GLint, param: NSOpenGLContextParameter);
getValues_forParameter_(self, vals: *mut GLint, param: NSOpenGLContextParameter)1971 unsafe fn getValues_forParameter_(self, vals: *mut GLint, param: NSOpenGLContextParameter);
1972
1973 // Working with Virtual Screens
setCurrentVirtualScreen_(self, screen: GLint)1974 unsafe fn setCurrentVirtualScreen_(self, screen: GLint);
currentVirtualScreen(self) -> GLint1975 unsafe fn currentVirtualScreen(self) -> GLint;
1976
1977 // Getting the CGL Context Object
CGLContextObj(self) -> CGLContextObj1978 unsafe fn CGLContextObj(self) -> CGLContextObj;
1979 }
1980
1981 impl NSOpenGLContext for id {
1982 // Context Creation
1983
initWithFormat_shareContext_(self, format: id , shareContext: id ) -> id1984 unsafe fn initWithFormat_shareContext_(self, format: id /* (NSOpenGLPixelFormat *) */, shareContext: id /* (NSOpenGLContext *) */) -> id /* (instancetype) */ {
1985 msg_send![self, initWithFormat:format shareContext:shareContext]
1986 }
1987
initWithCGLContextObj_(self, context: CGLContextObj) -> id1988 unsafe fn initWithCGLContextObj_(self, context: CGLContextObj) -> id /* (instancetype) */ {
1989 msg_send![self, initWithCGLContextObj:context]
1990 }
1991
1992 // Managing the Current Context
1993
clearCurrentContext(_: Self)1994 unsafe fn clearCurrentContext(_: Self) {
1995 msg_send![class!(NSOpenGLContext), clearCurrentContext]
1996 }
1997
currentContext(_: Self) -> id1998 unsafe fn currentContext(_: Self) -> id /* (NSOpenGLContext *) */ {
1999 msg_send![class!(NSOpenGLContext), currentContext]
2000 }
2001
makeCurrentContext(self)2002 unsafe fn makeCurrentContext(self) {
2003 msg_send![self, makeCurrentContext]
2004 }
2005
2006 // Drawable Object Management
2007
setView_(self, view: id )2008 unsafe fn setView_(self, view: id /* (NSView *) */) {
2009 msg_send![self, setView:view]
2010 }
2011
view(self) -> id2012 unsafe fn view(self) -> id /* (NSView *) */ {
2013 msg_send![self, view]
2014 }
2015
clearDrawable(self)2016 unsafe fn clearDrawable(self) {
2017 msg_send![self, clearDrawable]
2018 }
2019
update(self)2020 unsafe fn update(self) {
2021 msg_send![self, update]
2022 }
2023
2024 // Flushing the Drawing Buffer
2025
flushBuffer(self)2026 unsafe fn flushBuffer(self) {
2027 msg_send![self, flushBuffer]
2028 }
2029
2030 // Context Parameter Handling
2031
setValues_forParameter_(self, vals: *const GLint, param: NSOpenGLContextParameter)2032 unsafe fn setValues_forParameter_(self, vals: *const GLint, param: NSOpenGLContextParameter) {
2033 msg_send![self, setValues:vals forParameter:param]
2034 }
2035
getValues_forParameter_(self, vals: *mut GLint, param: NSOpenGLContextParameter)2036 unsafe fn getValues_forParameter_(self, vals: *mut GLint, param: NSOpenGLContextParameter) {
2037 msg_send![self, getValues:vals forParameter:param]
2038 }
2039
2040 // Working with Virtual Screens
2041
setCurrentVirtualScreen_(self, screen: GLint)2042 unsafe fn setCurrentVirtualScreen_(self, screen: GLint) {
2043 msg_send![self, setCurrentVirtualScreen:screen]
2044 }
2045
currentVirtualScreen(self) -> GLint2046 unsafe fn currentVirtualScreen(self) -> GLint {
2047 msg_send![self, currentVirtualScreen]
2048 }
2049
2050 // Getting the CGL Context Object
2051
CGLContextObj(self) -> CGLContextObj2052 unsafe fn CGLContextObj(self) -> CGLContextObj {
2053 msg_send![self, CGLContextObj]
2054 }
2055 }
2056
2057 bitflags! {
2058 pub struct NSEventSwipeTrackingOptions: NSUInteger {
2059 const NSEventSwipeTrackingLockDirection = 0x1 << 0;
2060 const NSEventSwipeTrackingClampGestureAmount = 0x1 << 1;
2061 }
2062 }
2063
2064 #[repr(i64)] // NSInteger
2065 pub enum NSEventGestureAxis {
2066 NSEventGestureAxisNone = 0,
2067 NSEventGestureAxisHorizontal,
2068 NSEventGestureAxisVertical,
2069 }
2070
2071 bitflags! {
2072 pub struct NSEventPhase: NSUInteger {
2073 const NSEventPhaseNone = 0;
2074 const NSEventPhaseBegan = 0x1 << 0;
2075 const NSEventPhaseStationary = 0x1 << 1;
2076 const NSEventPhaseChanged = 0x1 << 2;
2077 const NSEventPhaseEnded = 0x1 << 3;
2078 const NSEventPhaseCancelled = 0x1 << 4;
2079 const NSEventPhaseMayBegin = 0x1 << 5;
2080 }
2081 }
2082
2083 bitflags! {
2084 pub struct NSTouchPhase: NSUInteger {
2085 const NSTouchPhaseBegan = 1 << 0;
2086 const NSTouchPhaseMoved = 1 << 1;
2087 const NSTouchPhaseStationary = 1 << 2;
2088 const NSTouchPhaseEnded = 1 << 3;
2089 const NSTouchPhaseCancelled = 1 << 4;
2090 const NSTouchPhaseTouching = NSTouchPhase::NSTouchPhaseBegan.bits
2091 | NSTouchPhase::NSTouchPhaseMoved.bits
2092 | NSTouchPhase::NSTouchPhaseStationary.bits;
2093 const NSTouchPhaseAny = !0; // NSUIntegerMax
2094 }
2095 }
2096
2097 #[derive(Clone, Copy, Debug, PartialEq)]
2098 #[repr(u64)] // NSUInteger
2099 pub enum NSEventType {
2100 NSLeftMouseDown = 1,
2101 NSLeftMouseUp = 2,
2102 NSRightMouseDown = 3,
2103 NSRightMouseUp = 4,
2104 NSMouseMoved = 5,
2105 NSLeftMouseDragged = 6,
2106 NSRightMouseDragged = 7,
2107 NSMouseEntered = 8,
2108 NSMouseExited = 9,
2109 NSKeyDown = 10,
2110 NSKeyUp = 11,
2111 NSFlagsChanged = 12,
2112 NSAppKitDefined = 13,
2113 NSSystemDefined = 14,
2114 NSApplicationDefined = 15,
2115 NSPeriodic = 16,
2116 NSCursorUpdate = 17,
2117 NSScrollWheel = 22,
2118 NSTabletPoint = 23,
2119 NSTabletProximity = 24,
2120 NSOtherMouseDown = 25,
2121 NSOtherMouseUp = 26,
2122 NSOtherMouseDragged = 27,
2123 NSEventTypeGesture = 29,
2124 NSEventTypeMagnify = 30,
2125 NSEventTypeSwipe = 31,
2126 NSEventTypeRotate = 18,
2127 NSEventTypeBeginGesture = 19,
2128 NSEventTypeEndGesture = 20,
2129 NSEventTypePressure = 34,
2130 }
2131
2132 bitflags! {
2133 pub struct NSEventMask: libc::c_ulonglong {
2134 const NSLeftMouseDownMask = 1 << NSLeftMouseDown as libc::c_ulonglong;
2135 const NSLeftMouseUpMask = 1 << NSLeftMouseUp as libc::c_ulonglong;
2136 const NSRightMouseDownMask = 1 << NSRightMouseDown as libc::c_ulonglong;
2137 const NSRightMouseUpMask = 1 << NSRightMouseUp as libc::c_ulonglong;
2138 const NSMouseMovedMask = 1 << NSMouseMoved as libc::c_ulonglong;
2139 const NSLeftMouseDraggedMask = 1 << NSLeftMouseDragged as libc::c_ulonglong;
2140 const NSRightMouseDraggedMask = 1 << NSRightMouseDragged as libc::c_ulonglong;
2141 const NSMouseEnteredMask = 1 << NSMouseEntered as libc::c_ulonglong;
2142 const NSMouseExitedMask = 1 << NSMouseExited as libc::c_ulonglong;
2143 const NSKeyDownMask = 1 << NSKeyDown as libc::c_ulonglong;
2144 const NSKeyUpMask = 1 << NSKeyUp as libc::c_ulonglong;
2145 const NSFlagsChangedMask = 1 << NSFlagsChanged as libc::c_ulonglong;
2146 const NSAppKitDefinedMask = 1 << NSAppKitDefined as libc::c_ulonglong;
2147 const NSSystemDefinedMask = 1 << NSSystemDefined as libc::c_ulonglong;
2148 const NSApplicationDefinedMask = 1 << NSApplicationDefined as libc::c_ulonglong;
2149 const NSPeriodicMask = 1 << NSPeriodic as libc::c_ulonglong;
2150 const NSCursorUpdateMask = 1 << NSCursorUpdate as libc::c_ulonglong;
2151 const NSScrollWheelMask = 1 << NSScrollWheel as libc::c_ulonglong;
2152 const NSTabletPointMask = 1 << NSTabletPoint as libc::c_ulonglong;
2153 const NSTabletProximityMask = 1 << NSTabletProximity as libc::c_ulonglong;
2154 const NSOtherMouseDownMask = 1 << NSOtherMouseDown as libc::c_ulonglong;
2155 const NSOtherMouseUpMask = 1 << NSOtherMouseUp as libc::c_ulonglong;
2156 const NSOtherMouseDraggedMask = 1 << NSOtherMouseDragged as libc::c_ulonglong;
2157 const NSEventMaskGesture = 1 << NSEventTypeGesture as libc::c_ulonglong;
2158 const NSEventMaskSwipe = 1 << NSEventTypeSwipe as libc::c_ulonglong;
2159 const NSEventMaskRotate = 1 << NSEventTypeRotate as libc::c_ulonglong;
2160 const NSEventMaskBeginGesture = 1 << NSEventTypeBeginGesture as libc::c_ulonglong;
2161 const NSEventMaskEndGesture = 1 << NSEventTypeEndGesture as libc::c_ulonglong;
2162 const NSEventMaskPressure = 1 << NSEventTypePressure as libc::c_ulonglong;
2163 const NSAnyEventMask = 0xffffffffffffffff;
2164 }
2165 }
2166
2167 impl NSEventMask {
from_type(ty: NSEventType) -> NSEventMask2168 pub fn from_type(ty: NSEventType) -> NSEventMask {
2169 NSEventMask { bits: 1 << ty as libc::c_ulonglong }
2170 }
2171 }
2172
2173 bitflags! {
2174 pub struct NSEventModifierFlags: NSUInteger {
2175 const NSAlphaShiftKeyMask = 1 << 16;
2176 const NSShiftKeyMask = 1 << 17;
2177 const NSControlKeyMask = 1 << 18;
2178 const NSAlternateKeyMask = 1 << 19;
2179 const NSCommandKeyMask = 1 << 20;
2180 const NSNumericPadKeyMask = 1 << 21;
2181 const NSHelpKeyMask = 1 << 22;
2182 const NSFunctionKeyMask = 1 << 23;
2183 const NSDeviceIndependentModifierFlagsMask = 0xffff0000;
2184 }
2185 }
2186
2187 // Not sure of the type here
2188 pub enum NSPointingDeviceType {
2189 // TODO: Not sure what these values are
2190 // NSUnknownPointingDevice = NX_TABLET_POINTER_UNKNOWN,
2191 // NSPenPointingDevice = NX_TABLET_POINTER_PEN,
2192 // NSCursorPointingDevice = NX_TABLET_POINTER_CURSOR,
2193 // NSEraserPointingDevice = NX_TABLET_POINTER_ERASER,
2194 }
2195
2196 // Not sure of the type here
2197 pub enum NSEventButtonMask {
2198 // TODO: Not sure what these values are
2199 // NSPenTipMask = NX_TABLET_BUTTON_PENTIPMASK,
2200 // NSPenLowerSideMask = NX_TABLET_BUTTON_PENLOWERSIDEMASK,
2201 // NSPenUpperSideMask = NX_TABLET_BUTTON_PENUPPERSIDEMASK,
2202 }
2203
2204 #[repr(i16)]
2205 pub enum NSEventSubtype {
2206 // TODO: Not sure what these values are
2207 // NSMouseEventSubtype = NX_SUBTYPE_DEFAULT,
2208 // NSTabletPointEventSubtype = NX_SUBTYPE_TABLET_POINT,
2209 // NSTabletProximityEventSubtype = NX_SUBTYPE_TABLET_PROXIMITY
2210 // NSTouchEventSubtype = NX_SUBTYPE_MOUSE_TOUCH,
2211 NSWindowExposedEventType = 0,
2212 NSApplicationActivatedEventType = 1,
2213 NSApplicationDeactivatedEventType = 2,
2214 NSWindowMovedEventType = 4,
2215 NSScreenChangedEventType = 8,
2216 NSAWTEventType = 16,
2217 }
2218
2219 pub const NSUpArrowFunctionKey: libc::c_ushort = 0xF700;
2220 pub const NSDownArrowFunctionKey: libc::c_ushort = 0xF701;
2221 pub const NSLeftArrowFunctionKey: libc::c_ushort = 0xF702;
2222 pub const NSRightArrowFunctionKey: libc::c_ushort = 0xF703;
2223 pub const NSF1FunctionKey: libc::c_ushort = 0xF704;
2224 pub const NSF2FunctionKey: libc::c_ushort = 0xF705;
2225 pub const NSF3FunctionKey: libc::c_ushort = 0xF706;
2226 pub const NSF4FunctionKey: libc::c_ushort = 0xF707;
2227 pub const NSF5FunctionKey: libc::c_ushort = 0xF708;
2228 pub const NSF6FunctionKey: libc::c_ushort = 0xF709;
2229 pub const NSF7FunctionKey: libc::c_ushort = 0xF70A;
2230 pub const NSF8FunctionKey: libc::c_ushort = 0xF70B;
2231 pub const NSF9FunctionKey: libc::c_ushort = 0xF70C;
2232 pub const NSF10FunctionKey: libc::c_ushort = 0xF70D;
2233 pub const NSF11FunctionKey: libc::c_ushort = 0xF70E;
2234 pub const NSF12FunctionKey: libc::c_ushort = 0xF70F;
2235 pub const NSF13FunctionKey: libc::c_ushort = 0xF710;
2236 pub const NSF14FunctionKey: libc::c_ushort = 0xF711;
2237 pub const NSF15FunctionKey: libc::c_ushort = 0xF712;
2238 pub const NSF16FunctionKey: libc::c_ushort = 0xF713;
2239 pub const NSF17FunctionKey: libc::c_ushort = 0xF714;
2240 pub const NSF18FunctionKey: libc::c_ushort = 0xF715;
2241 pub const NSF19FunctionKey: libc::c_ushort = 0xF716;
2242 pub const NSF20FunctionKey: libc::c_ushort = 0xF717;
2243 pub const NSF21FunctionKey: libc::c_ushort = 0xF718;
2244 pub const NSF22FunctionKey: libc::c_ushort = 0xF719;
2245 pub const NSF23FunctionKey: libc::c_ushort = 0xF71A;
2246 pub const NSF24FunctionKey: libc::c_ushort = 0xF71B;
2247 pub const NSF25FunctionKey: libc::c_ushort = 0xF71C;
2248 pub const NSF26FunctionKey: libc::c_ushort = 0xF71D;
2249 pub const NSF27FunctionKey: libc::c_ushort = 0xF71E;
2250 pub const NSF28FunctionKey: libc::c_ushort = 0xF71F;
2251 pub const NSF29FunctionKey: libc::c_ushort = 0xF720;
2252 pub const NSF30FunctionKey: libc::c_ushort = 0xF721;
2253 pub const NSF31FunctionKey: libc::c_ushort = 0xF722;
2254 pub const NSF32FunctionKey: libc::c_ushort = 0xF723;
2255 pub const NSF33FunctionKey: libc::c_ushort = 0xF724;
2256 pub const NSF34FunctionKey: libc::c_ushort = 0xF725;
2257 pub const NSF35FunctionKey: libc::c_ushort = 0xF726;
2258 pub const NSInsertFunctionKey: libc::c_ushort = 0xF727;
2259 pub const NSDeleteFunctionKey: libc::c_ushort = 0xF728;
2260 pub const NSHomeFunctionKey: libc::c_ushort = 0xF729;
2261 pub const NSBeginFunctionKey: libc::c_ushort = 0xF72A;
2262 pub const NSEndFunctionKey: libc::c_ushort = 0xF72B;
2263 pub const NSPageUpFunctionKey: libc::c_ushort = 0xF72C;
2264 pub const NSPageDownFunctionKey: libc::c_ushort = 0xF72D;
2265 pub const NSPrintScreenFunctionKey: libc::c_ushort = 0xF72E;
2266 pub const NSScrollLockFunctionKey: libc::c_ushort = 0xF72F;
2267 pub const NSPauseFunctionKey: libc::c_ushort = 0xF730;
2268 pub const NSSysReqFunctionKey: libc::c_ushort = 0xF731;
2269 pub const NSBreakFunctionKey: libc::c_ushort = 0xF732;
2270 pub const NSResetFunctionKey: libc::c_ushort = 0xF733;
2271 pub const NSStopFunctionKey: libc::c_ushort = 0xF734;
2272 pub const NSMenuFunctionKey: libc::c_ushort = 0xF735;
2273 pub const NSUserFunctionKey: libc::c_ushort = 0xF736;
2274 pub const NSSystemFunctionKey: libc::c_ushort = 0xF737;
2275 pub const NSPrintFunctionKey: libc::c_ushort = 0xF738;
2276 pub const NSClearLineFunctionKey: libc::c_ushort = 0xF739;
2277 pub const NSClearDisplayFunctionKey: libc::c_ushort = 0xF73A;
2278 pub const NSInsertLineFunctionKey: libc::c_ushort = 0xF73B;
2279 pub const NSDeleteLineFunctionKey: libc::c_ushort = 0xF73C;
2280 pub const NSInsertCharFunctionKey: libc::c_ushort = 0xF73D;
2281 pub const NSDeleteCharFunctionKey: libc::c_ushort = 0xF73E;
2282 pub const NSPrevFunctionKey: libc::c_ushort = 0xF73F;
2283 pub const NSNextFunctionKey: libc::c_ushort = 0xF740;
2284 pub const NSSelectFunctionKey: libc::c_ushort = 0xF741;
2285 pub const NSExecuteFunctionKey: libc::c_ushort = 0xF742;
2286 pub const NSUndoFunctionKey: libc::c_ushort = 0xF743;
2287 pub const NSRedoFunctionKey: libc::c_ushort = 0xF744;
2288 pub const NSFindFunctionKey: libc::c_ushort = 0xF745;
2289 pub const NSHelpFunctionKey: libc::c_ushort = 0xF746;
2290 pub const NSModeSwitchFunctionKey: libc::c_ushort = 0xF747;
2291
2292 pub trait NSEvent: Sized {
2293 // Creating Events
keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_( _: Self, eventType: NSEventType, location: NSPoint, modifierFlags: NSEventModifierFlags, timestamp: NSTimeInterval, windowNumber: NSInteger, context: id , characters: id , unmodCharacters: id , repeatKey: BOOL, code: libc::c_ushort) -> id2294 unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_(
2295 _: Self,
2296 eventType: NSEventType,
2297 location: NSPoint,
2298 modifierFlags: NSEventModifierFlags,
2299 timestamp: NSTimeInterval,
2300 windowNumber: NSInteger,
2301 context: id /* (NSGraphicsContext *) */,
2302 characters: id /* (NSString *) */,
2303 unmodCharacters: id /* (NSString *) */,
2304 repeatKey: BOOL,
2305 code: libc::c_ushort) -> id /* (NSEvent *) */;
mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_( _: Self, eventType: NSEventType, location: NSPoint, modifierFlags: NSEventModifierFlags, timestamp: NSTimeInterval, windowNumber: NSInteger, context: id , eventNumber: NSInteger, clickCount: NSInteger, pressure: libc::c_float) -> id2306 unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_(
2307 _: Self,
2308 eventType: NSEventType,
2309 location: NSPoint,
2310 modifierFlags: NSEventModifierFlags,
2311 timestamp: NSTimeInterval,
2312 windowNumber: NSInteger,
2313 context: id /* (NSGraphicsContext *) */,
2314 eventNumber: NSInteger,
2315 clickCount: NSInteger,
2316 pressure: libc::c_float) -> id /* (NSEvent *) */;
enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData_( _: Self, eventType: NSEventType, location: NSPoint, modifierFlags: NSEventModifierFlags, timestamp: NSTimeInterval, windowNumber: NSInteger, context: id , eventNumber: NSInteger, trackingNumber: NSInteger, userData: *mut c_void) -> id2317 unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData_(
2318 _: Self,
2319 eventType: NSEventType,
2320 location: NSPoint,
2321 modifierFlags: NSEventModifierFlags,
2322 timestamp: NSTimeInterval,
2323 windowNumber: NSInteger,
2324 context: id /* (NSGraphicsContext *) */,
2325 eventNumber: NSInteger,
2326 trackingNumber: NSInteger,
2327 userData: *mut c_void) -> id /* (NSEvent *) */;
otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_( _: Self, eventType: NSEventType, location: NSPoint, modifierFlags: NSEventModifierFlags, timestamp: NSTimeInterval, windowNumber: NSInteger, context: id , subtype: NSEventSubtype, data1: NSInteger, data2: NSInteger) -> id2328 unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(
2329 _: Self,
2330 eventType: NSEventType,
2331 location: NSPoint,
2332 modifierFlags: NSEventModifierFlags,
2333 timestamp: NSTimeInterval,
2334 windowNumber: NSInteger,
2335 context: id /* (NSGraphicsContext *) */,
2336 subtype: NSEventSubtype,
2337 data1: NSInteger,
2338 data2: NSInteger) -> id /* (NSEvent *) */;
eventWithEventRef_(_: Self, eventRef: *const c_void) -> id2339 unsafe fn eventWithEventRef_(_: Self, eventRef: *const c_void) -> id;
eventWithCGEvent_(_: Self, cgEvent: *mut c_void ) -> id2340 unsafe fn eventWithCGEvent_(_: Self, cgEvent: *mut c_void /* CGEventRef */) -> id;
2341
2342 // Getting General Event Information
context(self) -> id2343 unsafe fn context(self) -> id /* (NSGraphicsContext *) */;
locationInWindow(self) -> NSPoint2344 unsafe fn locationInWindow(self) -> NSPoint;
modifierFlags(self) -> NSEventModifierFlags2345 unsafe fn modifierFlags(self) -> NSEventModifierFlags;
timestamp(self) -> NSTimeInterval2346 unsafe fn timestamp(self) -> NSTimeInterval;
2347 // NOTE: renamed from `- type` due to Rust keyword collision
eventType(self) -> NSEventType2348 unsafe fn eventType(self) -> NSEventType;
window(self) -> id2349 unsafe fn window(self) -> id /* (NSWindow *) */;
windowNumber(self) -> NSInteger2350 unsafe fn windowNumber(self) -> NSInteger;
eventRef(self) -> *const c_void2351 unsafe fn eventRef(self) -> *const c_void;
CGEvent(self) -> *mut c_void2352 unsafe fn CGEvent(self) -> *mut c_void /* CGEventRef */;
2353
2354 // Getting Key Event Information
2355 // NOTE: renamed from `+ modifierFlags` due to conflict with `- modifierFlags`
currentModifierFlags(_: Self) -> NSEventModifierFlags2356 unsafe fn currentModifierFlags(_: Self) -> NSEventModifierFlags;
keyRepeatDelay(_: Self) -> NSTimeInterval2357 unsafe fn keyRepeatDelay(_: Self) -> NSTimeInterval;
keyRepeatInterval(_: Self) -> NSTimeInterval2358 unsafe fn keyRepeatInterval(_: Self) -> NSTimeInterval;
characters(self) -> id2359 unsafe fn characters(self) -> id /* (NSString *) */;
charactersIgnoringModifiers(self) -> id2360 unsafe fn charactersIgnoringModifiers(self) -> id /* (NSString *) */;
keyCode(self) -> libc::c_ushort2361 unsafe fn keyCode(self) -> libc::c_ushort;
isARepeat(self) -> BOOL2362 unsafe fn isARepeat(self) -> BOOL;
2363
2364 // Getting Mouse Event Information
pressedMouseButtons(_: Self) -> NSUInteger2365 unsafe fn pressedMouseButtons(_: Self) -> NSUInteger;
doubleClickInterval(_: Self) -> NSTimeInterval2366 unsafe fn doubleClickInterval(_: Self) -> NSTimeInterval;
mouseLocation(_: Self) -> NSPoint2367 unsafe fn mouseLocation(_: Self) -> NSPoint;
buttonNumber(self) -> NSInteger2368 unsafe fn buttonNumber(self) -> NSInteger;
clickCount(self) -> NSInteger2369 unsafe fn clickCount(self) -> NSInteger;
pressure(self) -> libc::c_float2370 unsafe fn pressure(self) -> libc::c_float;
stage(self) -> NSInteger2371 unsafe fn stage(self) -> NSInteger;
setMouseCoalescingEnabled_(_: Self, flag: BOOL)2372 unsafe fn setMouseCoalescingEnabled_(_: Self, flag: BOOL);
isMouseCoalescingEnabled(_: Self) -> BOOL2373 unsafe fn isMouseCoalescingEnabled(_: Self) -> BOOL;
2374
2375 // Getting Mouse-Tracking Event Information
eventNumber(self) -> NSInteger2376 unsafe fn eventNumber(self) -> NSInteger;
trackingNumber(self) -> NSInteger2377 unsafe fn trackingNumber(self) -> NSInteger;
trackingArea(self) -> id2378 unsafe fn trackingArea(self) -> id /* (NSTrackingArea *) */;
userData(self) -> *const c_void2379 unsafe fn userData(self) -> *const c_void;
2380
2381 // Getting Custom Event Information
data1(self) -> NSInteger2382 unsafe fn data1(self) -> NSInteger;
data2(self) -> NSInteger2383 unsafe fn data2(self) -> NSInteger;
subtype(self) -> NSEventSubtype2384 unsafe fn subtype(self) -> NSEventSubtype;
2385
2386 // Getting Scroll Wheel Event Information
deltaX(self) -> CGFloat2387 unsafe fn deltaX(self) -> CGFloat;
deltaY(self) -> CGFloat2388 unsafe fn deltaY(self) -> CGFloat;
deltaZ(self) -> CGFloat2389 unsafe fn deltaZ(self) -> CGFloat;
2390
2391 // Getting Tablet Proximity Information
capabilityMask(self) -> NSUInteger2392 unsafe fn capabilityMask(self) -> NSUInteger;
deviceID(self) -> NSUInteger2393 unsafe fn deviceID(self) -> NSUInteger;
pointingDeviceID(self) -> NSUInteger2394 unsafe fn pointingDeviceID(self) -> NSUInteger;
pointingDeviceSerialNumber(self) -> NSUInteger2395 unsafe fn pointingDeviceSerialNumber(self) -> NSUInteger;
pointingDeviceType(self) -> NSPointingDeviceType2396 unsafe fn pointingDeviceType(self) -> NSPointingDeviceType;
systemTabletID(self) -> NSUInteger2397 unsafe fn systemTabletID(self) -> NSUInteger;
tabletID(self) -> NSUInteger2398 unsafe fn tabletID(self) -> NSUInteger;
uniqueID(self) -> libc::c_ulonglong2399 unsafe fn uniqueID(self) -> libc::c_ulonglong;
vendorID(self) -> NSUInteger2400 unsafe fn vendorID(self) -> NSUInteger;
vendorPointingDeviceType(self) -> NSUInteger2401 unsafe fn vendorPointingDeviceType(self) -> NSUInteger;
2402
2403 // Getting Tablet Pointing Information
absoluteX(self) -> NSInteger2404 unsafe fn absoluteX(self) -> NSInteger;
absoluteY(self) -> NSInteger2405 unsafe fn absoluteY(self) -> NSInteger;
absoluteZ(self) -> NSInteger2406 unsafe fn absoluteZ(self) -> NSInteger;
buttonMask(self) -> NSEventButtonMask2407 unsafe fn buttonMask(self) -> NSEventButtonMask;
rotation(self) -> libc::c_float2408 unsafe fn rotation(self) -> libc::c_float;
tangentialPressure(self) -> libc::c_float2409 unsafe fn tangentialPressure(self) -> libc::c_float;
tilt(self) -> NSPoint2410 unsafe fn tilt(self) -> NSPoint;
vendorDefined(self) -> id2411 unsafe fn vendorDefined(self) -> id;
2412
2413 // Requesting and Stopping Periodic Events
startPeriodicEventsAfterDelay_withPeriod_(_: Self, delaySeconds: NSTimeInterval, periodSeconds: NSTimeInterval)2414 unsafe fn startPeriodicEventsAfterDelay_withPeriod_(_: Self, delaySeconds: NSTimeInterval, periodSeconds: NSTimeInterval);
stopPeriodicEvents(_: Self)2415 unsafe fn stopPeriodicEvents(_: Self);
2416
2417 // Getting Touch and Gesture Information
magnification(self) -> CGFloat2418 unsafe fn magnification(self) -> CGFloat;
touchesMatchingPhase_inView_(self, phase: NSTouchPhase, view: id ) -> id2419 unsafe fn touchesMatchingPhase_inView_(self, phase: NSTouchPhase, view: id /* (NSView *) */) -> id /* (NSSet *) */;
isSwipeTrackingFromScrollEventsEnabled(_: Self) -> BOOL2420 unsafe fn isSwipeTrackingFromScrollEventsEnabled(_: Self) -> BOOL;
2421
2422 // Monitoring Application Events
2423 // TODO: addGlobalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)
2424 // TODO: addLocalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)
removeMonitor_(_: Self, eventMonitor: id)2425 unsafe fn removeMonitor_(_: Self, eventMonitor: id);
2426
2427 // Scroll Wheel and Flick Events
hasPreciseScrollingDeltas(self) -> BOOL2428 unsafe fn hasPreciseScrollingDeltas(self) -> BOOL;
scrollingDeltaX(self) -> CGFloat2429 unsafe fn scrollingDeltaX(self) -> CGFloat;
scrollingDeltaY(self) -> CGFloat2430