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     unsafe fn scrollingDeltaY(self) -> CGFloat;
momentumPhase(self) -> NSEventPhase2431     unsafe fn momentumPhase(self) -> NSEventPhase;
phase(self) -> NSEventPhase2432     unsafe fn phase(self) -> NSEventPhase;
2433     // TODO: trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler_ (unsure how to bind to blocks)
2434 
2435     // Converting a Mouse Event’s Position into a Sprite Kit Node’s Coordinate Space
locationInNode_(self, node: id ) -> CGPoint2436     unsafe fn locationInNode_(self, node: id /* (SKNode *) */) -> CGPoint;
2437 }
2438 
2439 impl NSEvent for id {
2440     // Creating Events
2441 
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) -> id2442     unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_(
2443         _: Self,
2444         eventType: NSEventType,
2445         location: NSPoint,
2446         modifierFlags: NSEventModifierFlags,
2447         timestamp: NSTimeInterval,
2448         windowNumber: NSInteger,
2449         context: id /* (NSGraphicsContext *) */,
2450         characters: id /* (NSString *) */,
2451         unmodCharacters: id /* (NSString *) */,
2452         repeatKey: BOOL,
2453         code: libc::c_ushort) -> id /* (NSEvent *) */
2454     {
2455         msg_send![class!(NSEvent), keyEventWithType:eventType
2456                                             location:location
2457                                        modifierFlags:modifierFlags
2458                                            timestamp:timestamp
2459                                         windowNumber:windowNumber
2460                                              context:context
2461                                           characters:characters
2462                          charactersIgnoringModifiers:unmodCharacters
2463                                            isARepeat:repeatKey
2464                                              keyCode:code]
2465     }
2466 
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) -> id2467     unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_(
2468         _: Self,
2469         eventType: NSEventType,
2470         location: NSPoint,
2471         modifierFlags: NSEventModifierFlags,
2472         timestamp: NSTimeInterval,
2473         windowNumber: NSInteger,
2474         context: id /* (NSGraphicsContext *) */,
2475         eventNumber: NSInteger,
2476         clickCount: NSInteger,
2477         pressure: libc::c_float) -> id /* (NSEvent *) */
2478     {
2479         msg_send![class!(NSEvent), mouseEventWithType:eventType
2480                                               location:location
2481                                          modifierFlags:modifierFlags
2482                                              timestamp:timestamp
2483                                           windowNumber:windowNumber
2484                                                context:context
2485                                            eventNumber:eventNumber
2486                                             clickCount:clickCount
2487                                               pressure:pressure]
2488     }
2489 
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) -> id2490     unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData_(
2491         _: Self,
2492         eventType: NSEventType,
2493         location: NSPoint,
2494         modifierFlags: NSEventModifierFlags,
2495         timestamp: NSTimeInterval,
2496         windowNumber: NSInteger,
2497         context: id /* (NSGraphicsContext *) */,
2498         eventNumber: NSInteger,
2499         trackingNumber: NSInteger,
2500         userData: *mut c_void) -> id /* (NSEvent *) */
2501     {
2502         msg_send![class!(NSEvent), enterExitEventWithType:eventType
2503                                                   location:location
2504                                              modifierFlags:modifierFlags
2505                                                  timestamp:timestamp
2506                                               windowNumber:windowNumber
2507                                                    context:context
2508                                                eventNumber:eventNumber
2509                                             trackingNumber:trackingNumber
2510                                                   userData:userData]
2511     }
2512 
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) -> id2513     unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(
2514         _: Self,
2515         eventType: NSEventType,
2516         location: NSPoint,
2517         modifierFlags: NSEventModifierFlags,
2518         timestamp: NSTimeInterval,
2519         windowNumber: NSInteger,
2520         context: id /* (NSGraphicsContext *) */,
2521         subtype: NSEventSubtype,
2522         data1: NSInteger,
2523         data2: NSInteger) -> id /* (NSEvent *) */
2524     {
2525         msg_send![class!(NSEvent), otherEventWithType:eventType
2526                                               location:location
2527                                          modifierFlags:modifierFlags
2528                                              timestamp:timestamp
2529                                           windowNumber:windowNumber
2530                                                context:context
2531                                                subtype:subtype
2532                                                  data1:data1
2533                                                  data2:data2]
2534     }
2535 
eventWithEventRef_(_: Self, eventRef: *const c_void) -> id2536     unsafe fn eventWithEventRef_(_: Self, eventRef: *const c_void) -> id {
2537         msg_send![class!(NSEvent), eventWithEventRef:eventRef]
2538     }
2539 
eventWithCGEvent_(_: Self, cgEvent: *mut c_void ) -> id2540     unsafe fn eventWithCGEvent_(_: Self, cgEvent: *mut c_void /* CGEventRef */) -> id {
2541         msg_send![class!(NSEvent), eventWithCGEvent:cgEvent]
2542     }
2543 
2544     // Getting General Event Information
2545 
context(self) -> id2546     unsafe fn context(self) -> id /* (NSGraphicsContext *) */ {
2547         msg_send![self, context]
2548     }
2549 
locationInWindow(self) -> NSPoint2550     unsafe fn locationInWindow(self) -> NSPoint {
2551         msg_send![self, locationInWindow]
2552     }
2553 
modifierFlags(self) -> NSEventModifierFlags2554     unsafe fn modifierFlags(self) -> NSEventModifierFlags {
2555         msg_send![self, modifierFlags]
2556     }
2557 
timestamp(self) -> NSTimeInterval2558     unsafe fn timestamp(self) -> NSTimeInterval {
2559         msg_send![self, timestamp]
2560     }
2561     // NOTE: renamed from `- type` due to Rust keyword collision
2562 
eventType(self) -> NSEventType2563     unsafe fn eventType(self) -> NSEventType {
2564         msg_send![self, type]
2565     }
2566 
window(self) -> id2567     unsafe fn window(self) -> id /* (NSWindow *) */ {
2568         msg_send![self, window]
2569     }
2570 
windowNumber(self) -> NSInteger2571     unsafe fn windowNumber(self) -> NSInteger {
2572         msg_send![self, windowNumber]
2573     }
2574 
eventRef(self) -> *const c_void2575     unsafe fn eventRef(self) -> *const c_void {
2576         msg_send![self, eventRef]
2577     }
2578 
CGEvent(self) -> *mut c_void2579     unsafe fn CGEvent(self) -> *mut c_void /* CGEventRef */ {
2580         msg_send![self, CGEvent]
2581     }
2582 
2583     // Getting Key Event Information
2584 
2585     // NOTE: renamed from `+ modifierFlags` due to conflict with `- modifierFlags`
2586 
currentModifierFlags(_: Self) -> NSEventModifierFlags2587     unsafe fn currentModifierFlags(_: Self) -> NSEventModifierFlags {
2588         msg_send![class!(NSEvent), currentModifierFlags]
2589     }
2590 
keyRepeatDelay(_: Self) -> NSTimeInterval2591     unsafe fn keyRepeatDelay(_: Self) -> NSTimeInterval {
2592         msg_send![class!(NSEvent), keyRepeatDelay]
2593     }
2594 
keyRepeatInterval(_: Self) -> NSTimeInterval2595     unsafe fn keyRepeatInterval(_: Self) -> NSTimeInterval {
2596         msg_send![class!(NSEvent), keyRepeatInterval]
2597     }
2598 
characters(self) -> id2599     unsafe fn characters(self) -> id /* (NSString *) */ {
2600         msg_send![self, characters]
2601     }
2602 
charactersIgnoringModifiers(self) -> id2603     unsafe fn charactersIgnoringModifiers(self) -> id /* (NSString *) */ {
2604         msg_send![self, charactersIgnoringModifiers]
2605     }
2606 
keyCode(self) -> libc::c_ushort2607     unsafe fn keyCode(self) -> libc::c_ushort {
2608         msg_send![self, keyCode]
2609     }
2610 
isARepeat(self) -> BOOL2611     unsafe fn isARepeat(self) -> BOOL {
2612         msg_send![self, isARepeat]
2613     }
2614 
2615     // Getting Mouse Event Information
2616 
pressedMouseButtons(_: Self) -> NSUInteger2617     unsafe fn pressedMouseButtons(_: Self) -> NSUInteger {
2618         msg_send![class!(NSEvent), pressedMouseButtons]
2619     }
2620 
doubleClickInterval(_: Self) -> NSTimeInterval2621     unsafe fn doubleClickInterval(_: Self) -> NSTimeInterval {
2622         msg_send![class!(NSEvent), doubleClickInterval]
2623     }
2624 
mouseLocation(_: Self) -> NSPoint2625     unsafe fn mouseLocation(_: Self) -> NSPoint {
2626         msg_send![class!(NSEvent), mouseLocation]
2627     }
2628 
buttonNumber(self) -> NSInteger2629     unsafe fn buttonNumber(self) -> NSInteger {
2630         msg_send![self, buttonNumber]
2631     }
2632 
clickCount(self) -> NSInteger2633     unsafe fn clickCount(self) -> NSInteger {
2634         msg_send![self, clickCount]
2635     }
2636 
pressure(self) -> libc::c_float2637     unsafe fn pressure(self) -> libc::c_float {
2638         msg_send![self, pressure]
2639     }
2640 
stage(self) -> NSInteger2641     unsafe fn stage(self) -> NSInteger{
2642         msg_send![self, stage]
2643     }
2644 
setMouseCoalescingEnabled_(_: Self, flag: BOOL)2645     unsafe fn setMouseCoalescingEnabled_(_: Self, flag: BOOL) {
2646         msg_send![class!(NSEvent), setMouseCoalescingEnabled:flag]
2647     }
2648 
isMouseCoalescingEnabled(_: Self) -> BOOL2649     unsafe fn isMouseCoalescingEnabled(_: Self) -> BOOL {
2650         msg_send![class!(NSEvent), isMouseCoalescingEnabled]
2651     }
2652 
2653     // Getting Mouse-Tracking Event Information
2654 
eventNumber(self) -> NSInteger2655     unsafe fn eventNumber(self) -> NSInteger {
2656         msg_send![self, eventNumber]
2657     }
2658 
trackingNumber(self) -> NSInteger2659     unsafe fn trackingNumber(self) -> NSInteger {
2660         msg_send![self, trackingNumber]
2661     }
2662 
trackingArea(self) -> id2663     unsafe fn trackingArea(self) -> id /* (NSTrackingArea *) */ {
2664         msg_send![self, trackingArea]
2665     }
2666 
userData(self) -> *const c_void2667     unsafe fn userData(self) -> *const c_void {
2668         msg_send![self, userData]
2669     }
2670 
2671     // Getting Custom Event Information
2672 
data1(self) -> NSInteger2673     unsafe fn data1(self) -> NSInteger {
2674         msg_send![self, data1]
2675     }
2676 
data2(self) -> NSInteger2677     unsafe fn data2(self) -> NSInteger {
2678         msg_send![self, data2]
2679     }
2680 
subtype(self) -> NSEventSubtype2681     unsafe fn subtype(self) -> NSEventSubtype {
2682         msg_send![self, subtype]
2683     }
2684 
2685     // Getting Scroll Wheel Event Information
2686 
deltaX(self) -> CGFloat2687     unsafe fn deltaX(self) -> CGFloat {
2688         msg_send![self, deltaX]
2689     }
2690 
deltaY(self) -> CGFloat2691     unsafe fn deltaY(self) -> CGFloat {
2692         msg_send![self, deltaY]
2693     }
2694 
deltaZ(self) -> CGFloat2695     unsafe fn deltaZ(self) -> CGFloat {
2696         msg_send![self, deltaZ]
2697     }
2698 
2699     // Getting Tablet Proximity Information
2700 
capabilityMask(self) -> NSUInteger2701     unsafe fn capabilityMask(self) -> NSUInteger {
2702         msg_send![self, capabilityMask]
2703     }
2704 
deviceID(self) -> NSUInteger2705     unsafe fn deviceID(self) -> NSUInteger {
2706         msg_send![self, deviceID]
2707     }
2708 
pointingDeviceID(self) -> NSUInteger2709     unsafe fn pointingDeviceID(self) -> NSUInteger {
2710         msg_send![self, pointingDeviceID]
2711     }
2712 
pointingDeviceSerialNumber(self) -> NSUInteger2713     unsafe fn pointingDeviceSerialNumber(self) -> NSUInteger {
2714         msg_send![self, pointingDeviceSerialNumber]
2715     }
2716 
pointingDeviceType(self) -> NSPointingDeviceType2717     unsafe fn pointingDeviceType(self) -> NSPointingDeviceType {
2718         msg_send![self, pointingDeviceType]
2719     }
2720 
systemTabletID(self) -> NSUInteger2721     unsafe fn systemTabletID(self) -> NSUInteger {
2722         msg_send![self, systemTabletID]
2723     }
2724 
tabletID(self) -> NSUInteger2725     unsafe fn tabletID(self) -> NSUInteger {
2726         msg_send![self, tabletID]
2727     }
2728 
uniqueID(self) -> libc::c_ulonglong2729     unsafe fn uniqueID(self) -> libc::c_ulonglong {
2730         msg_send![self, uniqueID]
2731     }
2732 
vendorID(self) -> NSUInteger2733     unsafe fn vendorID(self) -> NSUInteger {
2734         msg_send![self, vendorID]
2735     }
2736 
vendorPointingDeviceType(self) -> NSUInteger2737     unsafe fn vendorPointingDeviceType(self) -> NSUInteger {
2738         msg_send![self, vendorPointingDeviceType]
2739     }
2740 
2741     // Getting Tablet Pointing Information
2742 
absoluteX(self) -> NSInteger2743     unsafe fn absoluteX(self) -> NSInteger {
2744         msg_send![self, absoluteX]
2745     }
2746 
absoluteY(self) -> NSInteger2747     unsafe fn absoluteY(self) -> NSInteger {
2748         msg_send![self, absoluteY]
2749     }
2750 
absoluteZ(self) -> NSInteger2751     unsafe fn absoluteZ(self) -> NSInteger {
2752         msg_send![self, absoluteZ]
2753     }
2754 
buttonMask(self) -> NSEventButtonMask2755     unsafe fn buttonMask(self) -> NSEventButtonMask {
2756         msg_send![self, buttonMask]
2757     }
2758 
rotation(self) -> libc::c_float2759     unsafe fn rotation(self) -> libc::c_float {
2760         msg_send![self, rotation]
2761     }
2762 
tangentialPressure(self) -> libc::c_float2763     unsafe fn tangentialPressure(self) -> libc::c_float {
2764         msg_send![self, tangentialPressure]
2765     }
2766 
tilt(self) -> NSPoint2767     unsafe fn tilt(self) -> NSPoint {
2768         msg_send![self, tilt]
2769     }
2770 
vendorDefined(self) -> id2771     unsafe fn vendorDefined(self) -> id {
2772         msg_send![self, vendorDefined]
2773     }
2774 
2775     // Requesting and Stopping Periodic Events
2776 
startPeriodicEventsAfterDelay_withPeriod_(_: Self, delaySeconds: NSTimeInterval, periodSeconds: NSTimeInterval)2777     unsafe fn startPeriodicEventsAfterDelay_withPeriod_(_: Self, delaySeconds: NSTimeInterval, periodSeconds: NSTimeInterval) {
2778         msg_send![class!(NSEvent), startPeriodicEventsAfterDelay:delaySeconds withPeriod:periodSeconds]
2779     }
2780 
stopPeriodicEvents(_: Self)2781     unsafe fn stopPeriodicEvents(_: Self) {
2782         msg_send![class!(NSEvent), stopPeriodicEvents]
2783     }
2784 
2785     // Getting Touch and Gesture Information
2786 
magnification(self) -> CGFloat2787     unsafe fn magnification(self) -> CGFloat {
2788         msg_send![self, magnification]
2789     }
2790 
touchesMatchingPhase_inView_(self, phase: NSTouchPhase, view: id ) -> id2791     unsafe fn touchesMatchingPhase_inView_(self, phase: NSTouchPhase, view: id /* (NSView *) */) -> id /* (NSSet *) */ {
2792         msg_send![self, touchesMatchingPhase:phase inView:view]
2793     }
2794 
isSwipeTrackingFromScrollEventsEnabled(_: Self) -> BOOL2795     unsafe fn isSwipeTrackingFromScrollEventsEnabled(_: Self) -> BOOL {
2796         msg_send![class!(NSEvent), isSwipeTrackingFromScrollEventsEnabled]
2797     }
2798 
2799     // Monitoring Application Events
2800 
2801     // TODO: addGlobalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)
2802     // TODO: addLocalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)
2803 
removeMonitor_(_: Self, eventMonitor: id)2804     unsafe fn removeMonitor_(_: Self, eventMonitor: id) {
2805         msg_send![class!(NSEvent), removeMonitor:eventMonitor]
2806     }
2807 
2808     // Scroll Wheel and Flick Events
2809 
hasPreciseScrollingDeltas(self) -> BOOL2810     unsafe fn hasPreciseScrollingDeltas(self) -> BOOL {
2811         msg_send![self, hasPreciseScrollingDeltas]
2812     }
2813 
scrollingDeltaX(self) -> CGFloat2814     unsafe fn scrollingDeltaX(self) -> CGFloat {
2815         msg_send![self, scrollingDeltaX]
2816     }
2817 
scrollingDeltaY(self) -> CGFloat2818     unsafe fn scrollingDeltaY(self) -> CGFloat {
2819         msg_send![self, scrollingDeltaY]
2820     }
2821 
momentumPhase(self) -> NSEventPhase2822     unsafe fn momentumPhase(self) -> NSEventPhase {
2823         msg_send![self, momentumPhase]
2824     }
2825 
phase(self) -> NSEventPhase2826     unsafe fn phase(self) -> NSEventPhase {
2827         msg_send![self, phase]
2828     }
2829 
2830     // TODO: trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler_ (unsure how to bind to blocks)
2831 
2832     // Converting a Mouse Event’s Position into a Sprite Kit Node’s Coordinate Space
locationInNode_(self, node: id ) -> CGPoint2833     unsafe fn locationInNode_(self, node: id /* (SKNode *) */) -> CGPoint {
2834         msg_send![self, locationInNode:node]
2835     }
2836 }
2837 
2838 pub trait NSScreen: Sized {
2839     // Getting NSScreen Objects
mainScreen(_: Self) -> id2840     unsafe fn mainScreen(_: Self) -> id /* (NSScreen *) */;
deepestScreen(_: Self) -> id2841     unsafe fn deepestScreen(_: Self) -> id /* (NSScreen *) */;
screens(_: Self) -> id2842     unsafe fn screens(_: Self) -> id /* (NSArray *) */;
2843 
2844     // Getting Screen Information
depth(self) -> NSWindowDepth2845     unsafe fn depth(self) -> NSWindowDepth;
frame(self) -> NSRect2846     unsafe fn frame(self) -> NSRect;
supportedWindowDepths(self) -> *const NSWindowDepth2847     unsafe fn supportedWindowDepths(self) -> *const NSWindowDepth;
deviceDescription(self) -> id2848     unsafe fn deviceDescription(self) -> id /* (NSDictionary *) */;
visibleFrame(self) -> NSRect2849     unsafe fn visibleFrame(self) -> NSRect;
colorSpace(self) -> id2850     unsafe fn colorSpace(self) -> id /* (NSColorSpace *) */;
screensHaveSeparateSpaces(_: Self) -> BOOL2851     unsafe fn screensHaveSeparateSpaces(_: Self) -> BOOL;
2852 
2853     // Screen Backing Coordinate Conversion
backingAlignedRect_options_(self, aRect: NSRect, options: NSAlignmentOptions) -> NSRect2854     unsafe fn backingAlignedRect_options_(self, aRect: NSRect, options: NSAlignmentOptions) -> NSRect;
backingScaleFactor(self) -> CGFloat2855     unsafe fn backingScaleFactor(self) -> CGFloat;
convertRectFromBacking_(self, aRect: NSRect) -> NSRect2856     unsafe fn convertRectFromBacking_(self, aRect: NSRect) -> NSRect;
convertRectToBacking_(self, aRect: NSRect) -> NSRect2857     unsafe fn convertRectToBacking_(self, aRect: NSRect) -> NSRect;
2858 }
2859 
2860 impl NSScreen for id {
2861     // Getting NSScreen Objects
2862 
mainScreen(_: Self) -> id2863     unsafe fn mainScreen(_: Self) -> id /* (NSScreen *) */ {
2864         msg_send![class!(NSScreen), mainScreen]
2865     }
2866 
deepestScreen(_: Self) -> id2867     unsafe fn deepestScreen(_: Self) -> id /* (NSScreen *) */ {
2868         msg_send![class!(NSScreen), deepestScreen]
2869     }
2870 
screens(_: Self) -> id2871     unsafe fn screens(_: Self) -> id /* (NSArray *) */ {
2872         msg_send![class!(NSScreen), screens]
2873     }
2874 
2875     // Getting Screen Information
2876 
depth(self) -> NSWindowDepth2877     unsafe fn depth(self) -> NSWindowDepth {
2878         msg_send![self, depth]
2879     }
2880 
frame(self) -> NSRect2881     unsafe fn frame(self) -> NSRect {
2882         msg_send![self, frame]
2883     }
2884 
supportedWindowDepths(self) -> *const NSWindowDepth2885     unsafe fn supportedWindowDepths(self) -> *const NSWindowDepth {
2886         msg_send![self, supportedWindowDepths]
2887     }
2888 
deviceDescription(self) -> id2889     unsafe fn deviceDescription(self) -> id /* (NSDictionary *) */ {
2890         msg_send![self, deviceDescription]
2891     }
2892 
visibleFrame(self) -> NSRect2893     unsafe fn visibleFrame(self) -> NSRect {
2894         msg_send![self, visibleFrame]
2895     }
2896 
colorSpace(self) -> id2897     unsafe fn colorSpace(self) -> id /* (NSColorSpace *) */ {
2898         msg_send![self, colorSpace]
2899     }
2900 
screensHaveSeparateSpaces(_: Self) -> BOOL2901     unsafe fn screensHaveSeparateSpaces(_: Self) -> BOOL {
2902         msg_send![class!(NSScreen), screensHaveSeparateSpaces]
2903     }
2904 
2905     // Screen Backing Coordinate Conversion
2906 
backingAlignedRect_options_(self, aRect: NSRect, options: NSAlignmentOptions) -> NSRect2907     unsafe fn backingAlignedRect_options_(self, aRect: NSRect, options: NSAlignmentOptions) -> NSRect {
2908         msg_send![self, backingAlignedRect:aRect options:options]
2909     }
2910 
backingScaleFactor(self) -> CGFloat2911     unsafe fn backingScaleFactor(self) -> CGFloat {
2912         msg_send![self, backingScaleFactor]
2913     }
2914 
convertRectFromBacking_(self, aRect: NSRect) -> NSRect2915     unsafe fn convertRectFromBacking_(self, aRect: NSRect) -> NSRect {
2916         msg_send![self, convertRectFromBacking:aRect]
2917     }
2918 
convertRectToBacking_(self, aRect: NSRect) -> NSRect2919     unsafe fn convertRectToBacking_(self, aRect: NSRect) -> NSRect {
2920         msg_send![self, convertRectToBacking:aRect]
2921     }
2922 }
2923 
2924 // https://developer.apple.com/documentation/appkit/nscontrol?language=objc
2925 pub trait NSControl: Sized {
alloc(_: Self) -> id2926     unsafe fn alloc(_: Self) -> id {
2927         msg_send![class!(NSControl), alloc]
2928     }
initWithFrame_(self, frameRect: NSRect) -> id2929     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
isEnabled_(self) -> BOOL2930     unsafe fn isEnabled_(self) -> BOOL;
setEnabled_(self, enabled: BOOL) -> BOOL2931     unsafe fn setEnabled_(self, enabled: BOOL) -> BOOL;
2932 }
2933 
2934 impl NSControl for id {
initWithFrame_(self, frameRect: NSRect) -> id2935     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
2936         msg_send![self, initWithFrame:frameRect]
2937     }
isEnabled_(self) -> BOOL2938     unsafe fn isEnabled_(self) -> BOOL {
2939         msg_send![self, isEnabled]
2940     }
setEnabled_(self, enabled: BOOL) -> BOOL2941     unsafe fn setEnabled_(self, enabled: BOOL) -> BOOL {
2942         msg_send![self, setEnabled:enabled]
2943     }
2944 }
2945 
2946 pub trait NSImageView: Sized {
alloc(_: Self) -> id2947      unsafe fn alloc(_: Self) -> id {
2948          msg_send![class!(NSImageView), alloc]
2949      }
initWithFrame_(self, frameRect: NSRect) -> id2950      unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
setImage_(self, img: id )2951      unsafe fn setImage_(self, img: id /* (NSImage *) */);
2952 }
2953 
2954 impl NSImageView for id {
initWithFrame_(self, frameRect: NSRect) -> id2955     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
2956         msg_send![self, initWithFrame:frameRect]
2957     }
setImage_(self, img: id )2958     unsafe fn setImage_(self, img: id /* (NSImage *) */) {
2959         msg_send![self, setImage:img]
2960     }
2961 }
2962 
2963 pub trait NSButton: Sized {
setImage_(self, img: id )2964      unsafe fn setImage_(self, img: id /* (NSImage *) */);
setBezelStyle_(self, style: NSBezelStyle)2965      unsafe fn setBezelStyle_(self, style: NSBezelStyle);
setTitle_(self, title: id )2966      unsafe fn setTitle_(self, title: id /* (NSString*) */);
alloc(_: Self) -> id2967      unsafe fn alloc(_: Self) -> id {
2968          msg_send![class!(NSButton), alloc]
2969      }
initWithFrame_(self, frameRect: NSRect) -> id2970      unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
setTarget_(self, target: id )2971      unsafe fn setTarget_(self, target: id /* Instance */);
setAction_(self, selector: objc::runtime::Sel )2972      unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance *) */);
2973 }
2974 
2975 impl NSButton for id {
initWithFrame_(self, frameRect: NSRect) -> id2976     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
2977         msg_send![self, initWithFrame:frameRect]
2978     }
setBezelStyle_(self, style: NSBezelStyle)2979     unsafe fn setBezelStyle_(self, style: NSBezelStyle) {
2980         msg_send![self, setBezelStyle:style]
2981     }
setTitle_(self, title: id )2982     unsafe fn setTitle_(self, title: id /* (NSString*) */) {
2983         msg_send![self, setTitle:title]
2984     }
setImage_(self, img: id )2985     unsafe fn setImage_(self, img: id /* (NSImage *) */) {
2986         msg_send![self, setImage:img]
2987     }
setTarget_(self, target: id )2988     unsafe fn setTarget_(self, target: id /* (Instance *) */) {
2989         msg_send![self, setTarget:target]
2990     }
2991 
setAction_(self, selector: objc::runtime::Sel )2992     unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance method *) */) {
2993         msg_send![self, setAction:selector]
2994     }
2995 }
2996 
2997 pub trait NSImage: Sized {
alloc(_: Self) -> id2998     unsafe fn alloc(_: Self) -> id {
2999         msg_send![class!(NSImage), alloc]
3000     }
3001 
initByReferencingFile_(self, file_name: id ) -> id3002     unsafe fn initByReferencingFile_(self, file_name: id /* (NSString *) */) -> id;
initWithContentsOfFile_(self, file_name: id ) -> id3003     unsafe fn initWithContentsOfFile_(self, file_name: id /* (NSString *) */) -> id;
initWithData_(self, data: id ) -> id3004     unsafe fn initWithData_(self, data: id /* (NSData *) */) -> id;
initWithDataIgnoringOrientation_(self, data: id ) -> id3005     unsafe fn initWithDataIgnoringOrientation_(self, data: id /* (NSData *) */) -> id;
initWithPasteboard_(self, pasteboard: id ) -> id3006     unsafe fn initWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> id;
initWithSize_flipped_drawingHandler_(self, size: NSSize, drawingHandlerShouldBeCalledWithFlippedContext: BOOL, drawingHandler: *mut Block<(NSRect,), BOOL>)3007     unsafe fn initWithSize_flipped_drawingHandler_(self, size: NSSize,
3008                                                    drawingHandlerShouldBeCalledWithFlippedContext: BOOL,
3009                                                    drawingHandler: *mut Block<(NSRect,), BOOL>);
initWithSize_(self, aSize: NSSize) -> id3010     unsafe fn initWithSize_(self, aSize: NSSize) -> id;
3011 
imageNamed_(_: Self, name: id ) -> id3012     unsafe fn imageNamed_(_: Self, name: id /* (NSString *) */) -> id {
3013         msg_send![class!(NSImage), imageNamed:name]
3014     }
3015 
name(self) -> id3016     unsafe fn name(self) -> id /* (NSString *) */;
setName_(self, name: id ) -> BOOL3017     unsafe fn setName_(self, name: id /* (NSString *) */) -> BOOL;
3018 
size(self) -> NSSize3019     unsafe fn size(self) -> NSSize;
template(self) -> BOOL3020     unsafe fn template(self) -> BOOL;
3021 
canInitWithPasteboard_(self, pasteboard: id ) -> BOOL3022     unsafe fn canInitWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> BOOL;
imageTypes(self) -> id3023     unsafe fn imageTypes(self) -> id /* (NSArray<NSString *> ) */;
imageUnfilteredTypes(self) -> id3024     unsafe fn imageUnfilteredTypes(self) -> id /* (NSArray<NSString *> ) */;
3025 
addRepresentation_(self, imageRep: id )3026     unsafe fn addRepresentation_(self, imageRep: id /* (NSImageRep *) */);
addRepresentations_(self, imageReps: id )3027     unsafe fn addRepresentations_(self, imageReps: id /* (NSArray<NSImageRep *> *) */);
representations(self) -> id3028     unsafe fn representations(self) -> id /* (NSArray<NSImageRep *> *) */;
removeRepresentation_(self, imageRep: id )3029     unsafe fn removeRepresentation_(self, imageRep: id /* (NSImageRep *) */);
bestRepresentationForRect_context_hints_(self, rect: NSRect, referenceContext: id , hints: id ) -> id3030     unsafe fn bestRepresentationForRect_context_hints_(self, rect: NSRect,
3031                                                        referenceContext: id /* (NSGraphicsContext *) */,
3032                                                        hints: id /* (NSDictionary<NSString *, id> *) */)
3033                                                        -> id /* (NSImageRep *) */;
prefersColorMatch(self) -> BOOL3034     unsafe fn prefersColorMatch(self) -> BOOL;
usesEPSOnResolutionMismatch(self) -> BOOL3035     unsafe fn usesEPSOnResolutionMismatch(self) -> BOOL;
matchesOnMultipleResolution(self) -> BOOL3036     unsafe fn matchesOnMultipleResolution(self) -> BOOL;
3037 
drawInRect_(self, rect: NSRect)3038     unsafe fn drawInRect_(self, rect: NSRect);
drawAtPoint_fromRect_operation_fraction_(self, point: NSPoint, srcRect: NSRect, op: NSCompositingOperation, delta: CGFloat)3039     unsafe fn drawAtPoint_fromRect_operation_fraction_(self, point: NSPoint, srcRect: NSRect,
3040                                                        op: NSCompositingOperation, delta: CGFloat);
drawInRect_fromRect_operation_fraction_(self, dstRect: NSRect, srcRect: NSRect, op: NSCompositingOperation, delta: CGFloat)3041     unsafe fn drawInRect_fromRect_operation_fraction_(self, dstRect: NSRect, srcRect: NSRect,
3042                                                       op: NSCompositingOperation, delta: CGFloat);
drawInRect_fromRect_operation_fraction_respectFlipped_hints_(self, dstSpacePortionRect: NSRect, srcSpacePortionRect: NSRect, op: NSCompositingOperation, delta: CGFloat, respectContextIsFlipped: BOOL, hints: id )3043     unsafe fn drawInRect_fromRect_operation_fraction_respectFlipped_hints_(self, dstSpacePortionRect: NSRect,
3044         srcSpacePortionRect: NSRect, op: NSCompositingOperation, delta: CGFloat, respectContextIsFlipped: BOOL,
3045         hints: id /* (NSDictionary<NSString *, id> *) */);
drawRepresentation_inRect_(self, imageRep: id , dstRect: NSRect)3046     unsafe fn drawRepresentation_inRect_(self, imageRep: id /* (NSImageRep *) */, dstRect: NSRect);
3047 
isValid(self) -> BOOL3048     unsafe fn isValid(self) -> BOOL;
backgroundColor(self) -> id3049     unsafe fn backgroundColor(self) -> id /* (NSColor *) */;
3050 
lockFocus(self)3051     unsafe fn lockFocus(self);
lockFocusFlipped_(self, flipped: BOOL)3052     unsafe fn lockFocusFlipped_(self, flipped: BOOL);
unlockFocus(self)3053     unsafe fn unlockFocus(self);
3054 
alignmentRect(self) -> NSRect3055     unsafe fn alignmentRect(self) -> NSRect;
3056 
cacheMode(self) -> NSImageCacheMode3057     unsafe fn cacheMode(self) -> NSImageCacheMode;
recache(self)3058     unsafe fn recache(self);
3059 
delegate(self) -> id3060     unsafe fn delegate(self) -> id /* (id<NSImageDelegate *> *) */;
3061 
TIFFRepresentation(self) -> id3062     unsafe fn TIFFRepresentation(self) -> id /* (NSData *) */;
TIFFRepresentationUsingCompression_factor_(self, comp: NSTIFFCompression, aFloat: f32) -> id3063     unsafe fn TIFFRepresentationUsingCompression_factor_(self, comp: NSTIFFCompression, aFloat: f32)
3064                                                          -> id /* (NSData *) */;
3065 
cancelIncrementalLoad(self)3066     unsafe fn cancelIncrementalLoad(self);
3067 
hitTestRect_withImageDestinationRect_context_hints_flipped_(self, testRectDestSpace: NSRect, imageRectDestSpace: NSRect, referenceContext: id , hints: id , flipped: BOOL) -> BOOL3068     unsafe fn hitTestRect_withImageDestinationRect_context_hints_flipped_(self, testRectDestSpace: NSRect,
3069         imageRectDestSpace: NSRect, referenceContext: id /* (NSGraphicsContext *) */,
3070         hints: id /* (NSDictionary<NSString *, id> *) */, flipped: BOOL) -> BOOL;
3071 
accessibilityDescription(self) -> id3072     unsafe fn accessibilityDescription(self) -> id /* (NSString *) */;
3073 
layerContentsForContentsScale_(self, layerContentsScale: CGFloat) -> id3074     unsafe fn layerContentsForContentsScale_(self, layerContentsScale: CGFloat) -> id /* (id) */;
recommendedLayerContentsScale_(self, preferredContentsScale: CGFloat) -> CGFloat3075     unsafe fn recommendedLayerContentsScale_(self, preferredContentsScale: CGFloat) -> CGFloat;
3076 
matchesOnlyOnBestFittingAxis(self) -> BOOL3077     unsafe fn matchesOnlyOnBestFittingAxis(self) -> BOOL;
3078 }
3079 
3080 impl NSImage for id {
initByReferencingFile_(self, file_name: id ) -> id3081     unsafe fn initByReferencingFile_(self, file_name: id /* (NSString *) */) -> id {
3082         msg_send![self, initByReferencingFile:file_name]
3083     }
3084 
initWithContentsOfFile_(self, file_name: id ) -> id3085     unsafe fn initWithContentsOfFile_(self, file_name: id /* (NSString *) */) -> id {
3086         msg_send![self, initWithContentsOfFile:file_name]
3087     }
3088 
initWithData_(self, data: id ) -> id3089     unsafe fn initWithData_(self, data: id /* (NSData *) */) -> id {
3090         msg_send![self, initWithData:data]
3091     }
3092 
initWithDataIgnoringOrientation_(self, data: id ) -> id3093     unsafe fn initWithDataIgnoringOrientation_(self, data: id /* (NSData *) */) -> id {
3094         msg_send![self, initWithDataIgnoringOrientation:data]
3095     }
3096 
initWithPasteboard_(self, pasteboard: id ) -> id3097     unsafe fn initWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> id {
3098         msg_send![self, initWithPasteboard:pasteboard]
3099     }
3100 
initWithSize_flipped_drawingHandler_(self, size: NSSize, drawingHandlerShouldBeCalledWithFlippedContext: BOOL, drawingHandler: *mut Block<(NSRect,), BOOL>)3101     unsafe fn initWithSize_flipped_drawingHandler_(self, size: NSSize,
3102                                                    drawingHandlerShouldBeCalledWithFlippedContext: BOOL,
3103                                                    drawingHandler: *mut Block<(NSRect,), BOOL>) {
3104         msg_send![self, initWithSize:size
3105                              flipped:drawingHandlerShouldBeCalledWithFlippedContext
3106                       drawingHandler:drawingHandler]
3107     }
3108 
initWithSize_(self, aSize: NSSize) -> id3109     unsafe fn initWithSize_(self, aSize: NSSize) -> id {
3110         msg_send![self, initWithSize:aSize]
3111     }
3112 
name(self) -> id3113     unsafe fn name(self) -> id /* (NSString *) */ {
3114         msg_send![self, name]
3115     }
3116 
setName_(self, name: id ) -> BOOL3117     unsafe fn setName_(self, name: id /* (NSString *) */) -> BOOL {
3118         msg_send![self, setName:name]
3119     }
3120 
size(self) -> NSSize3121     unsafe fn size(self) -> NSSize {
3122         msg_send![self, size]
3123     }
3124 
template(self) -> BOOL3125     unsafe fn template(self) -> BOOL {
3126         msg_send![self, template]
3127     }
3128 
canInitWithPasteboard_(self, pasteboard: id ) -> BOOL3129     unsafe fn canInitWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> BOOL {
3130         msg_send![self, canInitWithPasteboard:pasteboard]
3131     }
3132 
imageTypes(self) -> id3133     unsafe fn imageTypes(self) -> id /* (NSArray<NSString *> ) */ {
3134         msg_send![self, imageTypes]
3135     }
3136 
imageUnfilteredTypes(self) -> id3137     unsafe fn imageUnfilteredTypes(self) -> id /* (NSArray<NSString *> ) */ {
3138         msg_send![self, imageUnfilteredTypes]
3139     }
3140 
addRepresentation_(self, imageRep: id )3141     unsafe fn addRepresentation_(self, imageRep: id /* (NSImageRep *) */) {
3142         msg_send![self, addRepresentation:imageRep]
3143     }
3144 
addRepresentations_(self, imageReps: id )3145     unsafe fn addRepresentations_(self, imageReps: id /* (NSArray<NSImageRep *> *) */) {
3146         msg_send![self, addRepresentations:imageReps]
3147     }
3148 
representations(self) -> id3149     unsafe fn representations(self) -> id /* (NSArray<NSImageRep *> *) */ {
3150         msg_send![self, representations]
3151     }
3152 
removeRepresentation_(self, imageRep: id )3153     unsafe fn removeRepresentation_(self, imageRep: id /* (NSImageRep *) */) {
3154         msg_send![self, removeRepresentation:imageRep]
3155     }
3156 
bestRepresentationForRect_context_hints_(self, rect: NSRect, referenceContext: id , hints: id ) -> id3157     unsafe fn bestRepresentationForRect_context_hints_(self, rect: NSRect,
3158                                                        referenceContext: id /* (NSGraphicsContext *) */,
3159                                                        hints: id /* (NSDictionary<NSString *, id> *) */)
3160                                                        -> id /* (NSImageRep *) */ {
3161         msg_send![self, bestRepresentationForRect:rect context:referenceContext hints:hints]
3162     }
3163 
prefersColorMatch(self) -> BOOL3164     unsafe fn prefersColorMatch(self) -> BOOL {
3165         msg_send![self, prefersColorMatch]
3166     }
3167 
usesEPSOnResolutionMismatch(self) -> BOOL3168     unsafe fn usesEPSOnResolutionMismatch(self) -> BOOL {
3169         msg_send![self, usesEPSOnResolutionMismatch]
3170     }
3171 
matchesOnMultipleResolution(self) -> BOOL3172     unsafe fn matchesOnMultipleResolution(self) -> BOOL {
3173         msg_send![self, matchesOnMultipleResolution]
3174     }
3175 
drawInRect_(self, rect: NSRect)3176     unsafe fn drawInRect_(self, rect: NSRect) {
3177         msg_send![self, drawInRect:rect]
3178     }
3179 
drawAtPoint_fromRect_operation_fraction_(self, point: NSPoint, srcRect: NSRect, op: NSCompositingOperation, delta: CGFloat)3180     unsafe fn drawAtPoint_fromRect_operation_fraction_(self, point: NSPoint, srcRect: NSRect,
3181                                                        op: NSCompositingOperation, delta: CGFloat) {
3182         msg_send![self, drawAtPoint:point fromRect:srcRect operation:op fraction:delta]
3183     }
3184 
drawInRect_fromRect_operation_fraction_(self, dstRect: NSRect, srcRect: NSRect, op: NSCompositingOperation, delta: CGFloat)3185     unsafe fn drawInRect_fromRect_operation_fraction_(self, dstRect: NSRect, srcRect: NSRect,
3186                                                       op: NSCompositingOperation, delta: CGFloat) {
3187         msg_send![self, drawInRect:dstRect fromRect:srcRect operation:op fraction:delta]
3188     }
3189 
drawInRect_fromRect_operation_fraction_respectFlipped_hints_(self, dstSpacePortionRect: NSRect, srcSpacePortionRect: NSRect, op: NSCompositingOperation, delta: CGFloat, respectContextIsFlipped: BOOL, hints: id )3190     unsafe fn drawInRect_fromRect_operation_fraction_respectFlipped_hints_(self, dstSpacePortionRect: NSRect,
3191         srcSpacePortionRect: NSRect, op: NSCompositingOperation, delta: CGFloat, respectContextIsFlipped: BOOL,
3192         hints: id /* (NSDictionary<NSString *, id> *) */) {
3193         msg_send![self, drawInRect:dstSpacePortionRect
3194                           fromRect:srcSpacePortionRect
3195                          operation:op
3196                           fraction:delta
3197                     respectFlipped:respectContextIsFlipped
3198                              hints:hints]
3199     }
3200 
drawRepresentation_inRect_(self, imageRep: id , dstRect: NSRect)3201     unsafe fn drawRepresentation_inRect_(self, imageRep: id /* (NSImageRep *) */, dstRect: NSRect) {
3202         msg_send![self, drawRepresentation:imageRep inRect:dstRect]
3203     }
3204 
isValid(self) -> BOOL3205     unsafe fn isValid(self) -> BOOL {
3206         msg_send![self, isValid]
3207     }
3208 
backgroundColor(self) -> id3209     unsafe fn backgroundColor(self) -> id /* (NSColor *) */ {
3210         msg_send![self, backgroundColor]
3211     }
3212 
lockFocus(self)3213     unsafe fn lockFocus(self) {
3214         msg_send![self, lockFocus]
3215     }
3216 
lockFocusFlipped_(self, flipped: BOOL)3217     unsafe fn lockFocusFlipped_(self, flipped: BOOL) {
3218         msg_send![self, lockFocusFlipped:flipped]
3219     }
3220 
unlockFocus(self)3221     unsafe fn unlockFocus(self) {
3222         msg_send![self, unlockFocus]
3223     }
3224 
alignmentRect(self) -> NSRect3225     unsafe fn alignmentRect(self) -> NSRect {
3226         msg_send![self, alignmentRect]
3227     }
3228 
cacheMode(self) -> NSImageCacheMode3229     unsafe fn cacheMode(self) -> NSImageCacheMode {
3230         msg_send![self, cacheMode]
3231     }
3232 
recache(self)3233     unsafe fn recache(self) {
3234         msg_send![self, recache]
3235     }
3236 
delegate(self) -> id3237     unsafe fn delegate(self) -> id /* (id<NSImageDelegate *> *) */ {
3238         msg_send![self, delegate]
3239     }
3240 
TIFFRepresentation(self) -> id3241     unsafe fn TIFFRepresentation(self) -> id /* (NSData *) */ {
3242         msg_send![self, TIFFRepresentation]
3243     }
3244 
TIFFRepresentationUsingCompression_factor_(self, comp: NSTIFFCompression, aFloat: f32) -> id3245     unsafe fn TIFFRepresentationUsingCompression_factor_(self, comp: NSTIFFCompression, aFloat: f32)
3246                                                          -> id /* (NSData *) */ {
3247         msg_send![self, TIFFRepresentationUsingCompression:comp factor:aFloat]
3248     }
3249 
cancelIncrementalLoad(self)3250     unsafe fn cancelIncrementalLoad(self) {
3251         msg_send![self, cancelIncrementalLoad]
3252     }
3253 
hitTestRect_withImageDestinationRect_context_hints_flipped_(self, testRectDestSpace: NSRect, imageRectDestSpace: NSRect, referenceContext: id , hints: id , flipped: BOOL) -> BOOL3254     unsafe fn hitTestRect_withImageDestinationRect_context_hints_flipped_(self, testRectDestSpace: NSRect,
3255         imageRectDestSpace: NSRect, referenceContext: id /* (NSGraphicsContext *) */,
3256         hints: id /* (NSDictionary<NSString *, id> *) */, flipped: BOOL) -> BOOL {
3257         msg_send![self, hitTestRect:testRectDestSpace
3258            withImageDestinationRect:imageRectDestSpace
3259                             context:referenceContext
3260                               hints:hints
3261                             flipped:flipped]
3262     }
3263 
accessibilityDescription(self) -> id3264     unsafe fn accessibilityDescription(self) -> id /* (NSString *) */ {
3265         msg_send![self, accessibilityDescription]
3266     }
3267 
layerContentsForContentsScale_(self, layerContentsScale: CGFloat) -> id3268     unsafe fn layerContentsForContentsScale_(self, layerContentsScale: CGFloat) -> id /* (id) */ {
3269         msg_send![self, layerContentsForContentsScale:layerContentsScale]
3270     }
3271 
recommendedLayerContentsScale_(self, preferredContentsScale: CGFloat) -> CGFloat3272     unsafe fn recommendedLayerContentsScale_(self, preferredContentsScale: CGFloat) -> CGFloat {
3273         msg_send![self, recommendedLayerContentsScale:preferredContentsScale]
3274     }
3275 
matchesOnlyOnBestFittingAxis(self) -> BOOL3276     unsafe fn matchesOnlyOnBestFittingAxis(self) -> BOOL {
3277         msg_send![self, matchesOnlyOnBestFittingAxis]
3278     }
3279 }
3280 
3281 #[link(name = "AppKit", kind = "framework")]
3282 extern {
3283     // Image hints (NSString* const)
3284     pub static NSImageHintCTM: id;
3285     pub static NSImageHintInterpolation: id;
3286 
3287     // System image names (NSString const*)
3288     pub static NSImageNameQuickLookTemplate: id;
3289     pub static NSImageNameBluetoothTemplate: id;
3290     pub static NSImageNameIChatTheaterTemplate: id;
3291     pub static NSImageNameSlideshowTemplate: id;
3292     pub static NSImageNameActionTemplate: id;
3293     pub static NSImageNameSmartBadgeTemplate: id;
3294     pub static NSImageNamePathTemplate: id;
3295     pub static NSImageNameInvalidDataFreestandingTemplate: id;
3296     pub static NSImageNameLockLockedTemplate: id;
3297     pub static NSImageNameLockUnlockedTemplate: id;
3298     pub static NSImageNameGoRightTemplate: id;
3299     pub static NSImageNameGoLeftTemplate: id;
3300     pub static NSImageNameRightFacingTriangleTemplate: id;
3301     pub static NSImageNameLeftFacingTriangleTemplate: id;
3302     pub static NSImageNameAddTemplate: id;
3303     pub static NSImageNameRemoveTemplate: id;
3304     pub static NSImageNameRevealFreestandingTemplate: id;
3305     pub static NSImageNameFollowLinkFreestandingTemplate: id;
3306     pub static NSImageNameEnterFullScreenTemplate: id;
3307     pub static NSImageNameExitFullScreenTemplate: id;
3308     pub static NSImageNameStopProgressTemplate: id;
3309     pub static NSImageNameStopProgressFreestandingTemplate: id;
3310     pub static NSImageNameRefreshTemplate: id;
3311     pub static NSImageNameRefreshFreestandingTemplate: id;
3312 
3313     pub static NSImageNameMultipleDocuments: id;
3314 
3315     pub static NSImageNameUser: id;
3316     pub static NSImageNameUserGroup: id;
3317     pub static NSImageNameEveryone: id;
3318     pub static NSImageNameUserGuest: id;
3319 
3320     pub static NSImageNameBonjour: id;
3321     pub static NSImageNameDotMac: id;
3322     pub static NSImageNameComputer: id;
3323     pub static NSImageNameFolderBurnable: id;
3324     pub static NSImageNameFolderSmart: id;
3325     pub static NSImageNameNetwork: id;
3326 
3327     pub static NSImageNameUserAccounts: id;
3328     pub static NSImageNamePreferencesGeneral: id;
3329     pub static NSImageNameAdvanced: id;
3330     pub static NSImageNameInfo: id;
3331     pub static NSImageNameFontPanel: id;
3332     pub static NSImageNameColorPanel: id;
3333     pub static NSImageNameFolder: id;
3334     pub static NSImageNameTrashEmpty: id;
3335     pub static NSImageNameTrashFull: id;
3336     pub static NSImageNameHomeTemplate: id;
3337     pub static NSImageNameBookmarksTemplate: id;
3338     pub static NSImageNameCaution: id;
3339     pub static NSImageNameStatusAvailable: id;
3340     pub static NSImageNameStatusPartiallyAvailable: id;
3341     pub static NSImageNameStatusUnavailable: id;
3342     pub static NSImageNameStatusNone: id;
3343     pub static NSImageNameApplicationIcon: id;
3344     pub static NSImageNameMenuOnStateTemplate: id;
3345     pub static NSImageNameMenuMixedStateTemplate: id;
3346     pub static NSImageNameMobileMe: id;
3347 
3348     pub static NSImageNameIconViewTemplate: id;
3349     pub static NSImageNameListViewTemplate: id;
3350     pub static NSImageNameColumnViewTemplate: id;
3351     pub static NSImageNameFlowViewTemplate: id;
3352     pub static NSImageNameShareTemplate: id;
3353 }
3354 
3355 #[repr(usize)]
3356 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
3357 pub enum NSCompositingOperation {
3358    NSCompositeClear = 0,
3359    NSCompositeCopy = 1,
3360    NSCompositeSourceOver = 2,
3361    NSCompositeSourceIn = 3,
3362    NSCompositeSourceOut = 4,
3363    NSCompositeSourceAtop = 5,
3364    NSCompositeDestinationOver = 6,
3365    NSCompositeDestinationIn = 7,
3366    NSCompositeDestinationOut = 8,
3367    NSCompositeDestinationAtop = 9,
3368    NSCompositeXOR = 10,
3369    NSCompositePlusDarker = 11,
3370    NSCompositeHighlight = 12,
3371    NSCompositePlusLighter = 13
3372 }
3373 
3374 #[repr(usize)]
3375 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
3376 pub enum NSImageCacheMode {
3377     NSImageCacheDefault,
3378     NSImageCacheAlways,
3379     NSImageCacheBySize,
3380     NSImageCacheNever
3381 }
3382 
3383 #[repr(usize)]
3384 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
3385 pub enum NSTIFFCompression {
3386     NSTIFFCompressionNone = 1,
3387     NSTIFFCompressionCCITTFAX3 = 3,
3388     NSTIFFCompressionCCITTFAX4 = 4,
3389     NSTIFFCompressionLZW = 5,
3390     NSTIFFCompressionJPEG = 6,
3391     NSTIFFCompressionNEXT = 32766,
3392     NSTIFFCompressionPackBits = 32773,
3393     NSTIFFCompressionOldJPEG = 32865
3394 }
3395 
3396 #[repr(usize)]
3397 #[derive(Clone, Copy, Debug, Eq, PartialEq)]
3398 pub enum NSImageLoadStatus {
3399     NSImageLoadStatusCompleted,
3400     NSImageLoadStatusCancelled,
3401     NSImageLoadStatusInvalidData,
3402     NSImageLoadStatusUnexpectedEOF,
3403     NSImageLoadStatusReadError
3404 }
3405 
3406 pub trait NSSound: Sized {
canInitWithPasteboard_(_: Self, pasteboard: id) -> BOOL3407     unsafe fn canInitWithPasteboard_(_: Self, pasteboard: id) -> BOOL {
3408         msg_send![class!(NSSound), canInitWithPasteboard:pasteboard]
3409     }
3410 
initWithContentsOfFile_withReference_(self, filepath: id, byRef: BOOL) -> id3411     unsafe fn initWithContentsOfFile_withReference_(self, filepath: id, byRef: BOOL) -> id;
initWithContentsOfURL_withReference_(self, fileUrl: id, byRef: BOOL) -> id3412     unsafe fn initWithContentsOfURL_withReference_(self, fileUrl: id, byRef: BOOL) -> id;
initWithData_(self, audioData: id) -> id3413     unsafe fn initWithData_(self, audioData: id) -> id;
initWithPasteboard_(self, pasteboard: id) -> id3414     unsafe fn initWithPasteboard_(self, pasteboard: id) -> id;
3415 
name(self) -> id3416     unsafe fn name(self) -> id;
volume(self) -> f323417     unsafe fn volume(self) -> f32;
currentTime(self) -> NSTimeInterval3418     unsafe fn currentTime(self) -> NSTimeInterval;
loops(self) -> BOOL3419     unsafe fn loops(self) -> BOOL;
playbackDeviceIdentifier(self) -> id3420     unsafe fn playbackDeviceIdentifier(self) -> id;
delegate(self) -> id3421     unsafe fn delegate(self) -> id;
3422 
soundUnfilteredTypes(_: Self) -> id3423     unsafe fn soundUnfilteredTypes(_: Self) -> id {
3424         msg_send![class!(NSSound), soundUnfilteredTypes]
3425     }
3426 
soundNamed_(_: Self, soundName: id) -> id3427     unsafe fn soundNamed_(_: Self, soundName: id) -> id {
3428         msg_send![class!(NSSound), soundNamed:soundName]
3429     }
3430 
duration(self) -> NSTimeInterval3431     unsafe fn duration(self) -> NSTimeInterval;
3432 
playing(self) -> BOOL3433     unsafe fn playing(self) -> BOOL;
pause(self) -> BOOL3434     unsafe fn pause(self) -> BOOL;
play(self) -> BOOL3435     unsafe fn play(self) -> BOOL;
resume(self) -> BOOL3436     unsafe fn resume(self) -> BOOL;
stop(self) -> BOOL3437     unsafe fn stop(self) -> BOOL;
3438 
writeToPasteboard_(self, pasteboard: id)3439     unsafe fn writeToPasteboard_(self, pasteboard: id);
3440 }
3441 
3442 impl NSSound for id {
initWithContentsOfFile_withReference_(self, filepath: id, byRef: BOOL) -> id3443     unsafe fn initWithContentsOfFile_withReference_(self, filepath: id, byRef: BOOL) -> id {
3444         msg_send![self, initWithContentsOfFile:filepath withReference:byRef]
3445     }
3446 
initWithContentsOfURL_withReference_(self, fileUrl: id, byRef: BOOL) -> id3447     unsafe fn initWithContentsOfURL_withReference_(self, fileUrl: id, byRef: BOOL) -> id {
3448         msg_send![self, initWithContentsOfURL:fileUrl withReference:byRef]
3449     }
3450 
initWithData_(self, audioData: id) -> id3451     unsafe fn initWithData_(self, audioData: id) -> id {
3452         msg_send![self, initWithData:audioData]
3453     }
3454 
initWithPasteboard_(self, pasteboard: id) -> id3455     unsafe fn initWithPasteboard_(self, pasteboard: id) -> id {
3456         msg_send![self, initWithPasteboard:pasteboard]
3457     }
3458 
name(self) -> id3459     unsafe fn name(self) -> id {
3460         msg_send![self, name]
3461     }
3462 
volume(self) -> f323463     unsafe fn volume(self) -> f32 {
3464         msg_send![self, volume]
3465     }
3466 
currentTime(self) -> NSTimeInterval3467     unsafe fn currentTime(self) -> NSTimeInterval {
3468         msg_send![self, currentTime]
3469     }
3470 
loops(self) -> BOOL3471     unsafe fn loops(self) -> BOOL {
3472         msg_send![self, loops]
3473     }
3474 
playbackDeviceIdentifier(self) -> id3475     unsafe fn playbackDeviceIdentifier(self) -> id {
3476         msg_send![self, playbackDeviceIdentifier]
3477     }
3478 
delegate(self) -> id3479     unsafe fn delegate(self) -> id {
3480         msg_send![self, delegate]
3481     }
3482 
duration(self) -> NSTimeInterval3483     unsafe fn duration(self) -> NSTimeInterval {
3484         msg_send![self, duration]
3485     }
3486 
playing(self) -> BOOL3487     unsafe fn playing(self) -> BOOL {
3488         msg_send![self, playing]
3489     }
3490 
pause(self) -> BOOL3491     unsafe fn pause(self) -> BOOL {
3492         msg_send![self, pause]
3493     }
3494 
play(self) -> BOOL3495     unsafe fn play(self) -> BOOL {
3496         msg_send![self, play]
3497     }
3498 
resume(self) -> BOOL3499     unsafe fn resume(self) -> BOOL {
3500         msg_send![self, resume]
3501     }
3502 
stop(self) -> BOOL3503     unsafe fn stop(self) -> BOOL {
3504         msg_send![self, stop]
3505     }
3506 
writeToPasteboard_(self, pasteboard: id)3507     unsafe fn writeToPasteboard_(self, pasteboard: id) {
3508         msg_send![self, writeToPasteboard:pasteboard]
3509     }
3510 }
3511 
3512 pub const NSVariableStatusItemLength: CGFloat = -1.0;
3513 pub const NSSquareStatusItemLength: CGFloat = -2.0;
3514 
3515 pub trait NSStatusItem: Sized {
statusBar(self) -> id3516     unsafe fn statusBar(self) -> id /* (NSStatusBar *) */;
button(self) -> id3517     unsafe fn button(self) -> id /* (NSStatusBarButton *) */;
menu(self) -> id3518     unsafe fn menu(self) -> id;
setMenu_(self, menu: id)3519     unsafe fn setMenu_(self, menu: id);
length(self) -> CGFloat3520     unsafe fn length(self) -> CGFloat;
setLength_(self, length: CGFloat)3521     unsafe fn setLength_(self, length: CGFloat);
3522 }
3523 
3524 impl NSStatusItem for id {
statusBar(self) -> id3525     unsafe fn statusBar(self) -> id /* (NSStatusBar *) */ {
3526         msg_send![self, statusBar]
3527     }
3528 
button(self) -> id3529     unsafe fn button(self) -> id /* (NSStatusBarButton *) */ {
3530         msg_send![self, button]
3531     }
3532 
menu(self) -> id3533     unsafe fn menu(self) -> id {
3534         msg_send![self, menu]
3535     }
3536 
setMenu_(self, menu: id)3537     unsafe fn setMenu_(self, menu: id) {
3538         msg_send![self, setMenu:menu]
3539     }
3540 
length(self) -> CGFloat3541     unsafe fn length(self) -> CGFloat {
3542         msg_send![self, length]
3543     }
3544 
setLength_(self, length: CGFloat)3545     unsafe fn setLength_(self, length: CGFloat) {
3546         msg_send![self, setLength: length]
3547     }
3548 }
3549 
3550 pub trait NSStatusBar: Sized {
systemStatusBar(_: Self) -> id3551     unsafe fn systemStatusBar(_: Self) -> id {
3552         msg_send![class!(NSStatusBar), systemStatusBar]
3553     }
3554 
statusItemWithLength_(self, length: CGFloat) -> id3555     unsafe fn statusItemWithLength_(self, length: CGFloat) -> id /* (NSStatusItem *) */;
removeStatusItem_(self, item: id )3556     unsafe fn removeStatusItem_(self, item: id /* (NSStatusItem *) */);
isVertical(self) -> BOOL3557     unsafe fn isVertical(self) -> BOOL;
3558 }
3559 
3560 impl NSStatusBar for id {
statusItemWithLength_(self, length: CGFloat) -> id3561     unsafe fn statusItemWithLength_(self, length: CGFloat) -> id /* (NSStatusItem *) */ {
3562         msg_send![self, statusItemWithLength:length]
3563     }
3564 
removeStatusItem_(self, item: id )3565     unsafe fn removeStatusItem_(self, item: id /* (NSStatusItem *) */) {
3566         msg_send![self, removeStatusItem:item]
3567     }
3568 
isVertical(self) -> BOOL3569     unsafe fn isVertical(self) -> BOOL {
3570         msg_send![self, isVertical]
3571     }
3572 }
3573 
3574 extern {
NSRectFill(rect: NSRect)3575     pub fn NSRectFill(rect: NSRect);
3576 }
3577 
3578 pub trait NSTextField: Sized {
alloc(_: Self) -> id3579     unsafe fn alloc(_: Self) -> id {
3580         msg_send![class!(NSTextField), alloc]
3581     }
initWithFrame_(self, frameRect: NSRect) -> id3582     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
setEditable_(self, editable: BOOL)3583     unsafe fn setEditable_(self, editable: BOOL);
setStringValue_(self, label: id )3584     unsafe fn setStringValue_(self, label: id /* NSString */);
3585 }
3586 
3587 impl NSTextField for id {
initWithFrame_(self, frameRect: NSRect) -> id3588     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
3589         msg_send![self, initWithFrame:frameRect]
3590     }
setEditable_(self, editable: BOOL)3591     unsafe fn setEditable_(self, editable: BOOL) {
3592         msg_send![self, setEditable:editable]
3593     }
setStringValue_(self, label: id)3594     unsafe fn setStringValue_(self, label: id) {
3595         msg_send![self, setStringValue:label]
3596     }
3597 }
3598 
3599 #[repr(u64)]
3600 pub enum NSTabViewType {
3601     NSTopTabsBezelBorder     = 0,
3602     NSLeftTabsBezelBorder    = 1,
3603     NSBottomTabsBezelBorder  = 2,
3604     NSRightTabsBezelBorder   = 3,
3605     NSNoTabsBezelBorder      = 4,
3606     NSNoTabsLineBorder       = 5,
3607     NSNoTabsNoBorder         = 6
3608 }
3609 
3610 pub trait NSTabView: Sized {
new(_: Self) -> id3611     unsafe fn new(_: Self) -> id  {
3612         msg_send![class!(NSTabView), new]
3613     }
3614 
initWithFrame_(self, frameRect: NSRect) -> id3615     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
addTabViewItem_(self, tabViewItem: id)3616     unsafe fn addTabViewItem_(self, tabViewItem: id);
insertTabViewItem_atIndex_(self,tabViewItem:id, index:NSInteger)3617     unsafe fn insertTabViewItem_atIndex_(self,tabViewItem:id, index:NSInteger);
removeTabViewItem_(self,tabViewItem:id)3618     unsafe fn removeTabViewItem_(self,tabViewItem:id);
indexOfTabViewItem_(self, tabViewItem:id) -> id3619     unsafe fn indexOfTabViewItem_(self, tabViewItem:id) -> id;
indexOfTabViewItemWithIdentifier_(self,identifier:id) -> id3620     unsafe fn indexOfTabViewItemWithIdentifier_(self,identifier:id) -> id;
numberOfTabViewItems(self) -> id3621     unsafe fn numberOfTabViewItems(self) -> id;
tabViewItemAtIndex_(self,index:id) -> id3622     unsafe fn tabViewItemAtIndex_(self,index:id) -> id;
tabViewItems(self) -> id3623     unsafe fn tabViewItems(self) -> id;
selectFirstTabViewItem_(self,sender:id)3624     unsafe fn selectFirstTabViewItem_(self,sender:id);
selectLastTabViewItem_(self,sender:id)3625     unsafe fn selectLastTabViewItem_(self,sender:id);
selectNextTabViewItem_(self, sender:id)3626     unsafe fn selectNextTabViewItem_(self, sender:id);
selectPreviousTabViewItem_(self,sender:id)3627     unsafe fn selectPreviousTabViewItem_(self,sender:id);
selectTabViewItem_(self,tabViewItem:id)3628     unsafe fn selectTabViewItem_(self,tabViewItem:id);
selectTabViewItemAtIndex_(self,index:id)3629     unsafe fn selectTabViewItemAtIndex_(self,index:id);
selectTabViewItemWithIdentifier_(self,identifier:id)3630     unsafe fn selectTabViewItemWithIdentifier_(self,identifier:id);
selectedTabViewItem(self) -> id3631     unsafe fn selectedTabViewItem(self) -> id;
takeSelectedTabViewItemFromSender_(self,sender:id)3632     unsafe fn takeSelectedTabViewItemFromSender_(self,sender:id);
font(self) -> id3633     unsafe fn font(self) -> id;
setFont_(self, font:id)3634     unsafe fn setFont_(self, font:id);
tabViewType(self) -> NSTabViewType3635     unsafe fn tabViewType(self) -> NSTabViewType;
setTabViewType_(self,tabViewType: NSTabViewType)3636     unsafe fn setTabViewType_(self,tabViewType: NSTabViewType);
controlTint(self) -> id3637     unsafe fn controlTint(self) -> id;
setControlTint_(self,controlTint:id)3638     unsafe fn setControlTint_(self,controlTint:id);
drawsBackground(self) -> BOOL3639     unsafe fn drawsBackground(self) -> BOOL;
setDrawsBackground_(self,drawsBackground:BOOL)3640     unsafe fn setDrawsBackground_(self,drawsBackground:BOOL);
minimumSize(self) -> id3641     unsafe fn minimumSize(self) -> id;
contentRect(self) -> id3642     unsafe fn contentRect(self) -> id;
controlSize(self) -> id3643     unsafe fn controlSize(self) -> id;
setControlSize_(self,controlSize:id)3644     unsafe fn setControlSize_(self,controlSize:id);
allowsTruncatedLabels(self) -> BOOL3645     unsafe fn allowsTruncatedLabels(self) -> BOOL;
setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL)3646     unsafe fn setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL);
setDelegate_(self, delegate:id)3647     unsafe fn setDelegate_(self, delegate:id);
delegate(self) -> id3648     unsafe fn delegate(self) -> id ;
tabViewAtPoint_(self, point:id) -> id3649     unsafe fn tabViewAtPoint_(self, point:id) -> id;
3650 }
3651 
3652 impl NSTabView for id {
initWithFrame_(self, frameRect: NSRect) -> id3653     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {
3654         msg_send![self, initWithFrame:frameRect]
3655     }
3656 
addTabViewItem_(self, tabViewItem: id)3657     unsafe fn addTabViewItem_(self, tabViewItem: id) {
3658         msg_send![self, addTabViewItem:tabViewItem]
3659     }
insertTabViewItem_atIndex_(self, tabViewItem: id,index:NSInteger)3660     unsafe fn insertTabViewItem_atIndex_(self, tabViewItem: id,index:NSInteger) {
3661         msg_send![self, addTabViewItem:tabViewItem atIndex:index]
3662     }
removeTabViewItem_(self,tabViewItem:id)3663     unsafe fn removeTabViewItem_(self,tabViewItem:id){
3664         msg_send![self, removeTabViewItem:tabViewItem]
3665     }
3666 
indexOfTabViewItem_(self, tabViewItem:id) -> id3667     unsafe fn indexOfTabViewItem_(self, tabViewItem:id) -> id{
3668         msg_send![self, indexOfTabViewItem:tabViewItem]
3669     }
3670 
indexOfTabViewItemWithIdentifier_(self,identifier:id) -> id3671     unsafe fn indexOfTabViewItemWithIdentifier_(self,identifier:id) -> id{
3672         msg_send![self, indexOfTabViewItemWithIdentifier:identifier]
3673     }
numberOfTabViewItems(self) -> id3674     unsafe fn numberOfTabViewItems(self) -> id{
3675         msg_send![self, numberOfTabViewItems]
3676     }
3677 
tabViewItemAtIndex_(self,index:id)->id3678     unsafe fn tabViewItemAtIndex_(self,index:id)->id{
3679         msg_send![self, tabViewItemAtIndex:index]
3680     }
3681 
tabViewItems(self)->id3682     unsafe fn tabViewItems(self)->id{
3683         msg_send![self, tabViewItems]
3684     }
3685 
selectFirstTabViewItem_(self,sender:id)3686     unsafe fn selectFirstTabViewItem_(self,sender:id){
3687         msg_send![self, selectFirstTabViewItem:sender]
3688     }
3689 
selectLastTabViewItem_(self,sender:id)3690     unsafe fn selectLastTabViewItem_(self,sender:id){
3691         msg_send![self, selectLastTabViewItem:sender]
3692     }
selectNextTabViewItem_(self, sender:id)3693     unsafe fn selectNextTabViewItem_(self, sender:id){
3694         msg_send![self, selectNextTabViewItem:sender]
3695     }
selectPreviousTabViewItem_(self,sender:id)3696     unsafe fn selectPreviousTabViewItem_(self,sender:id){
3697         msg_send![self, selectPreviousTabViewItem:sender]
3698     }
3699 
selectTabViewItem_(self,tabViewItem:id)3700     unsafe fn selectTabViewItem_(self,tabViewItem:id){
3701         msg_send![self, selectTabViewItem:tabViewItem]
3702     }
3703 
selectTabViewItemAtIndex_(self,index:id)3704     unsafe fn selectTabViewItemAtIndex_(self,index:id){
3705         msg_send![self, selectTabViewItemAtIndex:index]
3706     }
selectTabViewItemWithIdentifier_(self,identifier:id)3707     unsafe fn selectTabViewItemWithIdentifier_(self,identifier:id){
3708         msg_send![self, selectTabViewItemWithIdentifier:identifier]
3709     }
selectedTabViewItem(self) -> id3710     unsafe fn selectedTabViewItem(self) -> id{
3711         msg_send![self, selectedTabViewItem]
3712     }
takeSelectedTabViewItemFromSender_(self,sender:id)3713     unsafe fn takeSelectedTabViewItemFromSender_(self,sender:id){
3714         msg_send![self, takeSelectedTabViewItemFromSender:sender]
3715     }
3716 
font(self)->id3717     unsafe fn font(self)->id{
3718         msg_send![self, font]
3719     }
3720 
setFont_(self, font:id)3721     unsafe fn setFont_(self, font:id){
3722         msg_send![self, setFont:font]
3723     }
3724 
tabViewType(self)->NSTabViewType3725     unsafe fn tabViewType(self)->NSTabViewType{
3726         msg_send![self, tabViewType]
3727     }
setTabViewType_(self,tabViewType: NSTabViewType)3728     unsafe fn setTabViewType_(self,tabViewType: NSTabViewType){
3729         msg_send![self, setTabViewType:tabViewType]
3730     }
3731 
controlTint(self) -> id3732     unsafe fn controlTint(self) -> id{
3733         msg_send![self, controlTint]
3734     }
setControlTint_(self,controlTint:id)3735     unsafe fn setControlTint_(self,controlTint:id){
3736         msg_send![self, setControlTint:controlTint]
3737     }
3738 
drawsBackground(self) -> BOOL3739     unsafe fn drawsBackground(self) -> BOOL{
3740         msg_send![self, drawsBackground]
3741     }
setDrawsBackground_(self,drawsBackground:BOOL)3742     unsafe fn setDrawsBackground_(self,drawsBackground:BOOL){
3743         msg_send![self, setDrawsBackground:drawsBackground as libc::c_int]
3744     }
3745 
minimumSize(self) -> id3746     unsafe fn minimumSize(self) -> id{
3747         msg_send![self, minimumSize]
3748     }
contentRect(self) -> id3749     unsafe fn contentRect(self) -> id{
3750         msg_send![self, contentRect]
3751     }
controlSize(self) -> id3752     unsafe fn controlSize(self) -> id{
3753         msg_send![self, controlSize]
3754     }
setControlSize_(self,controlSize:id)3755     unsafe fn setControlSize_(self,controlSize:id){
3756         msg_send![self, setControlSize:controlSize]
3757     }
3758 
allowsTruncatedLabels(self) -> BOOL3759     unsafe fn allowsTruncatedLabels(self) -> BOOL{
3760         msg_send![self, allowsTruncatedLabels]
3761     }
setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL)3762     unsafe fn setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL){
3763         msg_send![self, setAllowsTruncatedLabels:allowTruncatedLabels as libc::c_int]
3764     }
3765 
setDelegate_(self, delegate:id)3766     unsafe fn setDelegate_(self, delegate:id){
3767         msg_send![self, setDelegate:delegate]
3768     }
delegate(self) -> id3769     unsafe fn delegate(self) -> id {
3770         msg_send![self, delegate]
3771     }
3772 
tabViewAtPoint_(self, point:id) -> id3773     unsafe fn tabViewAtPoint_(self, point:id) -> id{
3774         msg_send![self, tabViewAtPoint:point]
3775     }
3776 }
3777 
3778 #[repr(u64)]
3779 pub enum NSTabState {
3780     NSSelectedTab = 0,
3781     NSBackgroundTab = 1,
3782     NSPressedTab = 2
3783 }
3784 
3785 pub trait NSTabViewItem: Sized {
alloc(_: Self) -> id3786     unsafe fn alloc(_: Self) -> id {
3787         msg_send![class!(NSTabViewItem), alloc]
3788     }
new(_: Self) -> id3789     unsafe fn new(_: Self) -> id {
3790         msg_send![class!(NSTabViewItem), new]
3791     }
3792 
initWithIdentifier_(self, identifier:id) -> id3793     unsafe fn initWithIdentifier_(self, identifier:id) -> id;
drawLabel_inRect_(self,shouldTruncateLabel:BOOL,labelRect:NSRect)3794     unsafe fn drawLabel_inRect_(self,shouldTruncateLabel:BOOL,labelRect:NSRect);
label(self) -> id3795     unsafe fn label(self) -> id;
setLabel_(self,label:id)3796     unsafe fn setLabel_(self,label:id);
sizeOfLabel_(self, computeMin:BOOL)3797     unsafe fn sizeOfLabel_(self, computeMin:BOOL);
tabState(self) -> NSTabState3798     unsafe fn tabState(self) -> NSTabState;
identifier(self)-> id3799     unsafe fn identifier(self)-> id;
setIdentifier_(self,identifier:id)3800     unsafe fn setIdentifier_(self,identifier:id);
color(self)-> id3801     unsafe fn color(self)-> id;
setColor_(self,color:id)3802     unsafe fn setColor_(self,color:id);
view(self) -> id3803     unsafe fn view(self) -> id;
setView_(self, view:id)3804     unsafe fn setView_(self, view:id);
initialFirstResponder(self)->id3805     unsafe fn initialFirstResponder(self)->id;
setInitialFirstResponder_(self,initialFirstResponder:id)3806     unsafe fn setInitialFirstResponder_(self,initialFirstResponder:id);
tabView(self) -> id3807     unsafe fn tabView(self) -> id;
tooltip(self) -> id3808     unsafe fn tooltip(self) -> id;
setTooltip_(self,toolTip:id)3809     unsafe fn setTooltip_(self,toolTip:id);
3810 }
3811 
3812 impl NSTabViewItem for id {
initWithIdentifier_(self, identifier: id) -> id3813     unsafe fn initWithIdentifier_(self, identifier: id) -> id {
3814         msg_send![self, initWithIdentifier:identifier]
3815     }
3816 
drawLabel_inRect_(self, shouldTruncateLabel:BOOL,labelRect:NSRect)3817     unsafe fn drawLabel_inRect_(self, shouldTruncateLabel:BOOL,labelRect:NSRect){
3818         msg_send![self, drawLabel:shouldTruncateLabel as libc::c_int inRect:labelRect]
3819     }
3820 
label(self)->id3821     unsafe fn label(self)->id{
3822         msg_send![self, label]
3823     }
setLabel_(self,label : id)3824     unsafe fn setLabel_(self,label : id){
3825         msg_send![self, setLabel:label]
3826     }
3827 
sizeOfLabel_(self,computeMin:BOOL)3828     unsafe fn sizeOfLabel_(self,computeMin:BOOL){
3829         msg_send![self, sizeOfLabel:computeMin as libc::c_int]
3830     }
3831 
tabState(self) -> NSTabState3832     unsafe fn tabState(self) -> NSTabState{
3833         msg_send![self, tabState]
3834     }
3835 
identifier(self)-> id3836     unsafe fn identifier(self)-> id {
3837         msg_send![self, identifier]
3838     }
3839 
setIdentifier_(self,identifier:id)3840     unsafe fn setIdentifier_(self,identifier:id){
3841         msg_send![self, identifier:identifier]
3842     }
3843 
color(self)-> id3844     unsafe fn color(self)-> id{
3845         msg_send![self, color]
3846     }
3847 
setColor_(self,color:id)3848     unsafe fn setColor_(self,color:id){
3849         msg_send![self, color:color]
3850     }
3851 
view(self) -> id3852     unsafe fn view(self) -> id {
3853         msg_send![self, view]
3854     }
3855 
setView_(self, view:id)3856     unsafe fn setView_(self, view:id){
3857         msg_send![self, setView:view]
3858     }
3859 
initialFirstResponder(self)->id3860     unsafe fn initialFirstResponder(self)->id{
3861         msg_send![self, initialFirstResponder]
3862     }
3863 
setInitialFirstResponder_(self,initialFirstResponder:id)3864     unsafe fn setInitialFirstResponder_(self,initialFirstResponder:id){
3865         msg_send![self, setInitialFirstResponder:initialFirstResponder]
3866     }
3867 
tabView(self) -> id3868     unsafe fn tabView(self) -> id{
3869         msg_send![self, tabView]
3870     }
3871 
tooltip(self) -> id3872     unsafe fn tooltip(self) -> id{
3873         msg_send![self, tooltip]
3874     }
3875 
setTooltip_(self,toolTip:id)3876     unsafe fn setTooltip_(self,toolTip:id){
3877         msg_send![self, setTooltip:toolTip]
3878     }
3879 }
3880 
3881 pub trait NSLayoutConstraint: Sized {
activateConstraints(_: Self, constraints: id) -> id3882     unsafe fn activateConstraints(_: Self, constraints: id) -> id;
3883 }
3884 
3885 impl NSLayoutConstraint for id {
activateConstraints(_: Self, constraints: id) -> id3886     unsafe fn activateConstraints(_: Self, constraints: id) -> id {
3887         msg_send![class!(NSLayoutConstraint), activateConstraints:constraints]
3888     }
3889 }
3890 
3891 pub trait NSLayoutDimension: Sized {
constraintEqualToConstant(self, c: CGFloat) -> id3892     unsafe fn constraintEqualToConstant(self, c: CGFloat) -> id;
constraintLessThanOrEqualToConstant(self, c: CGFloat) -> id3893     unsafe fn constraintLessThanOrEqualToConstant(self, c: CGFloat) -> id;
constraintGreaterThanOrEqualToConstant(self, c: CGFloat) -> id3894     unsafe fn constraintGreaterThanOrEqualToConstant(self, c: CGFloat) -> id;
3895 }
3896 
3897 impl NSLayoutDimension for id {
constraintEqualToConstant(self, c: CGFloat) -> id3898     unsafe fn constraintEqualToConstant(self, c: CGFloat) -> id {
3899         msg_send![self, constraintEqualToConstant:c]
3900     }
3901 
constraintLessThanOrEqualToConstant(self, c: CGFloat) -> id3902     unsafe fn constraintLessThanOrEqualToConstant(self, c: CGFloat) -> id {
3903         msg_send![self, constraintLessThanOrEqualToConstant:c]
3904     }
3905 
constraintGreaterThanOrEqualToConstant(self, c: CGFloat) -> id3906     unsafe fn constraintGreaterThanOrEqualToConstant(self, c: CGFloat) -> id {
3907         msg_send![self, constraintGreaterThanOrEqualToConstant:c]
3908     }
3909 }
3910 
3911 pub trait NSColorSpace: Sized {
deviceRGBColorSpace(_:Self) -> id3912     unsafe fn deviceRGBColorSpace(_:Self) -> id;
genericRGBColorSpace(_:Self) -> id3913     unsafe fn genericRGBColorSpace(_:Self) -> id;
deviceCMYKColorSpace(_:Self) -> id3914     unsafe fn deviceCMYKColorSpace(_:Self) -> id;
genericCMYKColorSpace(_:Self) -> id3915     unsafe fn genericCMYKColorSpace(_:Self) -> id;
deviceGrayColorSpace(_:Self) -> id3916     unsafe fn deviceGrayColorSpace(_:Self) -> id;
genericGrayColorSpace(_:Self) -> id3917     unsafe fn genericGrayColorSpace(_:Self) -> id;
sRGBColorSpace(_:Self) -> id3918     unsafe fn sRGBColorSpace(_:Self) -> id;
extendedSRGBColorSpace(_:Self) -> id3919     unsafe fn extendedSRGBColorSpace(_:Self) -> id;
displayP3ColorSpace(_:Self) -> id3920     unsafe fn displayP3ColorSpace(_:Self) -> id;
genericGamma22GrayColorSpace(_:Self) -> id3921     unsafe fn genericGamma22GrayColorSpace(_:Self) -> id;
extendedGenericGamma22GrayColorSpace(_:Self) -> id3922     unsafe fn extendedGenericGamma22GrayColorSpace(_:Self) -> id;
adobeRGB1998ColorSpace(_:Self) -> id3923     unsafe fn adobeRGB1998ColorSpace(_:Self) -> id;
3924 
alloc(_: Self) -> id3925     unsafe fn alloc(_: Self) -> id;
3926 
initWithCGColorSpace_(self, cg_color_space: *const c_void ) -> id3927     unsafe fn initWithCGColorSpace_(self, cg_color_space: *const c_void /* (CGColorSpaceRef) */) -> id;
CGColorSpace(self) -> *const c_void3928     unsafe fn CGColorSpace(self) -> *const c_void /* (CGColorSpaceRef) */;
localizedName(self) -> id3929     unsafe fn localizedName(self) -> id;
3930 }
3931 
3932 impl NSColorSpace for id {
deviceRGBColorSpace(_:Self) -> id3933     unsafe fn deviceRGBColorSpace(_:Self) -> id {
3934         msg_send![class!(NSColorSpace), deviceRGBColorSpace]
3935     }
genericRGBColorSpace(_:Self) -> id3936     unsafe fn genericRGBColorSpace(_:Self) -> id {
3937         msg_send![class!(NSColorSpace), genericRGBColorSpace]
3938     }
deviceCMYKColorSpace(_:Self) -> id3939     unsafe fn deviceCMYKColorSpace(_:Self) -> id {
3940         msg_send![class!(NSColorSpace), deviceCMYKColorSpace]
3941     }
genericCMYKColorSpace(_:Self) -> id3942     unsafe fn genericCMYKColorSpace(_:Self) -> id {
3943         msg_send![class!(NSColorSpace), genericCMYKColorSpace]
3944     }
deviceGrayColorSpace(_:Self) -> id3945     unsafe fn deviceGrayColorSpace(_:Self) -> id {
3946         msg_send![class!(NSColorSpace), deviceGrayColorSpace]
3947     }
genericGrayColorSpace(_:Self) -> id3948     unsafe fn genericGrayColorSpace(_:Self) -> id {
3949         msg_send![class!(NSColorSpace), genericGrayColorSpace]
3950     }
sRGBColorSpace(_:Self) -> id3951     unsafe fn sRGBColorSpace(_:Self) -> id {
3952         msg_send![class!(NSColorSpace), sRGBColorSpace]
3953     }
extendedSRGBColorSpace(_:Self) -> id3954     unsafe fn extendedSRGBColorSpace(_:Self) -> id {
3955         msg_send![class!(NSColorSpace), extendedSRGBColorSpace]
3956     }
displayP3ColorSpace(_:Self) -> id3957     unsafe fn displayP3ColorSpace(_:Self) -> id {
3958         msg_send![class!(NSColorSpace), displayP3ColorSpace]
3959     }
genericGamma22GrayColorSpace(_:Self) -> id3960     unsafe fn genericGamma22GrayColorSpace(_:Self) -> id {
3961         msg_send![class!(NSColorSpace), genericGamma22GrayColorSpace]
3962     }
extendedGenericGamma22GrayColorSpace(_:Self) -> id3963     unsafe fn extendedGenericGamma22GrayColorSpace(_:Self) -> id {
3964         msg_send![class!(NSColorSpace), extendedGenericGamma22GrayColorSpace]
3965     }
adobeRGB1998ColorSpace(_:Self) -> id3966     unsafe fn adobeRGB1998ColorSpace(_:Self) -> id {
3967         msg_send![class!(NSColorSpace), adobeRGB1998ColorSpace]
3968     }
3969 
alloc(_: Self) -> id3970     unsafe fn alloc(_: Self) -> id {
3971         msg_send![class!(NSColorSpace), alloc]
3972     }
3973 
initWithCGColorSpace_(self, cg_color_space: *const c_void ) -> id3974     unsafe fn initWithCGColorSpace_(self, cg_color_space: *const c_void /* (CGColorSpaceRef) */) -> id {
3975         msg_send![self, initWithCGColorSpace:cg_color_space]
3976     }
CGColorSpace(self) -> *const c_void3977     unsafe fn CGColorSpace(self) -> *const c_void /* (CGColorSpaceRef) */ {
3978         msg_send![self, CGColorSpace]
3979     }
localizedName(self) -> id3980     unsafe fn localizedName(self) -> id {
3981         msg_send![self, localizedName]
3982     }
3983 }
3984 
3985 pub trait NSColor: Sized {
clearColor(_: Self) -> id3986     unsafe fn clearColor(_: Self) -> id;
colorWithRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id3987     unsafe fn colorWithRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id;
colorWithSRGBRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id3988     unsafe fn colorWithSRGBRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id;
colorWithDeviceRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id3989     unsafe fn colorWithDeviceRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id;
colorWithDisplayP3Red_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id3990     unsafe fn colorWithDisplayP3Red_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id;
colorWithCalibratedRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id3991     unsafe fn colorWithCalibratedRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id;
3992 
colorUsingColorSpace_(self, color_space: id) -> id3993     unsafe fn colorUsingColorSpace_(self, color_space: id) -> id;
3994 
alphaComponent(self) -> CGFloat3995     unsafe fn alphaComponent(self) -> CGFloat;
whiteComponent(self) -> CGFloat3996     unsafe fn whiteComponent(self) -> CGFloat;
redComponent(self) -> CGFloat3997     unsafe fn redComponent(self) -> CGFloat;
greenComponent(self) -> CGFloat3998     unsafe fn greenComponent(self) -> CGFloat;
blueComponent(self) -> CGFloat3999     unsafe fn blueComponent(self) -> CGFloat;
cyanComponent(self) -> CGFloat4000     unsafe fn cyanComponent(self) -> CGFloat;
magentaComponent(self) -> CGFloat4001     unsafe fn magentaComponent(self) -> CGFloat;
yellowComponent(self) -> CGFloat4002     unsafe fn yellowComponent(self) -> CGFloat;
blackComponent(self) -> CGFloat4003     unsafe fn blackComponent(self) -> CGFloat;
hueComponent(self) -> CGFloat4004     unsafe fn hueComponent(self) -> CGFloat;
saturationComponent(self) -> CGFloat4005     unsafe fn saturationComponent(self) -> CGFloat;
brightnessComponent(self) -> CGFloat4006     unsafe fn brightnessComponent(self) -> CGFloat;
4007 }
4008 
4009 impl NSColor for id {
clearColor(_: Self) -> id4010     unsafe fn clearColor(_: Self) -> id {
4011         msg_send![class!(NSColor), clearColor]
4012     }
colorWithRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id4013     unsafe fn colorWithRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id {
4014         msg_send![class!(NSColor), colorWithRed:r green:g blue:b alpha:a]
4015     }
colorWithSRGBRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id4016     unsafe fn colorWithSRGBRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id {
4017         msg_send![class!(NSColor), colorWithSRGBRed:r green:g blue:b alpha:a]
4018     }
colorWithDeviceRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id4019     unsafe fn colorWithDeviceRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id {
4020         msg_send![class!(NSColor), colorWithDeviceRed:r green:g blue:b alpha:a]
4021     }
colorWithDisplayP3Red_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id4022     unsafe fn colorWithDisplayP3Red_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id {
4023         msg_send![class!(NSColor), colorWithDisplayP3Red:r green:g blue:b alpha:a]
4024     }
colorWithCalibratedRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id4025     unsafe fn colorWithCalibratedRed_green_blue_alpha_(_:Self, r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> id {
4026         msg_send![class!(NSColor), colorWithCalibratedRed:r green:g blue:b alpha:a]
4027     }
4028 
colorUsingColorSpace_(self, color_space: id) -> id4029     unsafe fn colorUsingColorSpace_(self, color_space: id) -> id {
4030         msg_send![self, colorUsingColorSpace:color_space]
4031     }
4032 
alphaComponent(self) -> CGFloat4033     unsafe fn alphaComponent(self) -> CGFloat {
4034         msg_send![self, alphaComponent]
4035     }
whiteComponent(self) -> CGFloat4036     unsafe fn whiteComponent(self) -> CGFloat {
4037         msg_send![self, whiteComponent]
4038     }
redComponent(self) -> CGFloat4039     unsafe fn redComponent(self) -> CGFloat {
4040         msg_send![self, redComponent]
4041     }
greenComponent(self) -> CGFloat4042     unsafe fn greenComponent(self) -> CGFloat {
4043         msg_send![self, greenComponent]
4044     }
blueComponent(self) -> CGFloat4045     unsafe fn blueComponent(self) -> CGFloat {
4046         msg_send![self, blueComponent]
4047     }
cyanComponent(self) -> CGFloat4048     unsafe fn cyanComponent(self) -> CGFloat {
4049         msg_send![self, cyanComponent]
4050     }
magentaComponent(self) -> CGFloat4051     unsafe fn magentaComponent(self) -> CGFloat {
4052         msg_send![self, magentaComponent]
4053     }
yellowComponent(self) -> CGFloat4054     unsafe fn yellowComponent(self) -> CGFloat {
4055         msg_send![self, yellowComponent]
4056     }
blackComponent(self) -> CGFloat4057     unsafe fn blackComponent(self) -> CGFloat {
4058         msg_send![self, blackComponent]
4059     }
hueComponent(self) -> CGFloat4060     unsafe fn hueComponent(self) -> CGFloat {
4061         msg_send![self, hueComponent]
4062     }
saturationComponent(self) -> CGFloat4063     unsafe fn saturationComponent(self) -> CGFloat {
4064         msg_send![self, saturationComponent]
4065     }
brightnessComponent(self) -> CGFloat4066     unsafe fn brightnessComponent(self) -> CGFloat {
4067         msg_send![self, brightnessComponent]
4068     }
4069 }
4070 
4071 pub trait NSToolbar: Sized {
alloc(_: Self) -> id4072     unsafe fn alloc(_: Self) -> id {
4073         msg_send![class!(NSToolbar), alloc]
4074     }
4075 
init_(self) -> id4076     unsafe fn init_(self) -> id /* NSToolbar */;
initWithIdentifier_(self, identifier: id) -> id4077     unsafe fn initWithIdentifier_(self, identifier: id) -> id /* NSToolbar */;
4078 
showsBaselineSeparator(self) -> BOOL4079     unsafe fn showsBaselineSeparator(self) -> BOOL;
setShowsBaselineSeparator_(self, value: BOOL)4080     unsafe fn setShowsBaselineSeparator_(self, value: BOOL);
4081 }
4082 
4083 impl NSToolbar for id {
init_(self) -> id4084     unsafe fn init_(self) -> id /* NSToolbar */ {
4085         msg_send![self, init]
4086     }
4087 
initWithIdentifier_(self, identifier: id) -> id4088     unsafe fn initWithIdentifier_(self, identifier: id) -> id /* NSToolbar */ {
4089         msg_send![self, initWithIdentifier:identifier]
4090     }
4091 
showsBaselineSeparator(self) -> BOOL4092     unsafe fn showsBaselineSeparator(self) -> BOOL {
4093         msg_send![self, showsBaselineSeparator]
4094     }
4095 
setShowsBaselineSeparator_(self, value: BOOL)4096     unsafe fn setShowsBaselineSeparator_(self, value: BOOL) {
4097         msg_send![self, setShowsBaselineSeparator:value]
4098     }
4099 }
4100 
4101 pub trait NSSpellChecker : Sized {
sharedSpellChecker(_: Self) -> id4102     unsafe fn sharedSpellChecker(_: Self) -> id;
checkSpellingOfString_startingAt(self, stringToCheck: id, startingOffset: NSInteger) -> NSRange4103     unsafe fn checkSpellingOfString_startingAt(self,
4104                                                stringToCheck: id,
4105                                                startingOffset: NSInteger) -> NSRange;
checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount( self, stringToCheck: id, startingOffset: NSInteger, language: id, wrapFlag: BOOL, tag: NSInteger) -> (NSRange, NSInteger)4106     unsafe fn checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount(
4107         self,
4108         stringToCheck: id,
4109         startingOffset: NSInteger,
4110         language: id,
4111         wrapFlag: BOOL,
4112         tag: NSInteger) -> (NSRange, NSInteger);
uniqueSpellDocumentTag(_: Self) -> NSInteger4113     unsafe fn uniqueSpellDocumentTag(_: Self) -> NSInteger;
closeSpellDocumentWithTag(self, tag: NSInteger)4114     unsafe fn closeSpellDocumentWithTag(self, tag: NSInteger);
ignoreWord_inSpellDocumentWithTag(self, wordToIgnore: id, tag: NSInteger)4115     unsafe fn ignoreWord_inSpellDocumentWithTag(self, wordToIgnore: id, tag: NSInteger);
4116 }
4117 
4118 impl NSSpellChecker for id {
sharedSpellChecker(_: Self) -> id4119     unsafe fn sharedSpellChecker(_: Self) -> id {
4120         msg_send![class!(NSSpellChecker), sharedSpellChecker]
4121     }
4122 
checkSpellingOfString_startingAt(self, stringToCheck: id, startingOffset: NSInteger) -> NSRange4123     unsafe fn checkSpellingOfString_startingAt(self,
4124                                                stringToCheck: id,
4125                                                startingOffset: NSInteger) -> NSRange {
4126         msg_send![self, checkSpellingOfString:stringToCheck startingAt:startingOffset]
4127     }
4128 
checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount( self, stringToCheck: id, startingOffset: NSInteger, language: id, wrapFlag: BOOL, tag: NSInteger) -> (NSRange, NSInteger)4129     unsafe fn checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount(
4130         self,
4131         stringToCheck: id,
4132         startingOffset: NSInteger,
4133         language: id,
4134         wrapFlag: BOOL,
4135         tag: NSInteger) -> (NSRange, NSInteger) {
4136         let mut wordCount = 0;
4137         let range = msg_send![self,
4138             checkSpellingOfString:stringToCheck
4139             startingAt:startingOffset
4140             language:language
4141             wrap:wrapFlag
4142             inSpellDocumentWithTag:tag
4143             wordCount:&mut wordCount
4144         ];
4145         (range, wordCount)
4146     }
4147 
uniqueSpellDocumentTag(_: Self) -> NSInteger4148     unsafe fn uniqueSpellDocumentTag(_: Self) -> NSInteger {
4149         msg_send![class!(NSSpellChecker), uniqueSpellDocumentTag]
4150     }
4151 
closeSpellDocumentWithTag(self, tag: NSInteger)4152     unsafe fn closeSpellDocumentWithTag(self, tag: NSInteger) {
4153         msg_send![self, closeSpellDocumentWithTag:tag]
4154     }
4155 
ignoreWord_inSpellDocumentWithTag(self, wordToIgnore: id, tag: NSInteger)4156     unsafe fn ignoreWord_inSpellDocumentWithTag(self, wordToIgnore: id, tag: NSInteger) {
4157         msg_send![self, ignoreWord:wordToIgnore inSpellDocumentWithTag:tag]
4158     }
4159 }
4160 
4161 pub trait NSNib: Sized {
alloc(_: Self) -> id4162     unsafe fn alloc(_: Self) -> id {
4163         msg_send![class!(NSNib), alloc]
4164     }
4165 
initWithNibNamed_bundle_(self, name: id, bundle: id) -> id4166     unsafe fn initWithNibNamed_bundle_(self, name: id, bundle: id) -> id;
4167 }
4168 
4169 impl NSNib for id {
initWithNibNamed_bundle_(self, name: id, bundle: id) -> id4170     unsafe fn initWithNibNamed_bundle_(self, name: id, bundle: id) -> id {
4171         msg_send![self, initWithNibNamed:name bundle:bundle]
4172     }
4173 }
4174 
4175 
4176 #[cfg(test)]
4177 mod test {
4178     use super::*;
4179 
4180     #[test]
test_nsapp()4181     pub fn test_nsapp() {
4182         unsafe {
4183             let _nsApp = NSApp();
4184         }
4185     }
4186 }
4187