[
  {
    "path": ".gitignore",
    "content": "*~\nbuild\n/target\n/Cargo.lock\n"
  },
  {
    "path": ".travis.yml",
    "content": "os: osx\n\nlanguage: rust\n\nnotifications:\n  webhooks: http://build.servo.org:54856/travis\n"
  },
  {
    "path": "COPYRIGHT",
    "content": "Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\nhttp://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\noption. All files in the project carrying such notice may not be\ncopied, modified, or distributed except according to those terms.\n"
  },
  {
    "path": "Cargo.toml",
    "content": "\n[package]\nname = \"cocoa\"\ndescription = \"Bindings to Cocoa for OS X\"\nhomepage = \"https://github.com/servo/cocoa-rs\"\nrepository = \"https://github.com/servo/cocoa-rs\"\nversion = \"0.14.0\"\nauthors = [\"The Servo Project Developers\"]\nlicense = \"MIT / Apache-2.0\"\n\n[lib]\nname = \"cocoa\"\ncrate-type = [\"rlib\"]\n\n[dependencies]\nblock = \"0.1\"\nbitflags = \"1.0\"\nlibc = \"0.2\"\ncore-graphics = \"0.13\"\nobjc = \"0.2\"\n"
  },
  {
    "path": "LICENSE-APACHE",
    "content": "                              Apache License\n                        Version 2.0, January 2004\n                     http://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n   \"License\" shall mean the terms and conditions for use, reproduction,\n   and distribution as defined by Sections 1 through 9 of this document.\n\n   \"Licensor\" shall mean the copyright owner or entity authorized by\n   the copyright owner that is granting the License.\n\n   \"Legal Entity\" shall mean the union of the acting entity and all\n   other entities that control, are controlled by, or are under common\n   control with that entity. For the purposes of this definition,\n   \"control\" means (i) the power, direct or indirect, to cause the\n   direction or management of such entity, whether by contract or\n   otherwise, or (ii) ownership of fifty percent (50%) or more of the\n   outstanding shares, or (iii) beneficial ownership of such entity.\n\n   \"You\" (or \"Your\") shall mean an individual or Legal Entity\n   exercising permissions granted by this License.\n\n   \"Source\" form shall mean the preferred form for making modifications,\n   including but not limited to software source code, documentation\n   source, and configuration files.\n\n   \"Object\" form shall mean any form resulting from mechanical\n   transformation or translation of a Source form, including but\n   not limited to compiled object code, generated documentation,\n   and conversions to other media types.\n\n   \"Work\" shall mean the work of authorship, whether in Source or\n   Object form, made available under the License, as indicated by a\n   copyright notice that is included in or attached to the work\n   (an example is provided in the Appendix below).\n\n   \"Derivative Works\" shall mean any work, whether in Source or Object\n   form, that is based on (or derived from) the Work and for which the\n   editorial revisions, annotations, elaborations, or other modifications\n   represent, as a whole, an original work of authorship. For the purposes\n   of this License, Derivative Works shall not include works that remain\n   separable from, or merely link (or bind by name) to the interfaces of,\n   the Work and Derivative Works thereof.\n\n   \"Contribution\" shall mean any work of authorship, including\n   the original version of the Work and any modifications or additions\n   to that Work or Derivative Works thereof, that is intentionally\n   submitted to Licensor for inclusion in the Work by the copyright owner\n   or by an individual or Legal Entity authorized to submit on behalf of\n   the copyright owner. For the purposes of this definition, \"submitted\"\n   means any form of electronic, verbal, or written communication sent\n   to the Licensor or its representatives, including but not limited to\n   communication on electronic mailing lists, source code control systems,\n   and issue tracking systems that are managed by, or on behalf of, the\n   Licensor for the purpose of discussing and improving the Work, but\n   excluding communication that is conspicuously marked or otherwise\n   designated in writing by the copyright owner as \"Not a Contribution.\"\n\n   \"Contributor\" shall mean Licensor and any individual or Legal Entity\n   on behalf of whom a Contribution has been received by Licensor and\n   subsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\n   this License, each Contributor hereby grants to You a perpetual,\n   worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n   copyright license to reproduce, prepare Derivative Works of,\n   publicly display, publicly perform, sublicense, and distribute the\n   Work and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\n   this License, each Contributor hereby grants to You a perpetual,\n   worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n   (except as stated in this section) patent license to make, have made,\n   use, offer to sell, sell, import, and otherwise transfer the Work,\n   where such license applies only to those patent claims licensable\n   by such Contributor that are necessarily infringed by their\n   Contribution(s) alone or by combination of their Contribution(s)\n   with the Work to which such Contribution(s) was submitted. If You\n   institute patent litigation against any entity (including a\n   cross-claim or counterclaim in a lawsuit) alleging that the Work\n   or a Contribution incorporated within the Work constitutes direct\n   or contributory patent infringement, then any patent licenses\n   granted to You under this License for that Work shall terminate\n   as of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\n   Work or Derivative Works thereof in any medium, with or without\n   modifications, and in Source or Object form, provided that You\n   meet the following conditions:\n\n   (a) You must give any other recipients of the Work or\n       Derivative Works a copy of this License; and\n\n   (b) You must cause any modified files to carry prominent notices\n       stating that You changed the files; and\n\n   (c) You must retain, in the Source form of any Derivative Works\n       that You distribute, all copyright, patent, trademark, and\n       attribution notices from the Source form of the Work,\n       excluding those notices that do not pertain to any part of\n       the Derivative Works; and\n\n   (d) If the Work includes a \"NOTICE\" text file as part of its\n       distribution, then any Derivative Works that You distribute must\n       include a readable copy of the attribution notices contained\n       within such NOTICE file, excluding those notices that do not\n       pertain to any part of the Derivative Works, in at least one\n       of the following places: within a NOTICE text file distributed\n       as part of the Derivative Works; within the Source form or\n       documentation, if provided along with the Derivative Works; or,\n       within a display generated by the Derivative Works, if and\n       wherever such third-party notices normally appear. The contents\n       of the NOTICE file are for informational purposes only and\n       do not modify the License. You may add Your own attribution\n       notices within Derivative Works that You distribute, alongside\n       or as an addendum to the NOTICE text from the Work, provided\n       that such additional attribution notices cannot be construed\n       as modifying the License.\n\n   You may add Your own copyright statement to Your modifications and\n   may provide additional or different license terms and conditions\n   for use, reproduction, or distribution of Your modifications, or\n   for any such Derivative Works as a whole, provided Your use,\n   reproduction, and distribution of the Work otherwise complies with\n   the conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\n   any Contribution intentionally submitted for inclusion in the Work\n   by You to the Licensor shall be under the terms and conditions of\n   this License, without any additional terms or conditions.\n   Notwithstanding the above, nothing herein shall supersede or modify\n   the terms of any separate license agreement you may have executed\n   with Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\n   names, trademarks, service marks, or product names of the Licensor,\n   except as required for reasonable and customary use in describing the\n   origin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\n   agreed to in writing, Licensor provides the Work (and each\n   Contributor provides its Contributions) on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n   implied, including, without limitation, any warranties or conditions\n   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n   PARTICULAR PURPOSE. You are solely responsible for determining the\n   appropriateness of using or redistributing the Work and assume any\n   risks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\n   whether in tort (including negligence), contract, or otherwise,\n   unless required by applicable law (such as deliberate and grossly\n   negligent acts) or agreed to in writing, shall any Contributor be\n   liable to You for damages, including any direct, indirect, special,\n   incidental, or consequential damages of any character arising as a\n   result of this License or out of the use or inability to use the\n   Work (including but not limited to damages for loss of goodwill,\n   work stoppage, computer failure or malfunction, or any and all\n   other commercial damages or losses), even if such Contributor\n   has been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\n   the Work or Derivative Works thereof, You may choose to offer,\n   and charge a fee for, acceptance of support, warranty, indemnity,\n   or other liability obligations and/or rights consistent with this\n   License. However, in accepting such obligations, You may act only\n   on Your own behalf and on Your sole responsibility, not on behalf\n   of any other Contributor, and only if You agree to indemnify,\n   defend, and hold each Contributor harmless for any liability\n   incurred by, or claims asserted against, such Contributor by reason\n   of your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nAPPENDIX: How to apply the Apache License to your work.\n\n   To apply the Apache License to your work, attach the following\n   boilerplate notice, with the fields enclosed by brackets \"[]\"\n   replaced with your own identifying information. (Don't include\n   the brackets!)  The text should be enclosed in the appropriate\n   comment syntax for the file format. We also recommend that a\n   file or class name and description of purpose be included on the\n   same \"printed page\" as the copyright notice for easier\n   identification within third-party archives.\n\nCopyright [yyyy] [name of copyright owner]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n\thttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n"
  },
  {
    "path": "LICENSE-MIT",
    "content": "Copyright (c) 2012-2013 Mozilla Foundation\n\nPermission is hereby granted, free of charge, to any\nperson obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the\nSoftware without restriction, including without\nlimitation the rights to use, copy, modify, merge,\npublish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software\nis furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice\nshall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF\nANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\nPARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\nSHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR\nIN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "Cocoa-rs\n--------\n\nThis repository has been merged into the [core-foundation](https://github.com/servo/core-foundation-rs/tree/master/cocoa) repository and is now outdated.\n"
  },
  {
    "path": "examples/hello_world.rs",
    "content": "extern crate cocoa;\n\nuse cocoa::base::{selector, nil, NO};\nuse cocoa::foundation::{NSRect, NSPoint, NSSize, NSAutoreleasePool, NSProcessInfo,\n                        NSString};\nuse cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular, NSWindow,\n                    NSBackingStoreBuffered, NSMenu, NSMenuItem, NSWindowStyleMask,\n                    NSRunningApplication, NSApplicationActivateIgnoringOtherApps};\n\nfn main() {\n    unsafe {\n        let _pool = NSAutoreleasePool::new(nil);\n\n        let app = NSApp();\n        app.setActivationPolicy_(NSApplicationActivationPolicyRegular);\n\n        // create Menu Bar\n        let menubar = NSMenu::new(nil).autorelease();\n        let app_menu_item = NSMenuItem::new(nil).autorelease();\n        menubar.addItem_(app_menu_item);\n        app.setMainMenu_(menubar);\n\n        // create Application menu\n        let app_menu = NSMenu::new(nil).autorelease();\n        let quit_prefix = NSString::alloc(nil).init_str(\"Quit \");\n        let quit_title =\n            quit_prefix.stringByAppendingString_(NSProcessInfo::processInfo(nil).processName());\n        let quit_action = selector(\"terminate:\");\n        let quit_key = NSString::alloc(nil).init_str(\"q\");\n        let quit_item = NSMenuItem::alloc(nil)\n            .initWithTitle_action_keyEquivalent_(quit_title, quit_action, quit_key)\n            .autorelease();\n        app_menu.addItem_(quit_item);\n        app_menu_item.setSubmenu_(app_menu);\n\n        // create Window\n        let window = NSWindow::alloc(nil)\n            .initWithContentRect_styleMask_backing_defer_(NSRect::new(NSPoint::new(0., 0.),\n                                                                      NSSize::new(200., 200.)),\n                                                          NSWindowStyleMask::NSTitledWindowMask,\n                                                          NSBackingStoreBuffered,\n                                                          NO)\n            .autorelease();\n        window.cascadeTopLeftFromPoint_(NSPoint::new(20., 20.));\n        window.center();\n        let title = NSString::alloc(nil).init_str(\"Hello World!\");\n        window.setTitle_(title);\n        window.makeKeyAndOrderFront_(nil);\n        let current_app = NSRunningApplication::currentApplication(nil);\n        current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);\n        app.run();\n    }\n}\n"
  },
  {
    "path": "examples/tab_view.rs",
    "content": "extern crate cocoa;\n\nuse cocoa::base::{selector, id, nil, NO};\n\n\nuse cocoa::foundation::{NSRect, NSPoint, NSSize, NSAutoreleasePool, NSProcessInfo,\n                        NSString};\nuse cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular, NSWindow,\n                    NSMenu, NSMenuItem, NSTabView, NSWindowStyleMask, NSBackingStoreType,\n                    NSTabViewItem, NSRunningApplication, NSApplicationActivateIgnoringOtherApps};\n\n\nfn main() {\n    unsafe {\n\n        // create a tab View\n        let tab_view = NSTabView::new(nil)\n            .initWithFrame_(NSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)));\n\n        // create a tab view item\n        let tab_view_item = NSTabViewItem::new(nil)\n            .initWithIdentifier_(NSString::alloc(nil).init_str(\"TabView1\"));\n\n        tab_view_item.setLabel_(NSString::alloc(nil).init_str(\"Tab view item 1\"));\n        tab_view.addTabViewItem_(tab_view_item);\n\n        // create a second tab view item\n        let tab_view_item2 = NSTabViewItem::new(nil)\n            .initWithIdentifier_(NSString::alloc(nil).init_str(\"TabView2\"));\n\n        tab_view_item2.setLabel_(NSString::alloc(nil).init_str(\"Tab view item 2\"));\n        tab_view.addTabViewItem_(tab_view_item2);\n\n        // Create the app and set the content.\n        let app = create_app(NSString::alloc(nil).init_str(\"Tab View\"), tab_view);\n        app.run();\n    }\n}\n\nunsafe fn create_app(title: id, content: id) -> id {\n    let _pool = NSAutoreleasePool::new(nil);\n\n    let app = NSApp();\n    app.setActivationPolicy_(NSApplicationActivationPolicyRegular);\n\n    // create Menu Bar\n    let menubar = NSMenu::new(nil).autorelease();\n    let app_menu_item = NSMenuItem::new(nil).autorelease();\n    menubar.addItem_(app_menu_item);\n    app.setMainMenu_(menubar);\n\n    // create Application menu\n    let app_menu = NSMenu::new(nil).autorelease();\n    let quit_prefix = NSString::alloc(nil).init_str(\"Quit \");\n    let quit_title =\n        quit_prefix.stringByAppendingString_(NSProcessInfo::processInfo(nil).processName());\n    let quit_action = selector(\"terminate:\");\n    let quit_key = NSString::alloc(nil).init_str(\"q\");\n    let quit_item = NSMenuItem::alloc(nil)\n        .initWithTitle_action_keyEquivalent_(quit_title, quit_action, quit_key)\n        .autorelease();\n    app_menu.addItem_(quit_item);\n    app_menu_item.setSubmenu_(app_menu);\n\n    // create Window\n    let window = NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_(\n\t\tNSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)),\n\t\tNSWindowStyleMask::NSTitledWindowMask |\n            NSWindowStyleMask::NSClosableWindowMask |\n            NSWindowStyleMask::NSResizableWindowMask |\n            NSWindowStyleMask::NSMiniaturizableWindowMask |\n            NSWindowStyleMask::NSUnifiedTitleAndToolbarWindowMask,\n\t\tNSBackingStoreType::NSBackingStoreBuffered,\n\t\tNO\n\t).autorelease();\n    window.cascadeTopLeftFromPoint_(NSPoint::new(20., 20.));\n    window.center();\n\n    window.setTitle_(title);\n    window.makeKeyAndOrderFront_(nil);\n\n    window.setContentView_(content);\n    let current_app = NSRunningApplication::currentApplication(nil);\n    current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);\n\n    return app;\n}\n"
  },
  {
    "path": "src/appkit.rs",
    "content": "// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\n#![allow(non_upper_case_globals)]\n\nuse base::{id, class, BOOL, SEL};\nuse block::Block;\nuse foundation::{NSInteger, NSUInteger, NSTimeInterval,\n                 NSPoint, NSSize, NSRect, NSRectEdge};\nuse libc;\n\npub use core_graphics::base::CGFloat;\npub use core_graphics::geometry::CGPoint;\n\npub use self::NSApplicationActivationPolicy::*;\npub use self::NSApplicationActivationOptions::*;\npub use self::NSBackingStoreType::*;\npub use self::NSOpenGLPixelFormatAttribute::*;\npub use self::NSOpenGLPFAOpenGLProfiles::*;\npub use self::NSEventType::*;\n\npub type CGLContextObj = *mut libc::c_void;\n\npub type GLint = libc::int32_t;\n\n#[link(name = \"AppKit\", kind = \"framework\")]\nextern {\n    pub static NSAppKitVersionNumber: f64;\n\n    // Types for Standard Data - OS X v10.6 and later. (NSString *const)\n    pub static NSPasteboardTypeString: id;\n    pub static NSPasteboardTypePDF: id;\n    pub static NSPasteboardTypeTIFF: id;\n    pub static NSPasteboardTypePNG: id;\n    pub static NSPasteboardTypeRTF: id;\n    pub static NSPasteboardTypeRTFD: id;\n    pub static NSPasteboardTypeHTML: id;\n    pub static NSPasteboardTypeTabularText: id;\n    pub static NSPasteboardTypeFont: id;\n    pub static NSPasteboardTypeRuler: id;\n    pub static NSPasteboardTypeColor: id;\n    pub static NSPasteboardTypeSound: id;\n    pub static NSPasteboardTypeMultipleTextSelection: id;\n    pub static NSPasteboardTypeFindPanelSearchOptions: id;\n\n    // Types for Standard Data - OS X v10.5 and earlier. (NSString *)\n    pub static NSStringPboardType: id;\n    pub static NSFilenamesPboardType: id;\n    pub static NSPostScriptPboardType: id;\n    pub static NSTIFFPboardType: id;\n    pub static NSRTFPboardType: id;\n    pub static NSTabularTextPboardType: id;\n    pub static NSFontPboardType: id;\n    pub static NSRulerPboardType: id;\n    pub static NSFileContentsPboardType: id;\n    pub static NSColorPboardType: id;\n    pub static NSRTFDPboardType: id;\n    pub static NSHTMLPboardType: id;\n    pub static NSPICTPboardType: id;\n    pub static NSURLPboardType: id;\n    pub static NSPDFPboardType: id;\n    pub static NSVCardPboardType: id;\n    pub static NSFilesPromisePboardType: id;\n    pub static NSMultipleTextSelectionPboardType: id;\n    pub static NSSoundPboardType: id;\n\n    // Names of provided pasteboards. (NSString *)\n    pub static NSGeneralPboard: id;\n    pub static NSFontPboard: id;\n    pub static NSRulerPboard: id;\n    pub static NSFindPboard: id;\n    pub static NSDragPboard: id;\n\n    // Pasteboard reading options - OS X v10.6 and later. (NSString *)\n    pub static NSPasteboardURLReadingFileURLsOnlyKey: id;\n    pub static NSPasteboardURLReadingContentsConformToTypesKey: id;\n\n    // NSAppearance names. (NSString *)\n    pub static NSAppearanceNameVibrantDark: id;\n    pub static NSAppearanceNameVibrantLight: id;\n}\n\npub const NSAppKitVersionNumber10_0: f64 = 577.0;\npub const NSAppKitVersionNumber10_1: f64 = 620.0;\npub const NSAppKitVersionNumber10_2: f64 = 663.0;\npub const NSAppKitVersionNumber10_2_3: f64 = 663.6;\npub const NSAppKitVersionNumber10_3: f64 = 743.0;\npub const NSAppKitVersionNumber10_3_2: f64 = 743.14;\npub const NSAppKitVersionNumber10_3_3: f64 = 743.2;\npub const NSAppKitVersionNumber10_3_5: f64 = 743.24;\npub const NSAppKitVersionNumber10_3_7: f64 = 743.33;\npub const NSAppKitVersionNumber10_3_9: f64 = 743.36;\npub const NSAppKitVersionNumber10_4: f64 = 824.0;\npub const NSAppKitVersionNumber10_4_1: f64 = 824.1;\npub const NSAppKitVersionNumber10_4_3: f64 = 824.23;\npub const NSAppKitVersionNumber10_4_4: f64 = 824.33;\npub const NSAppKitVersionNumber10_4_7: f64 = 824.41;\npub const NSAppKitVersionNumber10_5: f64 = 949.0;\npub const NSAppKitVersionNumber10_5_2: f64 = 949.27;\npub const NSAppKitVersionNumber10_5_3: f64 = 949.33;\npub const NSAppKitVersionNumber10_6: f64 = 1038.0;\npub const NSAppKitVersionNumber10_7: f64 = 1138.0;\npub const NSAppKitVersionNumber10_7_2: f64 = 1138.23;\npub const NSAppKitVersionNumber10_7_3: f64 = 1138.32;\npub const NSAppKitVersionNumber10_7_4: f64 = 1138.47;\npub const NSAppKitVersionNumber10_8: f64 = 1187.0;\npub const NSAppKitVersionNumber10_9: f64 = 1265.0;\n\npub unsafe fn NSApp() -> id {\n    msg_send![class(\"NSApplication\"), sharedApplication]\n}\n\n#[repr(i64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSApplicationActivationPolicy {\n    NSApplicationActivationPolicyRegular = 0,\n    NSApplicationActivationPolicyAccessory = 1,\n    NSApplicationActivationPolicyProhibited = 2,\n    NSApplicationActivationPolicyERROR = -1\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSApplicationActivationOptions {\n    NSApplicationActivateAllWindows = 1 << 0,\n    NSApplicationActivateIgnoringOtherApps = 1 << 1\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSApplicationTerminateReply {\n    NSTerminateCancel = 0,\n    NSTerminateNow = 1,\n    NSTerminateLater = 2,\n}\n\nbitflags! {\n    pub struct NSWindowStyleMask: NSUInteger {\n        const NSBorderlessWindowMask      = 0;\n        const NSTitledWindowMask          = 1 << 0;\n        const NSClosableWindowMask        = 1 << 1;\n        const NSMiniaturizableWindowMask  = 1 << 2;\n        const NSResizableWindowMask       = 1 << 3;\n\n        const NSTexturedBackgroundWindowMask  = 1 << 8;\n\n        const NSUnifiedTitleAndToolbarWindowMask  = 1 << 12;\n\n        const NSFullScreenWindowMask      = 1 << 14;\n\n        const NSFullSizeContentViewWindowMask = 1 << 15;\n    }\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSWindowTitleVisibility {\n    NSWindowTitleVisible = 0,\n    NSWindowTitleHidden = 1\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSBackingStoreType {\n    NSBackingStoreRetained      = 0,\n    NSBackingStoreNonretained   = 1,\n    NSBackingStoreBuffered      = 2\n}\n\nbitflags! {\n    pub struct NSWindowOrderingMode: NSInteger {\n        const NSWindowAbove =  1;\n        const NSWindowBelow = -1;\n        const NSWindowOut   =  0;\n    }\n}\n\nbitflags! {\n    pub struct NSAlignmentOptions: libc::c_ulonglong {\n        const NSAlignMinXInward         = 1 << 0;\n        const NSAlignMinYInward         = 1 << 1;\n        const NSAlignMaxXInward         = 1 << 2;\n        const NSAlignMaxYInward         = 1 << 3;\n        const NSAlignWidthInward        = 1 << 4;\n        const NSAlignHeightInward       = 1 << 5;\n        const NSAlignMinXOutward        = 1 << 8;\n        const NSAlignMinYOutward        = 1 << 9;\n        const NSAlignMaxXOutward        = 1 << 10;\n        const NSAlignMaxYOutward        = 1 << 11;\n        const NSAlignWidthOutward       = 1 << 12;\n        const NSAlignHeightOutward      = 1 << 13;\n        const NSAlignMinXNearest        = 1 << 16;\n        const NSAlignMinYNearest        = 1 << 17;\n        const NSAlignMaxXNearest        = 1 << 18;\n        const NSAlignMaxYNearest        = 1 << 19;\n        const NSAlignWidthNearest       = 1 << 20;\n        const NSAlignHeightNearest      = 1 << 21;\n        const NSAlignRectFlipped        = 1 << 63;\n        const NSAlignAllEdgesInward     = NSAlignmentOptions::NSAlignMinXInward.bits\n                                        | NSAlignmentOptions::NSAlignMaxXInward.bits\n                                        | NSAlignmentOptions::NSAlignMinYInward.bits\n                                        | NSAlignmentOptions::NSAlignMaxYInward.bits;\n        const NSAlignAllEdgesOutward    = NSAlignmentOptions::NSAlignMinXOutward.bits\n                                        | NSAlignmentOptions::NSAlignMaxXOutward.bits\n                                        | NSAlignmentOptions::NSAlignMinYOutward.bits\n                                        | NSAlignmentOptions::NSAlignMaxYOutward.bits;\n        const NSAlignAllEdgesNearest    = NSAlignmentOptions::NSAlignMinXNearest.bits\n                                        | NSAlignmentOptions::NSAlignMaxXNearest.bits\n                                        | NSAlignmentOptions::NSAlignMinYNearest.bits\n                                        | NSAlignmentOptions::NSAlignMaxYNearest.bits;\n    }\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSOpenGLPixelFormatAttribute {\n    NSOpenGLPFAAllRenderers             = 1,\n    NSOpenGLPFATripleBuffer             = 3,\n    NSOpenGLPFADoubleBuffer             = 5,\n    NSOpenGLPFAStereo                   = 6,\n    NSOpenGLPFAAuxBuffers               = 7,\n    NSOpenGLPFAColorSize                = 8,\n    NSOpenGLPFAAlphaSize                = 11,\n    NSOpenGLPFADepthSize                = 12,\n    NSOpenGLPFAStencilSize              = 13,\n    NSOpenGLPFAAccumSize                = 14,\n    NSOpenGLPFAMinimumPolicy            = 51,\n    NSOpenGLPFAMaximumPolicy            = 52,\n    NSOpenGLPFAOffScreen                = 53,\n    NSOpenGLPFAFullScreen               = 54,\n    NSOpenGLPFASampleBuffers            = 55,\n    NSOpenGLPFASamples                  = 56,\n    NSOpenGLPFAAuxDepthStencil          = 57,\n    NSOpenGLPFAColorFloat               = 58,\n    NSOpenGLPFAMultisample              = 59,\n    NSOpenGLPFASupersample              = 60,\n    NSOpenGLPFASampleAlpha              = 61,\n    NSOpenGLPFARendererID               = 70,\n    NSOpenGLPFASingleRenderer           = 71,\n    NSOpenGLPFANoRecovery               = 72,\n    NSOpenGLPFAAccelerated              = 73,\n    NSOpenGLPFAClosestPolicy            = 74,\n    NSOpenGLPFARobust                   = 75,\n    NSOpenGLPFABackingStore             = 76,\n    NSOpenGLPFAMPSafe                   = 78,\n    NSOpenGLPFAWindow                   = 80,\n    NSOpenGLPFAMultiScreen              = 81,\n    NSOpenGLPFACompliant                = 83,\n    NSOpenGLPFAScreenMask               = 84,\n    NSOpenGLPFAPixelBuffer              = 90,\n    NSOpenGLPFARemotePixelBuffer        = 91,\n    NSOpenGLPFAAllowOfflineRenderers    = 96,\n    NSOpenGLPFAAcceleratedCompute       = 97,\n    NSOpenGLPFAOpenGLProfile            = 99,\n    NSOpenGLPFAVirtualScreenCount       = 128,\n}\n\n#[repr(u64)]\n#[allow(non_camel_case_types)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSOpenGLPFAOpenGLProfiles {\n    NSOpenGLProfileVersionLegacy = 0x1000,\n    NSOpenGLProfileVersion3_2Core = 0x3200,\n    NSOpenGLProfileVersion4_1Core = 0x4100,\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSOpenGLContextParameter {\n    NSOpenGLCPSwapInterval          = 222,\n    NSOpenGLCPSurfaceOrder          = 235,\n    NSOpenGLCPSurfaceOpacity        = 236,\n    NSOpenGLCPSurfaceBackingSize    = 304,\n    NSOpenGLCPReclaimResources      = 308,\n    NSOpenGLCPCurrentRendererID     = 309,\n    NSOpenGLCPGPUVertexProcessing   = 310,\n    NSOpenGLCPGPUFragmentProcessing = 311,\n    NSOpenGLCPHasDrawable           = 314,\n    NSOpenGLCPMPSwapsInFlight       = 315,\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSWindowButton {\n    NSWindowCloseButton            = 0,\n    NSWindowMiniaturizeButton      = 1,\n    NSWindowZoomButton             = 2,\n    NSWindowToolbarButton          = 3,\n    NSWindowDocumentIconButton     = 4,\n    NSWindowDocumentVersionsButton = 6,\n    NSWindowFullScreenButton       = 7,\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSBezelStyle {\n    NSRoundedBezelStyle            = 1,\n    NSRegularSquareBezelStyle      = 2,\n    NSDisclosureBezelStyle         = 5,\n    NSShadowlessSquareBezelStyle   = 6,\n    NSCircularBezelStyle           = 7,\n    NSTexturedSquareBezelStyle     = 8,\n    NSHelpButtonBezelStyle         = 9,\n    NSSmallSquareBezelStyle        = 10,\n    NSTexturedRoundedBezelStyle    = 11,\n    NSRoundRectBezelStyle          = 12,\n    NSRecessedBezelStyle           = 13,\n    NSRoundedDisclosureBezelStyle  = 14,\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSRequestUserAttentionType {\n    NSCriticalRequest      = 0,\n    NSInformationalRequest = 10,\n}\n\npub static NSMainMenuWindowLevel: libc::int32_t = 24;\n\npub trait NSApplication: Sized {\n    unsafe fn sharedApplication(_: Self) -> id {\n        msg_send![class(\"NSApplication\"), sharedApplication]\n    }\n\n    unsafe fn mainMenu(self) -> id;\n    unsafe fn setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> BOOL;\n    unsafe fn setMainMenu_(self, menu: id);\n    unsafe fn setServicesMenu_(self, menu: id);\n    unsafe fn setWindowsMenu_(self, menu: id);\n    unsafe fn activateIgnoringOtherApps_(self, ignore: BOOL);\n    unsafe fn run(self);\n    unsafe fn finishLaunching(self);\n    unsafe fn nextEventMatchingMask_untilDate_inMode_dequeue_(self,\n                                                              mask: NSUInteger,\n                                                              expiration: id,\n                                                              in_mode: id,\n                                                              dequeue: BOOL) -> id;\n    unsafe fn sendEvent_(self, an_event: id);\n    unsafe fn postEvent_atStart_(self, anEvent: id, flag: BOOL);\n    unsafe fn stop_(self, sender: id);\n    unsafe fn setApplicationIconImage_(self, image: id);\n    unsafe fn requestUserAttention_(self, requestType: NSRequestUserAttentionType);\n}\n\nimpl NSApplication for id {\n    unsafe fn mainMenu(self) -> id {\n        msg_send![self, mainMenu]\n    }\n\n    unsafe fn setActivationPolicy_(self, policy: NSApplicationActivationPolicy) -> BOOL {\n        msg_send![self, setActivationPolicy:policy as NSInteger]\n    }\n\n    unsafe fn setMainMenu_(self, menu: id) {\n        msg_send![self, setMainMenu:menu]\n    }\n\n    unsafe fn setServicesMenu_(self, menu: id) {\n        msg_send![self, setServicesMenu:menu]\n    }\n\n    unsafe fn setWindowsMenu_(self, menu: id) {\n        msg_send![self, setWindowsMenu:menu]\n    }\n\n    unsafe fn activateIgnoringOtherApps_(self, ignore: BOOL) {\n        msg_send![self, activateIgnoringOtherApps:ignore]\n    }\n\n    unsafe fn run(self) {\n        msg_send![self, run]\n    }\n\n    unsafe fn finishLaunching(self) {\n        msg_send![self, finishLaunching]\n    }\n\n    unsafe fn nextEventMatchingMask_untilDate_inMode_dequeue_(self,\n                                                              mask: NSUInteger,\n                                                              expiration: id,\n                                                              in_mode: id,\n                                                              dequeue: BOOL) -> id {\n        msg_send![self, nextEventMatchingMask:mask\n                                    untilDate:expiration\n                                       inMode:in_mode\n                                      dequeue:dequeue]\n    }\n\n    unsafe fn sendEvent_(self, an_event: id) {\n        msg_send![self, sendEvent:an_event]\n    }\n\n    unsafe fn postEvent_atStart_(self, anEvent: id, flag: BOOL) {\n        msg_send![self, postEvent:anEvent atStart:flag]\n    }\n\n    unsafe fn stop_(self, sender: id) {\n        msg_send![self, stop:sender]\n    }\n\n    unsafe fn setApplicationIconImage_(self, icon: id) {\n        msg_send![self, setApplicationIconImage:icon]\n    }\n\n    unsafe fn requestUserAttention_(self, requestType: NSRequestUserAttentionType) {\n        msg_send![self, requestUserAttention:requestType]\n    }\n}\n\npub trait NSRunningApplication: Sized {\n    unsafe fn currentApplication(_: Self) -> id {\n        msg_send![class(\"NSRunningApplication\"), currentApplication]\n    }\n    unsafe fn activateWithOptions_(self, options: NSApplicationActivationOptions) -> BOOL;\n}\n\nimpl NSRunningApplication for id {\n    unsafe fn activateWithOptions_(self, options: NSApplicationActivationOptions) -> BOOL {\n        msg_send![self, activateWithOptions:options as NSUInteger]\n    }\n}\n\npub trait NSPasteboard: Sized {\n    unsafe fn generalPasteboard(_: Self) -> id {\n        msg_send![class(\"NSPasteboard\"), generalPasteboard]\n    }\n\n    unsafe fn pasteboardByFilteringData_ofType(_: Self, data: id, _type: id) -> id {\n        msg_send![class(\"NSPasteboard\"), pasteboardByFilteringData:data ofType:_type]\n    }\n\n    unsafe fn pasteboardByFilteringFile(_: Self, file: id) -> id {\n        msg_send![class(\"NSPasteboard\"), pasteboardByFilteringFile:file]\n    }\n\n    unsafe fn pasteboardByFilteringTypesInPasteboard(_: Self, pboard: id) -> id {\n        msg_send![class(\"NSPasteboard\"), pasteboardByFilteringTypesInPasteboard:pboard]\n    }\n\n    unsafe fn pasteboardWithName(_: Self, name: id) -> id {\n        msg_send![class(\"NSPasteboard\"), pasteboardWithName:name]\n    }\n\n    unsafe fn pasteboardWithUniqueName(_: Self) -> id {\n        msg_send![class(\"NSPasteboard\"), pasteboardWithUniqueName]\n    }\n\n    unsafe fn releaseGlobally(self);\n\n    unsafe fn clearContents(self) -> NSInteger;\n    unsafe fn writeObjects(self, objects: id) -> BOOL;\n    unsafe fn sendData_forType(self, data: id, dataType: id) -> BOOL;\n    unsafe fn setPropertyList_forType(self, plist: id, dataType: id) -> BOOL;\n    unsafe fn setString_forType(self, string: id, dataType: id) -> BOOL;\n\n    unsafe fn readObjectsForClasses_options(self, classArray: id, options: id) -> id;\n    unsafe fn pasteboardItems(self) -> id;\n    unsafe fn indexOfPasteboardItem(self, pasteboardItem: id) -> NSInteger;\n    unsafe fn dataForType(self, dataType: id) -> id;\n    unsafe fn propertyListForType(self, dataType: id) -> id;\n    unsafe fn stringForType(self, dataType: id) -> id;\n\n    unsafe fn availableTypeFromArray(self, types: id) -> id;\n    unsafe fn canReadItemWithDataConformingToTypes(self, types: id) -> BOOL;\n    unsafe fn canReadObjectForClasses_options(self, classArray: id, options: id) -> BOOL;\n    unsafe fn types(self) -> id;\n    unsafe fn typesFilterableTo(_: Self, _type: id) -> id {\n        msg_send![class(\"NSPasteboard\"), typesFilterableTo:_type]\n    }\n\n    unsafe fn name(self) -> id;\n    unsafe fn changeCount(self) -> NSInteger;\n\n    unsafe fn declareTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger;\n    unsafe fn addTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger;\n    unsafe fn writeFileContents(self, filename: id) -> BOOL;\n    unsafe fn writeFileWrapper(self, wrapper: id) -> BOOL;\n\n    unsafe fn readFileContentsType_toFile(self, _type: id, filename: id) -> id;\n    unsafe fn readFileWrapper(self) -> id;\n}\n\nimpl NSPasteboard for id {\n    unsafe fn releaseGlobally(self) {\n        msg_send![self, releaseGlobally];\n    }\n\n    unsafe fn clearContents(self) -> NSInteger {\n        msg_send![self, clearContents]\n    }\n\n    unsafe fn writeObjects(self, objects: id) -> BOOL {\n        msg_send![self, writeObjects:objects]\n    }\n\n    unsafe fn sendData_forType(self, data: id, dataType: id) -> BOOL {\n        msg_send![self, sendData:data forType:dataType]\n    }\n\n    unsafe fn setPropertyList_forType(self, plist: id, dataType: id) -> BOOL {\n        msg_send![self, setPropertyList:plist forType:dataType]\n    }\n\n    unsafe fn setString_forType(self, string: id, dataType: id) -> BOOL {\n        msg_send![self, setString:string forType:dataType]\n    }\n\n    unsafe fn readObjectsForClasses_options(self, classArray: id, options: id) -> id {\n        msg_send![self, readObjectsForClasses:classArray options:options]\n    }\n\n    unsafe fn pasteboardItems(self) -> id {\n        msg_send![self, pasteboardItems]\n    }\n\n    unsafe fn indexOfPasteboardItem(self, pasteboardItem: id) -> NSInteger {\n        msg_send![self, indexOfPasteboardItem:pasteboardItem]\n    }\n\n    unsafe fn dataForType(self, dataType: id) -> id {\n        msg_send![self, dataForType:dataType]\n    }\n\n    unsafe fn propertyListForType(self, dataType: id) -> id {\n        msg_send![self, propertyListForType:dataType]\n    }\n\n    unsafe fn stringForType(self, dataType: id) -> id {\n        msg_send![self, stringForType:dataType]\n    }\n\n    unsafe fn availableTypeFromArray(self, types: id) -> id {\n        msg_send![self, availableTypeFromArray:types]\n    }\n\n    unsafe fn canReadItemWithDataConformingToTypes(self, types: id) -> BOOL {\n        msg_send![self, canReadItemWithDataConformingToTypes:types]\n    }\n\n    unsafe fn canReadObjectForClasses_options(self, classArray: id, options: id) -> BOOL {\n        msg_send![self, canReadObjectForClasses:classArray options:options]\n    }\n\n    unsafe fn types(self) -> id {\n        msg_send![self, types]\n    }\n\n    unsafe fn name(self) -> id {\n        msg_send![self, name]\n    }\n\n    unsafe fn changeCount(self) -> NSInteger {\n        msg_send![self, changeCount]\n    }\n\n    unsafe fn declareTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger {\n        msg_send![self, declareTypes:newTypes owner:newOwner]\n    }\n\n    unsafe fn addTypes_owner(self, newTypes: id, newOwner: id) -> NSInteger {\n        msg_send![self, addTypes:newTypes owner:newOwner]\n    }\n\n    unsafe fn writeFileContents(self, filename: id) -> BOOL {\n        msg_send![self, writeFileContents:filename]\n    }\n\n    unsafe fn writeFileWrapper(self, wrapper: id) -> BOOL {\n        msg_send![self, writeFileWrapper:wrapper]\n    }\n\n    unsafe fn readFileContentsType_toFile(self, _type: id, filename: id) -> id {\n        msg_send![self, readFileContentsType:_type toFile:filename]\n    }\n\n    unsafe fn readFileWrapper(self) -> id {\n        msg_send![self, readFileWrapper]\n    }\n\n}\n\npub trait NSPasteboardItem: Sized {\n    unsafe fn types(self) -> id;\n\n    unsafe fn setDataProvider_forTypes(self, dataProvider: id, types: id) -> BOOL;\n    unsafe fn setData_forType(self, data: id, _type: id) -> BOOL;\n    unsafe fn setString_forType(self, string: id, _type: id) -> BOOL;\n    unsafe fn setPropertyList_forType(self, propertyList: id, _type: id) -> BOOL;\n\n    unsafe fn dataForType(self, _type: id) -> id;\n    unsafe fn stringForType(self, _type: id) -> id;\n    unsafe fn propertyListForType(self, _type: id) -> id;\n}\n\nimpl NSPasteboardItem for id {\n    unsafe fn types(self) -> id {\n        msg_send![self, types]\n    }\n\n    unsafe fn setDataProvider_forTypes(self, dataProvider: id, types: id) -> BOOL {\n        msg_send![self, setDataProvider:dataProvider forTypes:types]\n    }\n\n    unsafe fn setData_forType(self, data: id, _type: id) -> BOOL {\n        msg_send![self, setData:data forType:_type]\n    }\n\n    unsafe fn setString_forType(self, string: id, _type: id) -> BOOL {\n        msg_send![self, setString:string forType:_type]\n    }\n\n    unsafe fn setPropertyList_forType(self, propertyList: id, _type: id) -> BOOL {\n        msg_send![self, setPropertyList:propertyList forType:_type]\n    }\n\n    unsafe fn dataForType(self, _type: id) -> id {\n        msg_send![self, dataForType:_type]\n    }\n\n    unsafe fn stringForType(self, _type: id) -> id {\n        msg_send![self, stringForType:_type]\n    }\n\n    unsafe fn propertyListForType(self, _type: id) -> id {\n        msg_send![self, propertyListForType:_type]\n    }\n}\n\npub trait NSPasteboardItemDataProvider: Sized {\n    unsafe fn pasteboard_item_provideDataForType(self, pasteboard: id, item: id, _type: id);\n    unsafe fn pasteboardFinishedWithDataProvider(self, pasteboard: id);\n}\n\nimpl NSPasteboardItemDataProvider for id {\n    unsafe fn pasteboard_item_provideDataForType(self, pasteboard: id, item: id, _type: id) {\n        msg_send![self, pasteboard:pasteboard item:item provideDataForType:_type]\n    }\n\n    unsafe fn pasteboardFinishedWithDataProvider(self, pasteboard: id) {\n        msg_send![self, pasteboardFinishedWithDataProvider:pasteboard]\n    }\n}\n\npub trait NSPasteboardWriting: Sized {\n    unsafe fn writableTypesForPasteboard(self, pasteboard: id) -> id;\n    unsafe fn writingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardWritingOptions;\n\n    unsafe fn pasteboardPropertyListForType(self, _type: id) -> id;\n}\n\nimpl NSPasteboardWriting for id {\n    unsafe fn writableTypesForPasteboard(self, pasteboard: id) -> id {\n        msg_send![self, writableTypesForPasteboard:pasteboard]\n    }\n\n    unsafe fn writingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardWritingOptions {\n        msg_send![self, writingOptionsForType:_type pasteboard:pasteboard]\n    }\n\n    unsafe fn pasteboardPropertyListForType(self, _type: id) -> id {\n        msg_send![self, pasteboardPropertyListForType:_type]\n    }\n}\n\npub trait NSPasteboardReading: Sized {\n    unsafe fn initWithPasteboardPropertyList_ofType(self, propertyList: id, _type: id) -> id;\n\n    unsafe fn readableTypesForPasteboard(self, pasteboard: id) -> id;\n    unsafe fn readingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardReadingOptions;\n}\n\nimpl NSPasteboardReading for id {\n    unsafe fn initWithPasteboardPropertyList_ofType(self, propertyList: id, _type: id) -> id {\n        msg_send![self, initWithPasteboardPropertyList:propertyList ofType:_type]\n    }\n\n    unsafe fn readableTypesForPasteboard(self, pasteboard: id) -> id {\n        let class: id = msg_send![self, class];\n        msg_send![class, readableTypesForPasteboard:pasteboard]\n    }\n    unsafe fn readingOptionsForType_pasteboard(self, _type: id, pasteboard: id) -> NSPasteboardReadingOptions {\n        let class: id = msg_send![self, class];\n        msg_send![class, readingOptionsForType:_type pasteboard:pasteboard]\n    }\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSPasteboardReadingOptions {\n    NSPasteboardReadingAsData = 0,\n    NSPasteboardReadingAsString = 1 << 0,\n    NSPasteboardReadingAsPropertyList = 1 << 1,\n    NSPasteboardReadingAsKeyedArchive = 1 << 2\n}\n\n#[repr(u64)]\n#[derive(Clone, Copy, Debug, PartialEq)]\npub enum NSPasteboardWritingOptions {\n    NSPasteboardWritingPromised = 1 << 9,\n}\n\npub trait NSMenu: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSMenu\"), alloc]\n    }\n\n    unsafe fn new(_: Self) -> id {\n        msg_send![class(\"NSMenu\"), new]\n    }\n\n    unsafe fn initWithTitle_(self, title: id /* NSString */) -> id;\n    unsafe fn setAutoenablesItems(self, state: BOOL);\n\n    unsafe fn addItem_(self, menu_item: id);\n    unsafe fn addItemWithTitle_action_keyEquivalent(self, title: id, action: SEL, key: id) -> id;\n    unsafe fn itemAtIndex_(self, index: NSInteger) -> id;\n}\n\nimpl NSMenu for id {\n    unsafe fn initWithTitle_(self, title: id /* NSString */) -> id {\n        msg_send![self, initWithTitle:title]\n    }\n\n    unsafe fn setAutoenablesItems(self, state: BOOL) {\n        msg_send![self, setAutoenablesItems: state]\n    }\n\n    unsafe fn addItem_(self, menu_item: id) {\n        msg_send![self, addItem:menu_item]\n    }\n\n    unsafe fn addItemWithTitle_action_keyEquivalent(self, title: id, action: SEL, key: id) -> id {\n        msg_send![self, addItemWithTitle:title action:action keyEquivalent:key]\n    }\n\n    unsafe fn itemAtIndex_(self, index: NSInteger) -> id {\n        msg_send![self, itemAtIndex:index]\n    }\n}\n\npub trait NSMenuItem: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSMenuItem\"), alloc]\n    }\n\n    unsafe fn new(_: Self) -> id {\n        msg_send![class(\"NSMenuItem\"), new]\n    }\n\n    unsafe fn separatorItem(_: Self) -> id {\n        msg_send![class(\"NSMenuItem\"), separatorItem]\n    }\n\n    unsafe fn initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id;\n    unsafe fn setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags);\n    unsafe fn setSubmenu_(self, submenu: id);\n}\n\nimpl NSMenuItem for id {\n    unsafe fn initWithTitle_action_keyEquivalent_(self, title: id, action: SEL, key: id) -> id {\n        msg_send![self, initWithTitle:title action:action keyEquivalent:key]\n    }\n\n    unsafe fn setKeyEquivalentModifierMask_(self, mask: NSEventModifierFlags) {\n        msg_send![self, setKeyEquivalentModifierMask:mask]\n    }\n\n    unsafe fn setSubmenu_(self, submenu: id) {\n        msg_send![self, setSubmenu:submenu]\n    }\n}\n\npub type NSWindowDepth = libc::c_int;\n\nbitflags! {\n    pub struct NSWindowCollectionBehavior: NSUInteger {\n        const NSWindowCollectionBehaviorDefault = 0;\n        const NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0;\n        const NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1;\n\n        const NSWindowCollectionBehaviorManaged = 1 << 2;\n        const NSWindowCollectionBehaviorTransient = 1 << 3;\n        const NSWindowCollectionBehaviorStationary = 1 << 4;\n\n        const NSWindowCollectionBehaviorParticipatesInCycle = 1 << 5;\n        const NSWindowCollectionBehaviorIgnoresCycle = 1 << 6;\n\n        const NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7;\n        const NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8;\n    }\n}\n\nbitflags! {\n    pub struct NSWindowOcclusionState: NSUInteger {\n        const NSWindowOcclusionStateVisible = 1 << 1;\n    }\n}\n\npub trait NSWindow: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSWindow\"), alloc]\n    }\n\n    // Creating Windows\n    unsafe fn initWithContentRect_styleMask_backing_defer_(self,\n                                                           rect: NSRect,\n                                                           style: NSWindowStyleMask,\n                                                           backing: NSBackingStoreType,\n                                                           defer: BOOL) -> id;\n    unsafe fn initWithContentRect_styleMask_backing_defer_screen_(self,\n                                                                  rect: NSRect,\n                                                                  style: NSWindowStyleMask,\n                                                                  backing: NSBackingStoreType,\n                                                                  defer: BOOL,\n                                                                  screen: id) -> id;\n\n    // Configuring Windows\n    unsafe fn styleMask(self) -> NSWindowStyleMask;\n    unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask);\n    unsafe fn toggleFullScreen_(self, sender: id);\n    unsafe fn worksWhenModal(self) -> BOOL;\n    unsafe fn alphaValue(self) -> CGFloat;\n    unsafe fn setAlphaValue_(self, windowAlpha: CGFloat);\n    unsafe fn backgroundColor(self) -> id;\n    unsafe fn setBackgroundColor_(self, color: id);\n    unsafe fn colorSpace(self) -> id;\n    unsafe fn setColorSpace_(self, colorSpace: id);\n    unsafe fn contentView(self) -> id;\n    unsafe fn setContentView_(self, view: id);\n    unsafe fn canHide(self) -> BOOL;\n    unsafe fn setCanHide_(self, canHide: BOOL);\n    unsafe fn hidesOnDeactivate(self) -> BOOL;\n    unsafe fn setHidesOnDeactivate_(self, hideOnDeactivate: BOOL);\n    unsafe fn collectionBehavior(self) -> NSWindowCollectionBehavior;\n    unsafe fn setCollectionBehavior_(self, collectionBehavior: NSWindowCollectionBehavior);\n    unsafe fn setOpaque_(self, opaque: BOOL);\n    unsafe fn hasShadow(self) -> BOOL;\n    unsafe fn setHasShadow_(self, hasShadow: BOOL);\n    unsafe fn invalidateShadow(self);\n    unsafe fn autorecalculatesContentBorderThicknessForEdge_(self, edge: NSRectEdge) -> BOOL;\n    unsafe fn setAutorecalculatesContentBorderThickness_forEdge_(self,\n                                                                 autorecalculateContentBorderThickness: BOOL,\n                                                                 edge: NSRectEdge) -> BOOL;\n    unsafe fn contentBorderThicknessForEdge_(self, edge: NSRectEdge) -> CGFloat;\n    unsafe fn setContentBorderThickness_forEdge_(self, borderThickness: CGFloat, edge: NSRectEdge);\n    unsafe fn delegate(self) -> id;\n    unsafe fn setDelegate_(self, delegate: id);\n    unsafe fn preventsApplicationTerminationWhenModal(self) -> BOOL;\n    unsafe fn setPreventsApplicationTerminationWhenModal_(self, flag: BOOL);\n\n    // TODO: Accessing Window Information\n\n    // Getting Layout Information\n    unsafe fn contentRectForFrameRect_styleMask_(self, windowFrame: NSRect, windowStyle: NSWindowStyleMask) -> NSRect;\n    unsafe fn frameRectForContentRect_styleMask_(self, windowContentRect: NSRect, windowStyle: NSWindowStyleMask) -> NSRect;\n    unsafe fn minFrameWidthWithTitle_styleMask_(self, windowTitle: id, windowStyle: NSWindowStyleMask) -> CGFloat;\n    unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect;\n    unsafe fn frameRectForContentRect_(self, windowContent: NSRect) -> NSRect;\n\n    // Managing Windows\n    unsafe fn drawers(self) -> id;\n    unsafe fn windowController(self) -> id;\n    unsafe fn setWindowController_(self, windowController: id);\n\n    // TODO: Managing Sheets\n\n    // Sizing Windows\n    unsafe fn frame(self) -> NSRect;\n    unsafe fn setFrameOrigin_(self, point: NSPoint);\n    unsafe fn setFrameTopLeftPoint_(self, point: NSPoint);\n    unsafe fn constrainFrameRect_toScreen_(self, frameRect: NSRect, screen: id);\n    unsafe fn cascadeTopLeftFromPoint_(self, topLeft: NSPoint) -> NSPoint;\n    unsafe fn setFrame_display_(self, windowFrame: NSRect, display: BOOL);\n    unsafe fn setFrame_displayViews_(self, windowFrame: NSRect, display: BOOL);\n    unsafe fn aspectRatio(self) -> NSSize;\n    unsafe fn setAspectRatio_(self, aspectRatio: NSSize);\n    unsafe fn minSize(self) -> NSSize;\n    unsafe fn setMinSize_(self, minSize: NSSize);\n    unsafe fn maxSize(self) -> NSSize;\n    unsafe fn setMaxSize_(self, maxSize: NSSize);\n    unsafe fn performZoom_(self, sender: id);\n    unsafe fn zoom_(self, sender: id);\n    unsafe fn resizeFlags(self) -> NSInteger;\n    unsafe fn showsResizeIndicator(self) -> BOOL;\n    unsafe fn setShowsResizeIndicator_(self, showsResizeIndicator: BOOL);\n    unsafe fn resizeIncrements(self) -> NSSize;\n    unsafe fn setResizeIncrements_(self, resizeIncrements: NSSize);\n    unsafe fn preservesContentDuringLiveResize(self) -> BOOL;\n    unsafe fn setPreservesContentDuringLiveResize_(self, preservesContentDuringLiveResize: BOOL);\n    unsafe fn inLiveResize(self) -> BOOL;\n\n    // Sizing Content\n    unsafe fn contentAspectRatio(self) -> NSSize;\n    unsafe fn setContentAspectRatio_(self, contentAspectRatio: NSSize);\n    unsafe fn contentMinSize(self) -> NSSize;\n    unsafe fn setContentMinSize_(self, contentMinSize: NSSize);\n    unsafe fn contentSize(self) -> NSSize;\n    unsafe fn setContentSize_(self, contentSize: NSSize);\n    unsafe fn contentMaxSize(self) -> NSSize;\n    unsafe fn setContentMaxSize_(self, contentMaxSize: NSSize);\n    unsafe fn contentResizeIncrements(self) -> NSSize;\n    unsafe fn setContentResizeIncrements_(self, contentResizeIncrements: NSSize);\n\n    // Managing Window Visibility and Occlusion State\n    unsafe fn isVisible(self) -> BOOL; // NOTE: Deprecated in 10.9\n    unsafe fn occlusionState(self) -> NSWindowOcclusionState;\n\n    // Managing Window Layers\n    unsafe fn orderOut_(self, sender: id);\n    unsafe fn orderBack_(self, sender: id);\n    unsafe fn orderFront_(self, sender: id);\n    unsafe fn orderFrontRegardless(self);\n    unsafe fn orderFrontWindow_relativeTo_(self, orderingMode: NSWindowOrderingMode, otherWindowNumber: NSInteger);\n    unsafe fn level(self) -> NSInteger;\n    unsafe fn setLevel_(self, level: NSInteger);\n\n    // Managing Key Status\n    unsafe fn canBecomeKeyWindow(self) -> BOOL;\n    unsafe fn makeKeyWindow(self);\n    unsafe fn makeKeyAndOrderFront_(self, sender: id);\n    // skipped: becomeKeyWindow (should not be invoked directly, according to Apple's documentation)\n    // skipped: resignKeyWindow (should not be invoked directly, according to Apple's documentation)\n\n    // Managing Main Status\n    unsafe fn canBecomeMainWindow(self) -> BOOL;\n    unsafe fn makeMainWindow(self);\n    // skipped: becomeMainWindow (should not be invoked directly, according to Apple's documentation)\n    // skipped: resignMainWindow (should not be invoked directly, according to Apple's documentation)\n\n    // TODO: Managing Toolbars\n    // TODO: Managing Attached Windows\n    // TODO: Managing Window Buffers\n    // TODO: Managing Default Buttons\n    // TODO: Managing Field Editors\n    // TODO: Managing the Window Menu\n    // TODO: Managing Cursor Rectangles\n\n    // Managing Title Bars\n    unsafe fn standardWindowButton_(self, windowButtonKind: NSWindowButton) -> id;\n\n    // TODO: Managing Tooltips\n    // TODO: Handling Events\n\n    // Managing Responders\n    unsafe fn initialFirstResponder(self) -> id;\n    unsafe fn firstResponder(self) -> id;\n    unsafe fn setInitialFirstResponder_(self, responder: id);\n    unsafe fn makeFirstResponder_(self, responder: id) -> BOOL;\n\n    // TODO: Managing the Key View Loop\n\n    // Handling Keyboard Events\n    unsafe fn keyDown_(self, event: id);\n\n    // Handling Mouse Events\n    unsafe fn acceptsMouseMovedEvents(self) -> BOOL;\n    unsafe fn ignoresMouseEvents(self) -> BOOL;\n    unsafe fn setIgnoresMouseEvents_(self, ignoreMouseEvents: BOOL);\n    unsafe fn mouseLocationOutsideOfEventStream(self) -> NSPoint;\n    unsafe fn setAcceptsMouseMovedEvents_(self, acceptMouseMovedEvents: BOOL);\n    unsafe fn windowNumberAtPoint_belowWindowWithWindowNumber_(self,\n                                                               point: NSPoint,\n                                                               windowNumber: NSInteger) -> NSInteger;\n\n    // TODO: Handling Window Restoration\n    // TODO: Bracketing Drawing Operations\n    // TODO: Drawing Windows\n    // TODO: Window Animation\n    // TODO: Updating Windows\n    // TODO: Dragging Items\n\n    // Converting Coordinates\n    unsafe fn backingScaleFactor(self) -> CGFloat;\n    unsafe fn backingAlignedRect_options_(self, rect: NSRect, options: NSAlignmentOptions) -> NSRect;\n    unsafe fn convertRectFromBacking_(self, rect: NSRect) -> NSRect;\n    unsafe fn convertRectToBacking_(self, rect: NSRect) -> NSRect;\n    unsafe fn convertRectToScreen_(self, rect: NSRect) -> NSRect;\n    unsafe fn convertRectFromScreen_(self, rect: NSRect) -> NSRect;\n\n    // Accessing Edited Status\n    unsafe fn setDocumentEdited_(self, documentEdited: BOOL);\n\n    // Managing Titles\n    unsafe fn title(self) -> id;\n    unsafe fn setTitle_(self, title: id);\n    unsafe fn setTitleWithRepresentedFilename_(self, filePath: id);\n    unsafe fn setTitleVisibility_(self, visibility: NSWindowTitleVisibility);\n    unsafe fn setTitlebarAppearsTransparent_(self, transparent: BOOL);\n    unsafe fn representedFilename(self) -> id;\n    unsafe fn setRepresentedFilename_(self, filePath: id);\n    unsafe fn representedURL(self) -> id;\n    unsafe fn setRepresentedURL_(self, representedURL: id);\n\n    // Accessing Screen Information\n    unsafe fn screen(self) -> id;\n    unsafe fn deepestScreen(self) -> id;\n    unsafe fn displaysWhenScreenProfileChanges(self) -> BOOL;\n    unsafe fn setDisplaysWhenScreenProfileChanges_(self, displaysWhenScreenProfileChanges: BOOL);\n\n    // Moving Windows\n    unsafe fn setMovableByWindowBackground_(self, movableByWindowBackground: BOOL);\n    unsafe fn setMovable_(self, movable: BOOL);\n    unsafe fn center(self);\n\n    // Closing Windows\n    unsafe fn performClose_(self, sender: id);\n    unsafe fn close(self);\n    unsafe fn setReleasedWhenClosed_(self, releasedWhenClosed: BOOL);\n\n    // Minimizing Windows\n    unsafe fn performMiniaturize_(self, sender: id);\n    unsafe fn miniaturize_(self, sender: id);\n    unsafe fn deminiaturize_(self, sender: id);\n    unsafe fn miniwindowImage(self) -> id;\n    unsafe fn setMiniwindowImage_(self, miniwindowImage: id);\n    unsafe fn miniwindowTitle(self) -> id;\n    unsafe fn setMiniwindowTitle_(self, miniwindowTitle: id);\n\n    // TODO: Getting the Dock Tile\n    // TODO: Printing Windows\n    // TODO: Providing Services\n    // TODO: Working with Carbon\n    // TODO: Triggering Constraint-Based Layout\n    // TODO: Debugging Constraint-Based Layout\n    // TODO: Constraint-Based Layouts\n}\n\nimpl NSWindow for id {\n    // Creating Windows\n\n    unsafe fn initWithContentRect_styleMask_backing_defer_(self,\n                                                           rect: NSRect,\n                                                           style: NSWindowStyleMask,\n                                                           backing: NSBackingStoreType,\n                                                           defer: BOOL) -> id {\n        msg_send![self, initWithContentRect:rect\n                                  styleMask:style.bits\n                                    backing:backing as NSUInteger\n                                      defer:defer]\n    }\n\n    unsafe fn initWithContentRect_styleMask_backing_defer_screen_(self,\n                                                                  rect: NSRect,\n                                                                  style: NSWindowStyleMask,\n                                                                  backing: NSBackingStoreType,\n                                                                  defer: BOOL,\n                                                                  screen: id) -> id {\n        msg_send![self, initWithContentRect:rect\n                                  styleMask:style.bits\n                                    backing:backing as NSUInteger\n                                      defer:defer\n                                     screen:screen]\n    }\n\n    // Configuring Windows\n\n    unsafe fn styleMask(self) -> NSWindowStyleMask {\n        let styleMask = NSWindowStyleMask::from_bits_truncate(msg_send![self, styleMask]);\n        styleMask\n    }\n\n    unsafe fn setStyleMask_(self, styleMask: NSWindowStyleMask) {\n        msg_send![self, setStyleMask:styleMask.bits]\n    }\n\n    unsafe fn toggleFullScreen_(self, sender: id) {\n        msg_send![self, toggleFullScreen:sender]\n    }\n\n    unsafe fn worksWhenModal(self) -> BOOL {\n        msg_send![self, worksWhenModal]\n    }\n\n    unsafe fn alphaValue(self) -> CGFloat {\n        msg_send![self, alphaValue]\n    }\n\n    unsafe fn setAlphaValue_(self, windowAlpha: CGFloat) {\n        msg_send![self, setAlphaValue:windowAlpha]\n    }\n\n    unsafe fn backgroundColor(self) -> id {\n        msg_send![self, backgroundColor]\n    }\n\n    unsafe fn setBackgroundColor_(self, color: id) {\n        msg_send![self, setBackgroundColor:color]\n    }\n\n    unsafe fn colorSpace(self) -> id {\n        msg_send![self, colorSpace]\n    }\n\n    unsafe fn setColorSpace_(self, colorSpace: id) {\n        msg_send![self, setColorSpace:colorSpace]\n    }\n\n    unsafe fn contentView(self) -> id {\n        msg_send![self, contentView]\n    }\n\n    unsafe fn setContentView_(self, view: id) {\n        msg_send![self, setContentView:view]\n    }\n\n    unsafe fn canHide(self) -> BOOL {\n        msg_send![self, canHide]\n    }\n\n    unsafe fn setCanHide_(self, canHide: BOOL) {\n        msg_send![self, setCanHide:canHide]\n    }\n\n    unsafe fn hidesOnDeactivate(self) -> BOOL {\n        msg_send![self, hidesOnDeactivate]\n    }\n\n    unsafe fn setHidesOnDeactivate_(self, hideOnDeactivate: BOOL) {\n        msg_send![self, setHidesOnDeactivate:hideOnDeactivate]\n    }\n\n    unsafe fn collectionBehavior(self) -> NSWindowCollectionBehavior {\n        msg_send![self, collectionBehavior]\n    }\n\n    unsafe fn setCollectionBehavior_(self, collectionBehavior: NSWindowCollectionBehavior) {\n        msg_send![self, setCollectionBehavior:collectionBehavior]\n    }\n\n    unsafe fn setOpaque_(self, opaque: BOOL) {\n        msg_send![self, setOpaque:opaque]\n    }\n\n    unsafe fn hasShadow(self) -> BOOL {\n        msg_send![self, hasShadow]\n    }\n\n    unsafe fn setHasShadow_(self, hasShadow: BOOL) {\n        msg_send![self, setHasShadow:hasShadow]\n    }\n\n    unsafe fn invalidateShadow(self) {\n        msg_send![self, invalidateShadow]\n    }\n\n    unsafe fn autorecalculatesContentBorderThicknessForEdge_(self, edge: NSRectEdge) -> BOOL {\n        msg_send![self, autorecalculatesContentBorderThicknessForEdge:edge]\n    }\n\n    unsafe fn setAutorecalculatesContentBorderThickness_forEdge_(self,\n                                                                 autorecalculateContentBorderThickness: BOOL,\n                                                                 edge: NSRectEdge) -> BOOL {\n        msg_send![self, setAutorecalculatesContentBorderThickness:\n                        autorecalculateContentBorderThickness forEdge:edge]\n    }\n\n    unsafe fn contentBorderThicknessForEdge_(self, edge: NSRectEdge) -> CGFloat {\n        msg_send![self, contentBorderThicknessForEdge:edge]\n    }\n\n    unsafe fn setContentBorderThickness_forEdge_(self, borderThickness: CGFloat, edge: NSRectEdge) {\n        msg_send![self, setContentBorderThickness:borderThickness forEdge:edge]\n    }\n\n    unsafe fn delegate(self) -> id {\n        msg_send![self, delegate]\n    }\n\n    unsafe fn setDelegate_(self, delegate: id) {\n        msg_send![self, setDelegate:delegate]\n    }\n\n    unsafe fn preventsApplicationTerminationWhenModal(self) -> BOOL {\n        msg_send![self, preventsApplicationTerminationWhenModal]\n    }\n\n    unsafe fn setPreventsApplicationTerminationWhenModal_(self, flag: BOOL) {\n        msg_send![self, setPreventsApplicationTerminationWhenModal:flag]\n    }\n\n    // TODO: Accessing Window Information\n\n    // Getting Layout Information\n\n    unsafe fn contentRectForFrameRect_styleMask_(self, windowFrame: NSRect, windowStyle: NSWindowStyleMask) -> NSRect {\n        msg_send![self, contentRectForFrameRect:windowFrame styleMask:windowStyle.bits]\n    }\n\n    unsafe fn frameRectForContentRect_styleMask_(self, windowContentRect: NSRect, windowStyle: NSWindowStyleMask) -> NSRect {\n        msg_send![self, frameRectForContentRect:windowContentRect styleMask:windowStyle.bits]\n    }\n\n    unsafe fn minFrameWidthWithTitle_styleMask_(self, windowTitle: id, windowStyle: NSWindowStyleMask) -> CGFloat {\n        msg_send![self, minFrameWidthWithTitle:windowTitle styleMask:windowStyle.bits]\n    }\n\n    unsafe fn contentRectForFrameRect_(self, windowFrame: NSRect) -> NSRect {\n        msg_send![self, contentRectForFrameRect:windowFrame]\n    }\n\n    unsafe fn frameRectForContentRect_(self, windowContent: NSRect) -> NSRect {\n        msg_send![self, frameRectForContentRect:windowContent]\n    }\n\n    // Managing Windows\n\n    unsafe fn drawers(self) -> id {\n        msg_send![self, drawers]\n    }\n\n    unsafe fn windowController(self) -> id {\n        msg_send![self, windowController]\n    }\n\n    unsafe fn setWindowController_(self, windowController: id) {\n        msg_send![self, setWindowController:windowController]\n    }\n\n    // TODO: Managing Sheets\n\n    // Sizing Windows\n\n    unsafe fn frame(self) -> NSRect {\n        msg_send![self, frame]\n    }\n\n    unsafe fn setFrameOrigin_(self, point: NSPoint) {\n        msg_send![self, setFrameOrigin:point]\n    }\n\n    unsafe fn setFrameTopLeftPoint_(self, point: NSPoint) {\n        msg_send![self, setFrameTopLeftPoint:point]\n    }\n\n    unsafe fn constrainFrameRect_toScreen_(self, frameRect: NSRect, screen: id) {\n        msg_send![self, constrainFrameRect:frameRect toScreen:screen]\n    }\n\n    unsafe fn cascadeTopLeftFromPoint_(self, topLeft: NSPoint) -> NSPoint {\n        msg_send![self, cascadeTopLeftFromPoint:topLeft]\n    }\n\n    unsafe fn setFrame_display_(self, windowFrame: NSRect, display: BOOL) {\n        msg_send![self, setFrame:windowFrame display:display]\n    }\n\n    unsafe fn setFrame_displayViews_(self, windowFrame: NSRect, display: BOOL) {\n        msg_send![self, setFrame:windowFrame displayViews:display]\n    }\n\n    unsafe fn aspectRatio(self) -> NSSize {\n        msg_send![self, aspectRatio]\n    }\n\n    unsafe fn setAspectRatio_(self, aspectRatio: NSSize) {\n        msg_send![self, setAspectRatio:aspectRatio]\n    }\n\n    unsafe fn minSize(self) -> NSSize {\n        msg_send![self, minSize]\n    }\n\n    unsafe fn setMinSize_(self, minSize: NSSize) {\n        msg_send![self, setMinSize:minSize]\n    }\n\n    unsafe fn maxSize(self) -> NSSize {\n        msg_send![self, maxSize]\n    }\n\n    unsafe fn setMaxSize_(self, maxSize: NSSize) {\n        msg_send![self, setMaxSize:maxSize]\n    }\n\n    unsafe fn performZoom_(self, sender: id) {\n        msg_send![self, performZoom:sender]\n    }\n\n    unsafe fn zoom_(self, sender: id) {\n        msg_send![self, zoom:sender]\n    }\n\n    unsafe fn resizeFlags(self) -> NSInteger {\n        msg_send![self, resizeFlags]\n    }\n\n    unsafe fn showsResizeIndicator(self) -> BOOL {\n        msg_send![self, showsResizeIndicator]\n    }\n\n    unsafe fn setShowsResizeIndicator_(self, showsResizeIndicator: BOOL) {\n        msg_send![self, setShowsResizeIndicator:showsResizeIndicator]\n    }\n\n    unsafe fn resizeIncrements(self) -> NSSize {\n        msg_send![self, resizeIncrements]\n    }\n\n    unsafe fn setResizeIncrements_(self, resizeIncrements: NSSize) {\n        msg_send![self, setResizeIncrements:resizeIncrements]\n    }\n\n    unsafe fn preservesContentDuringLiveResize(self) -> BOOL {\n        msg_send![self, preservesContentDuringLiveResize]\n    }\n\n    unsafe fn setPreservesContentDuringLiveResize_(self, preservesContentDuringLiveResize: BOOL) {\n        msg_send![self, setPreservesContentDuringLiveResize:preservesContentDuringLiveResize]\n    }\n\n    unsafe fn inLiveResize(self) -> BOOL {\n        msg_send![self, inLiveResize]\n    }\n\n    // Sizing Content\n\n    unsafe fn contentAspectRatio(self) -> NSSize {\n        msg_send![self, contentAspectRatio]\n    }\n\n    unsafe fn setContentAspectRatio_(self, contentAspectRatio: NSSize) {\n        msg_send![self, setContentAspectRatio:contentAspectRatio]\n    }\n\n    unsafe fn contentMinSize(self) -> NSSize {\n        msg_send![self, contentMinSize]\n    }\n\n    unsafe fn setContentMinSize_(self, contentMinSize: NSSize) {\n        msg_send![self, setContentMinSize:contentMinSize]\n    }\n\n    unsafe fn contentSize(self) -> NSSize {\n        msg_send![self, contentSize]\n    }\n\n    unsafe fn setContentSize_(self, contentSize: NSSize) {\n        msg_send![self, setContentSize:contentSize]\n    }\n\n    unsafe fn contentMaxSize(self) -> NSSize {\n        msg_send![self, contentMaxSize]\n    }\n\n    unsafe fn setContentMaxSize_(self, contentMaxSize: NSSize) {\n        msg_send![self, setContentMaxSize:contentMaxSize]\n    }\n\n    unsafe fn contentResizeIncrements(self) -> NSSize {\n        msg_send![self, contentResizeIncrements]\n    }\n\n    unsafe fn setContentResizeIncrements_(self, contentResizeIncrements: NSSize) {\n        msg_send![self, setContentResizeIncrements:contentResizeIncrements]\n    }\n\n    // Managing Window Visibility and Occlusion State\n\n    unsafe fn isVisible(self) -> BOOL {\n        msg_send![self, isVisible]\n    }\n\n    unsafe fn occlusionState(self) -> NSWindowOcclusionState {\n        msg_send![self, occlusionState]\n    }\n\n    // Managing Window Layers\n\n    unsafe fn orderOut_(self, sender: id) {\n        msg_send![self, orderOut:sender]\n    }\n\n    unsafe fn orderBack_(self, sender: id) {\n        msg_send![self, orderBack:sender]\n    }\n\n    unsafe fn orderFront_(self, sender: id) {\n        msg_send![self, orderFront:sender]\n    }\n\n    unsafe fn orderFrontRegardless(self) {\n        msg_send![self, orderFrontRegardless]\n    }\n\n    unsafe fn orderFrontWindow_relativeTo_(self, ordering_mode: NSWindowOrderingMode, other_window_number: NSInteger) {\n        msg_send![self, orderWindow:ordering_mode relativeTo:other_window_number]\n    }\n\n    unsafe fn level(self) -> NSInteger {\n        msg_send![self, level]\n    }\n\n    unsafe fn setLevel_(self, level: NSInteger) {\n        msg_send![self, setLevel:level]\n    }\n\n    // Managing Key Status\n\n    unsafe fn canBecomeKeyWindow(self) -> BOOL {\n        msg_send![self, canBecomeKeyWindow]\n    }\n\n    unsafe fn makeKeyWindow(self) {\n        msg_send![self, makeKeyWindow]\n    }\n\n    unsafe fn makeKeyAndOrderFront_(self, sender: id) {\n        msg_send![self, makeKeyAndOrderFront:sender]\n    }\n\n    // Managing Main Status\n\n    unsafe fn canBecomeMainWindow(self) -> BOOL {\n        msg_send![self, canBecomeMainWindow]\n    }\n\n    unsafe fn makeMainWindow(self) {\n        msg_send![self, makeMainWindow]\n    }\n\n    // TODO: Managing Toolbars\n    // TODO: Managing Attached Windows\n    // TODO: Managing Window Buffers\n    // TODO: Managing Default Buttons\n    // TODO: Managing Field Editors\n    // TODO: Managing the Window Menu\n    // TODO: Managing Cursor Rectangles\n\n    // Managing Title Bars\n\n    unsafe fn standardWindowButton_(self, windowButtonKind: NSWindowButton) -> id {\n        msg_send![self, standardWindowButton:windowButtonKind]\n    }\n\n    // TODO: Managing Tooltips\n    // TODO: Handling Events\n\n    // Managing Responders\n\n    unsafe fn initialFirstResponder(self) -> id {\n        msg_send![self, initialFirstResponder]\n    }\n\n    unsafe fn firstResponder(self) -> id {\n        msg_send![self, firstResponder]\n    }\n\n    unsafe fn setInitialFirstResponder_(self, responder: id) {\n        msg_send![self, setInitialFirstResponder:responder]\n    }\n\n    unsafe fn makeFirstResponder_(self, responder: id) -> BOOL {\n        msg_send![self, makeFirstResponder:responder]\n    }\n\n    // TODO: Managing the Key View Loop\n\n    // Handling Keyboard Events\n\n    unsafe fn keyDown_(self, event: id) {\n        msg_send![self, keyDown:event]\n    }\n\n    // Handling Mouse Events\n\n    unsafe fn acceptsMouseMovedEvents(self) -> BOOL {\n        msg_send![self, acceptsMouseMovedEvents]\n    }\n\n    unsafe fn ignoresMouseEvents(self) -> BOOL {\n        msg_send![self, ignoresMouseEvents]\n    }\n\n    unsafe fn setIgnoresMouseEvents_(self, ignoreMouseEvents: BOOL) {\n        msg_send![self, setIgnoresMouseEvents:ignoreMouseEvents]\n    }\n\n    unsafe fn mouseLocationOutsideOfEventStream(self) -> NSPoint {\n        msg_send![self, mouseLocationOutsideOfEventStream]\n    }\n\n    unsafe fn setAcceptsMouseMovedEvents_(self, acceptMouseMovedEvents: BOOL) {\n        msg_send![self, setAcceptsMouseMovedEvents:acceptMouseMovedEvents]\n    }\n\n    unsafe fn windowNumberAtPoint_belowWindowWithWindowNumber_(self,\n                                                               point: NSPoint,\n                                                               windowNumber: NSInteger) -> NSInteger {\n        msg_send![self, windowNumberAtPoint:point belowWindowWithWindowNumber:windowNumber]\n    }\n\n    // Converting Coordinates\n\n    unsafe fn backingScaleFactor(self) -> CGFloat {\n        msg_send![self, backingScaleFactor]\n    }\n\n    unsafe fn backingAlignedRect_options_(self, rect: NSRect, options: NSAlignmentOptions) -> NSRect {\n        msg_send![self, backingAlignedRect:rect options:options]\n    }\n\n    unsafe fn convertRectFromBacking_(self, rect: NSRect) -> NSRect {\n        msg_send![self, convertRectFromBacking:rect]\n    }\n\n    unsafe fn convertRectToBacking_(self, rect: NSRect) -> NSRect {\n        msg_send![self, convertRectToBacking:rect]\n    }\n\n    unsafe fn convertRectToScreen_(self, rect: NSRect) -> NSRect {\n        msg_send![self, convertRectToScreen:rect]\n    }\n\n    unsafe fn convertRectFromScreen_(self, rect: NSRect) -> NSRect {\n        msg_send![self, convertRectFromScreen:rect]\n    }\n\n    // Accessing Edited Status\n\n    unsafe fn setDocumentEdited_(self, documentEdited: BOOL) {\n        msg_send![self, setDocumentEdited:documentEdited]\n    }\n\n    // Managing Titles\n\n    unsafe fn title(self) -> id {\n        msg_send![self, title]\n    }\n\n    unsafe fn setTitle_(self, title: id) {\n        msg_send![self, setTitle:title]\n    }\n\n    unsafe fn setTitleWithRepresentedFilename_(self, filePath: id) {\n        msg_send![self, setTitleWithRepresentedFilename:filePath]\n    }\n\n    unsafe fn setTitleVisibility_(self, visibility: NSWindowTitleVisibility) {\n        msg_send![self, setTitleVisibility:visibility]\n    }\n\n    unsafe fn setTitlebarAppearsTransparent_(self, transparent: BOOL) {\n        msg_send![self, setTitlebarAppearsTransparent:transparent]\n    }\n\n    unsafe fn representedFilename(self) -> id {\n        msg_send![self, representedFilename]\n    }\n\n    unsafe fn setRepresentedFilename_(self, filePath: id) {\n        msg_send![self, setRepresentedFilename:filePath]\n    }\n\n    unsafe fn representedURL(self) -> id {\n        msg_send![self, representedURL]\n    }\n\n    unsafe fn setRepresentedURL_(self, representedURL: id) {\n        msg_send![self, setRepresentedURL:representedURL]\n    }\n\n    // Accessing Screen Information\n\n    unsafe fn screen(self) -> id {\n        msg_send![self, screen]\n    }\n\n    unsafe fn deepestScreen(self) -> id {\n        msg_send![self, deepestScreen]\n    }\n\n    unsafe fn displaysWhenScreenProfileChanges(self) -> BOOL {\n        msg_send![self, displaysWhenScreenProfileChanges]\n    }\n\n    unsafe fn setDisplaysWhenScreenProfileChanges_(self, displaysWhenScreenProfileChanges: BOOL) {\n        msg_send![self, setDisplaysWhenScreenProfileChanges:displaysWhenScreenProfileChanges]\n    }\n\n    // Moving Windows\n\n    unsafe fn setMovableByWindowBackground_(self, movableByWindowBackground: BOOL) {\n        msg_send![self, setMovableByWindowBackground:movableByWindowBackground]\n    }\n\n    unsafe fn setMovable_(self, movable: BOOL) {\n        msg_send![self, setMovable:movable]\n    }\n\n    unsafe fn center(self) {\n        msg_send![self, center]\n    }\n\n    // Closing Windows\n\n    unsafe fn performClose_(self, sender: id) {\n        msg_send![self, performClose:sender]\n    }\n\n    unsafe fn close(self) {\n        msg_send![self, close]\n    }\n\n    unsafe fn setReleasedWhenClosed_(self, releasedWhenClosed: BOOL) {\n        msg_send![self, setReleasedWhenClosed:releasedWhenClosed]\n    }\n\n    // Minimizing Windows\n\n    unsafe fn performMiniaturize_(self, sender: id) {\n        msg_send![self, performMiniaturize:sender]\n    }\n\n    unsafe fn miniaturize_(self, sender: id) {\n        msg_send![self, miniaturize:sender]\n    }\n\n    unsafe fn deminiaturize_(self, sender: id) {\n        msg_send![self, deminiaturize:sender]\n    }\n\n    unsafe fn miniwindowImage(self) -> id {\n        msg_send![self, miniwindowImage]\n    }\n\n    unsafe fn setMiniwindowImage_(self, miniwindowImage: id) {\n        msg_send![self, setMiniwindowImage:miniwindowImage]\n    }\n\n    unsafe fn miniwindowTitle(self) -> id {\n        msg_send![self, miniwindowTitle]\n    }\n\n    unsafe fn setMiniwindowTitle_(self, miniwindowTitle: id) {\n        msg_send![self, setMiniwindowTitle:miniwindowTitle]\n    }\n\n    // TODO: Getting the Dock Tile\n    // TODO: Printing Windows\n    // TODO: Providing Services\n    // TODO: Working with Carbon\n    // TODO: Triggering Constraint-Based Layout\n    // TODO: Debugging Constraint-Based Layout\n    // TODO: Constraint-Based Layouts\n}\n\npub trait NSView: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSView\"), alloc]\n    }\n\n    unsafe fn init(self) -> id;\n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;\n    unsafe fn bounds(self) -> NSRect;\n    unsafe fn frame(self) -> NSRect;\n    unsafe fn display_(self);\n    unsafe fn setWantsBestResolutionOpenGLSurface_(self, flag: BOOL);\n    unsafe fn convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint;\n    unsafe fn addSubview_(self, view: id);\n    unsafe fn superview(self) -> id;\n    unsafe fn removeFromSuperview(self);\n    unsafe fn setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions);\n\n    unsafe fn wantsLayer(self) -> BOOL;\n    unsafe fn setWantsLayer(self, wantsLayer: BOOL);\n    unsafe fn layer(self) -> id;\n    unsafe fn setLayer(self, layer: id);\n\n    unsafe fn widthAnchor(self) -> id;\n    unsafe fn heightAnchor(self) -> id;\n}\n\nimpl NSView for id {\n    unsafe fn init(self) -> id {\n        msg_send![self, init]\n    }\n\n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {\n        msg_send![self, initWithFrame:frameRect]\n    }\n\n    unsafe fn bounds(self) -> NSRect {\n        msg_send![self, bounds]\n    }\n\n    unsafe fn frame(self) -> NSRect {\n        msg_send![self, frame]\n    }\n\n    unsafe fn display_(self) {\n        msg_send![self, display]\n    }\n\n    unsafe fn setWantsBestResolutionOpenGLSurface_(self, flag: BOOL) {\n        msg_send![self, setWantsBestResolutionOpenGLSurface:flag]\n    }\n\n    unsafe fn convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint {\n        msg_send![self, convertPoint:point fromView:view]\n    }\n\n    unsafe fn addSubview_(self, view: id) {\n        msg_send![self, addSubview:view]\n    }\n\n    unsafe fn superview(self) -> id {\n        msg_send![self, superview]\n    }\n\n    unsafe fn removeFromSuperview(self) {\n        msg_send![self, removeFromSuperview]\n    }\n\n    unsafe fn setAutoresizingMask_(self, autoresizingMask: NSAutoresizingMaskOptions) {\n        msg_send![self, setAutoresizingMask:autoresizingMask]\n    }\n\n    unsafe fn wantsLayer(self) -> BOOL {\n        msg_send![self, wantsLayer]\n    }\n\n    unsafe fn setWantsLayer(self, wantsLayer: BOOL) {\n        msg_send![self, setWantsLayer:wantsLayer]\n    }\n\n    unsafe fn layer(self) -> id {\n        msg_send![self, layer]\n    }\n\n    unsafe fn setLayer(self, layer: id) {\n        msg_send![self, setLayer:layer]\n    }\n\n    unsafe fn widthAnchor(self) -> id {\n        msg_send![self, widthAnchor]\n    }\n\n    unsafe fn heightAnchor(self) -> id {\n        msg_send![self, heightAnchor]\n    }\n}\n\npub type NSAutoresizingMaskOptions = u64;\n\npub const NSViewNotSizable: u64 = 0;\npub const NSViewMinXMargin: u64 = 1;\npub const NSViewWidthSizable: u64 = 2;\npub const NSViewMaxXMargin: u64 = 4;\npub const NSViewMinYMargin: u64 = 8;\npub const NSViewHeightSizable: u64 = 16;\npub const NSViewMaxYMargin: u64 = 32;\n\npub trait NSOpenGLView: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSOpenGLView\"), alloc]\n    }\n\n    unsafe fn initWithFrame_pixelFormat_(self, frameRect: NSRect, format: id) -> id;\n    unsafe fn display_(self);\n    unsafe fn setOpenGLContext_(self, context: id);\n    unsafe fn setPixelFormat_(self, pixelformat: id);\n}\n\nimpl NSOpenGLView for id {\n    unsafe fn initWithFrame_pixelFormat_(self,  frameRect: NSRect, format: id) -> id {\n        msg_send![self, initWithFrame:frameRect pixelFormat:format]\n    }\n\n    unsafe fn display_(self) {\n        msg_send![self, display]\n    }\n\n    unsafe fn setOpenGLContext_(self, context: id) {\n        msg_send![self, setOpenGLContext:context]\n    }\n\n    unsafe fn setPixelFormat_(self, pixelformat: id) {\n        msg_send![self, setPixelFormat:pixelformat]\n    }\n}\n\npub trait NSOpenGLPixelFormat: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSOpenGLPixelFormat\"), alloc]\n    }\n\n    // Creating an NSOpenGLPixelFormat Object\n\n    unsafe fn initWithAttributes_(self, attributes: &[u32]) -> id;\n\n    // Managing the Pixel Format\n\n    unsafe fn getValues_forAttribute_forVirtualScreen_(self, val: *mut GLint, attrib: NSOpenGLPixelFormatAttribute, screen: GLint);\n    unsafe fn numberOfVirtualScreens(self) -> GLint;\n\n}\n\nimpl NSOpenGLPixelFormat for id {\n    // Creating an NSOpenGLPixelFormat Object\n\n    unsafe fn initWithAttributes_(self, attributes: &[u32]) -> id {\n        msg_send![self, initWithAttributes:attributes]\n    }\n\n    // Managing the Pixel Format\n\n    unsafe fn getValues_forAttribute_forVirtualScreen_(self, val: *mut GLint, attrib: NSOpenGLPixelFormatAttribute, screen: GLint) {\n        msg_send![self, getValues:val forAttribute:attrib forVirtualScreen:screen]\n    }\n\n    unsafe fn numberOfVirtualScreens(self) -> GLint {\n        msg_send![self, numberOfVirtualScreens]\n    }\n}\n\npub trait NSOpenGLContext: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSOpenGLContext\"), alloc]\n    }\n\n    // Context Creation\n    unsafe fn initWithFormat_shareContext_(self, format: id /* (NSOpenGLPixelFormat *) */, shareContext: id /* (NSOpenGLContext *) */) -> id /* (instancetype) */;\n    unsafe fn initWithCGLContextObj_(self, context: CGLContextObj) -> id /* (instancetype) */;\n\n    // Managing the Current Context\n    unsafe fn clearCurrentContext(_: Self);\n    unsafe fn currentContext(_: Self) -> id /* (NSOpenGLContext *) */;\n    unsafe fn makeCurrentContext(self);\n\n    // Drawable Object Management\n    unsafe fn setView_(self, view: id /* (NSView *) */);\n    unsafe fn view(self) -> id /* (NSView *) */;\n    unsafe fn clearDrawable(self);\n    unsafe fn update(self);\n\n    // Flushing the Drawing Buffer\n    unsafe fn flushBuffer(self);\n\n    // Context Parameter Handling\n    unsafe fn setValues_forParameter_(self, vals: *const GLint, param: NSOpenGLContextParameter);\n    unsafe fn getValues_forParameter_(self, vals: *mut GLint, param: NSOpenGLContextParameter);\n\n    // Working with Virtual Screens\n    unsafe fn setCurrentVirtualScreen_(self, screen: GLint);\n    unsafe fn currentVirtualScreen(self) -> GLint;\n\n    // Getting the CGL Context Object\n    unsafe fn CGLContextObj(self) -> CGLContextObj;\n}\n\nimpl NSOpenGLContext for id {\n    // Context Creation\n\n    unsafe fn initWithFormat_shareContext_(self, format: id /* (NSOpenGLPixelFormat *) */, shareContext: id /* (NSOpenGLContext *) */) -> id /* (instancetype) */ {\n        msg_send![self, initWithFormat:format shareContext:shareContext]\n    }\n\n    unsafe fn initWithCGLContextObj_(self, context: CGLContextObj) -> id /* (instancetype) */ {\n        msg_send![self, initWithCGLContextObj:context]\n    }\n\n    // Managing the Current Context\n\n    unsafe fn clearCurrentContext(_: Self) {\n        msg_send![class(\"NSOpenGLContext\"), clearCurrentContext]\n    }\n\n    unsafe fn currentContext(_: Self) -> id /* (NSOpenGLContext *) */ {\n        msg_send![class(\"NSOpenGLContext\"), currentContext]\n    }\n\n    unsafe fn makeCurrentContext(self) {\n        msg_send![self, makeCurrentContext]\n    }\n\n    // Drawable Object Management\n\n    unsafe fn setView_(self, view: id /* (NSView *) */) {\n        msg_send![self, setView:view]\n    }\n\n    unsafe fn view(self) -> id /* (NSView *) */ {\n        msg_send![self, view]\n    }\n\n    unsafe fn clearDrawable(self) {\n        msg_send![self, clearDrawable]\n    }\n\n    unsafe fn update(self) {\n        msg_send![self, update]\n    }\n\n    // Flushing the Drawing Buffer\n\n    unsafe fn flushBuffer(self) {\n        msg_send![self, flushBuffer]\n    }\n\n    // Context Parameter Handling\n\n    unsafe fn setValues_forParameter_(self, vals: *const GLint, param: NSOpenGLContextParameter) {\n        msg_send![self, setValues:vals forParameter:param]\n    }\n\n    unsafe fn getValues_forParameter_(self, vals: *mut GLint, param: NSOpenGLContextParameter) {\n        msg_send![self, getValues:vals forParameter:param]\n    }\n\n    // Working with Virtual Screens\n\n    unsafe fn setCurrentVirtualScreen_(self, screen: GLint) {\n        msg_send![self, setCurrentVirtualScreen:screen]\n    }\n\n    unsafe fn currentVirtualScreen(self) -> GLint {\n        msg_send![self, currentVirtualScreen]\n    }\n\n    // Getting the CGL Context Object\n\n    unsafe fn CGLContextObj(self) -> CGLContextObj {\n        msg_send![self, CGLContextObj]\n    }\n}\n\nbitflags! {\n    pub struct NSEventSwipeTrackingOptions: NSUInteger {\n        const NSEventSwipeTrackingLockDirection         = 0x1 << 0;\n        const NSEventSwipeTrackingClampGestureAmount    = 0x1 << 1;\n    }\n}\n\n#[repr(i64)] // NSInteger\npub enum NSEventGestureAxis {\n    NSEventGestureAxisNone = 0,\n    NSEventGestureAxisHorizontal,\n    NSEventGestureAxisVertical,\n}\n\nbitflags! {\n    pub struct NSEventPhase: NSUInteger {\n       const NSEventPhaseNone        = 0;\n       const NSEventPhaseBegan       = 0x1 << 0;\n       const NSEventPhaseStationary  = 0x1 << 1;\n       const NSEventPhaseChanged     = 0x1 << 2;\n       const NSEventPhaseEnded       = 0x1 << 3;\n       const NSEventPhaseCancelled   = 0x1 << 4;\n       const NSEventPhaseMayBegin    = 0x1 << 5;\n    }\n}\n\nbitflags! {\n    pub struct NSTouchPhase: NSUInteger {\n        const NSTouchPhaseBegan         = 1 << 0;\n        const NSTouchPhaseMoved         = 1 << 1;\n        const NSTouchPhaseStationary    = 1 << 2;\n        const NSTouchPhaseEnded         = 1 << 3;\n        const NSTouchPhaseCancelled     = 1 << 4;\n        const NSTouchPhaseTouching      = NSTouchPhase::NSTouchPhaseBegan.bits\n                                        | NSTouchPhase::NSTouchPhaseMoved.bits\n                                        | NSTouchPhase::NSTouchPhaseStationary.bits;\n        const NSTouchPhaseAny           = !0; // NSUIntegerMax\n    }\n}\n\n#[derive(Clone, Copy, Debug, PartialEq)]\n#[repr(u64)] // NSUInteger\npub enum NSEventType {\n    NSLeftMouseDown         = 1,\n    NSLeftMouseUp           = 2,\n    NSRightMouseDown        = 3,\n    NSRightMouseUp          = 4,\n    NSMouseMoved            = 5,\n    NSLeftMouseDragged      = 6,\n    NSRightMouseDragged     = 7,\n    NSMouseEntered          = 8,\n    NSMouseExited           = 9,\n    NSKeyDown               = 10,\n    NSKeyUp                 = 11,\n    NSFlagsChanged          = 12,\n    NSAppKitDefined         = 13,\n    NSSystemDefined         = 14,\n    NSApplicationDefined    = 15,\n    NSPeriodic              = 16,\n    NSCursorUpdate          = 17,\n    NSScrollWheel           = 22,\n    NSTabletPoint           = 23,\n    NSTabletProximity       = 24,\n    NSOtherMouseDown        = 25,\n    NSOtherMouseUp          = 26,\n    NSOtherMouseDragged     = 27,\n    NSEventTypeGesture      = 29,\n    NSEventTypeMagnify      = 30,\n    NSEventTypeSwipe        = 31,\n    NSEventTypeRotate       = 18,\n    NSEventTypeBeginGesture = 19,\n    NSEventTypeEndGesture   = 20,\n    NSEventTypePressure     = 34,\n}\n\nbitflags! {\n    pub struct NSEventMask: libc::c_ulonglong {\n        const NSLeftMouseDownMask         = 1 << NSLeftMouseDown as libc::c_ulonglong;\n        const NSLeftMouseUpMask           = 1 << NSLeftMouseUp as libc::c_ulonglong;\n        const NSRightMouseDownMask        = 1 << NSRightMouseDown as libc::c_ulonglong;\n        const NSRightMouseUpMask          = 1 << NSRightMouseUp as libc::c_ulonglong;\n        const NSMouseMovedMask            = 1 << NSMouseMoved as libc::c_ulonglong;\n        const NSLeftMouseDraggedMask      = 1 << NSLeftMouseDragged as libc::c_ulonglong;\n        const NSRightMouseDraggedMask     = 1 << NSRightMouseDragged as libc::c_ulonglong;\n        const NSMouseEnteredMask          = 1 << NSMouseEntered as libc::c_ulonglong;\n        const NSMouseExitedMask           = 1 << NSMouseExited as libc::c_ulonglong;\n        const NSKeyDownMask               = 1 << NSKeyDown as libc::c_ulonglong;\n        const NSKeyUpMask                 = 1 << NSKeyUp as libc::c_ulonglong;\n        const NSFlagsChangedMask          = 1 << NSFlagsChanged as libc::c_ulonglong;\n        const NSAppKitDefinedMask         = 1 << NSAppKitDefined as libc::c_ulonglong;\n        const NSSystemDefinedMask         = 1 << NSSystemDefined as libc::c_ulonglong;\n        const NSApplicationDefinedMask    = 1 << NSApplicationDefined as libc::c_ulonglong;\n        const NSPeriodicMask              = 1 << NSPeriodic as libc::c_ulonglong;\n        const NSCursorUpdateMask          = 1 << NSCursorUpdate as libc::c_ulonglong;\n        const NSScrollWheelMask           = 1 << NSScrollWheel as libc::c_ulonglong;\n        const NSTabletPointMask           = 1 << NSTabletPoint as libc::c_ulonglong;\n        const NSTabletProximityMask       = 1 << NSTabletProximity as libc::c_ulonglong;\n        const NSOtherMouseDownMask        = 1 << NSOtherMouseDown as libc::c_ulonglong;\n        const NSOtherMouseUpMask          = 1 << NSOtherMouseUp as libc::c_ulonglong;\n        const NSOtherMouseDraggedMask     = 1 << NSOtherMouseDragged as libc::c_ulonglong;\n        const NSEventMaskGesture          = 1 << NSEventTypeGesture as libc::c_ulonglong;\n        const NSEventMaskSwipe            = 1 << NSEventTypeSwipe as libc::c_ulonglong;\n        const NSEventMaskRotate           = 1 << NSEventTypeRotate as libc::c_ulonglong;\n        const NSEventMaskBeginGesture     = 1 << NSEventTypeBeginGesture as libc::c_ulonglong;\n        const NSEventMaskEndGesture       = 1 << NSEventTypeEndGesture as libc::c_ulonglong;\n        const NSEventMaskPressure         = 1 << NSEventTypePressure as libc::c_ulonglong;\n        const NSAnyEventMask              = 0xffffffffffffffff;\n    }\n}\n\nimpl NSEventMask {\n    pub fn from_type(ty: NSEventType) -> NSEventMask {\n        NSEventMask { bits: 1 << ty as libc::c_ulonglong }\n    }\n}\n\nbitflags! {\n    pub struct NSEventModifierFlags: NSUInteger {\n        const NSAlphaShiftKeyMask                     = 1 << 16;\n        const NSShiftKeyMask                          = 1 << 17;\n        const NSControlKeyMask                        = 1 << 18;\n        const NSAlternateKeyMask                      = 1 << 19;\n        const NSCommandKeyMask                        = 1 << 20;\n        const NSNumericPadKeyMask                     = 1 << 21;\n        const NSHelpKeyMask                           = 1 << 22;\n        const NSFunctionKeyMask                       = 1 << 23;\n        const NSDeviceIndependentModifierFlagsMask    = 0xffff0000;\n    }\n}\n\n// Not sure of the type here\npub enum NSPointingDeviceType {\n    // TODO: Not sure what these values are\n    // NSUnknownPointingDevice = NX_TABLET_POINTER_UNKNOWN,\n    // NSPenPointingDevice     = NX_TABLET_POINTER_PEN,\n    // NSCursorPointingDevice  = NX_TABLET_POINTER_CURSOR,\n    // NSEraserPointingDevice  = NX_TABLET_POINTER_ERASER,\n}\n\n// Not sure of the type here\npub enum NSEventButtonMask {\n    // TODO: Not sure what these values are\n    // NSPenTipMask =       NX_TABLET_BUTTON_PENTIPMASK,\n    // NSPenLowerSideMask = NX_TABLET_BUTTON_PENLOWERSIDEMASK,\n    // NSPenUpperSideMask = NX_TABLET_BUTTON_PENUPPERSIDEMASK,\n}\n\n#[repr(i16)]\npub enum NSEventSubtype {\n    // TODO: Not sure what these values are\n    // NSMouseEventSubtype           = NX_SUBTYPE_DEFAULT,\n    // NSTabletPointEventSubtype     = NX_SUBTYPE_TABLET_POINT,\n    // NSTabletProximityEventSubtype = NX_SUBTYPE_TABLET_PROXIMITY\n    // NSTouchEventSubtype           = NX_SUBTYPE_MOUSE_TOUCH,\n    NSWindowExposedEventType = 0,\n    NSApplicationActivatedEventType = 1,\n    NSApplicationDeactivatedEventType = 2,\n    NSWindowMovedEventType = 4,\n    NSScreenChangedEventType = 8,\n    NSAWTEventType = 16,\n}\n\npub const NSUpArrowFunctionKey: libc::c_ushort = 0xF700;\npub const NSDownArrowFunctionKey: libc::c_ushort = 0xF701;\npub const NSLeftArrowFunctionKey: libc::c_ushort = 0xF702;\npub const NSRightArrowFunctionKey: libc::c_ushort = 0xF703;\npub const NSF1FunctionKey: libc::c_ushort = 0xF704;\npub const NSF2FunctionKey: libc::c_ushort = 0xF705;\npub const NSF3FunctionKey: libc::c_ushort = 0xF706;\npub const NSF4FunctionKey: libc::c_ushort = 0xF707;\npub const NSF5FunctionKey: libc::c_ushort = 0xF708;\npub const NSF6FunctionKey: libc::c_ushort = 0xF709;\npub const NSF7FunctionKey: libc::c_ushort = 0xF70A;\npub const NSF8FunctionKey: libc::c_ushort = 0xF70B;\npub const NSF9FunctionKey: libc::c_ushort = 0xF70C;\npub const NSF10FunctionKey: libc::c_ushort = 0xF70D;\npub const NSF11FunctionKey: libc::c_ushort = 0xF70E;\npub const NSF12FunctionKey: libc::c_ushort = 0xF70F;\npub const NSF13FunctionKey: libc::c_ushort = 0xF710;\npub const NSF14FunctionKey: libc::c_ushort = 0xF711;\npub const NSF15FunctionKey: libc::c_ushort = 0xF712;\npub const NSF16FunctionKey: libc::c_ushort = 0xF713;\npub const NSF17FunctionKey: libc::c_ushort = 0xF714;\npub const NSF18FunctionKey: libc::c_ushort = 0xF715;\npub const NSF19FunctionKey: libc::c_ushort = 0xF716;\npub const NSF20FunctionKey: libc::c_ushort = 0xF717;\npub const NSF21FunctionKey: libc::c_ushort = 0xF718;\npub const NSF22FunctionKey: libc::c_ushort = 0xF719;\npub const NSF23FunctionKey: libc::c_ushort = 0xF71A;\npub const NSF24FunctionKey: libc::c_ushort = 0xF71B;\npub const NSF25FunctionKey: libc::c_ushort = 0xF71C;\npub const NSF26FunctionKey: libc::c_ushort = 0xF71D;\npub const NSF27FunctionKey: libc::c_ushort = 0xF71E;\npub const NSF28FunctionKey: libc::c_ushort = 0xF71F;\npub const NSF29FunctionKey: libc::c_ushort = 0xF720;\npub const NSF30FunctionKey: libc::c_ushort = 0xF721;\npub const NSF31FunctionKey: libc::c_ushort = 0xF722;\npub const NSF32FunctionKey: libc::c_ushort = 0xF723;\npub const NSF33FunctionKey: libc::c_ushort = 0xF724;\npub const NSF34FunctionKey: libc::c_ushort = 0xF725;\npub const NSF35FunctionKey: libc::c_ushort = 0xF726;\npub const NSInsertFunctionKey: libc::c_ushort = 0xF727;\npub const NSDeleteFunctionKey: libc::c_ushort = 0xF728;\npub const NSHomeFunctionKey: libc::c_ushort = 0xF729;\npub const NSBeginFunctionKey: libc::c_ushort = 0xF72A;\npub const NSEndFunctionKey: libc::c_ushort = 0xF72B;\npub const NSPageUpFunctionKey: libc::c_ushort = 0xF72C;\npub const NSPageDownFunctionKey: libc::c_ushort = 0xF72D;\npub const NSPrintScreenFunctionKey: libc::c_ushort = 0xF72E;\npub const NSScrollLockFunctionKey: libc::c_ushort = 0xF72F;\npub const NSPauseFunctionKey: libc::c_ushort = 0xF730;\npub const NSSysReqFunctionKey: libc::c_ushort = 0xF731;\npub const NSBreakFunctionKey: libc::c_ushort = 0xF732;\npub const NSResetFunctionKey: libc::c_ushort = 0xF733;\npub const NSStopFunctionKey: libc::c_ushort = 0xF734;\npub const NSMenuFunctionKey: libc::c_ushort = 0xF735;\npub const NSUserFunctionKey: libc::c_ushort = 0xF736;\npub const NSSystemFunctionKey: libc::c_ushort = 0xF737;\npub const NSPrintFunctionKey: libc::c_ushort = 0xF738;\npub const NSClearLineFunctionKey: libc::c_ushort = 0xF739;\npub const NSClearDisplayFunctionKey: libc::c_ushort = 0xF73A;\npub const NSInsertLineFunctionKey: libc::c_ushort = 0xF73B;\npub const NSDeleteLineFunctionKey: libc::c_ushort = 0xF73C;\npub const NSInsertCharFunctionKey: libc::c_ushort = 0xF73D;\npub const NSDeleteCharFunctionKey: libc::c_ushort = 0xF73E;\npub const NSPrevFunctionKey: libc::c_ushort = 0xF73F;\npub const NSNextFunctionKey: libc::c_ushort = 0xF740;\npub const NSSelectFunctionKey: libc::c_ushort = 0xF741;\npub const NSExecuteFunctionKey: libc::c_ushort = 0xF742;\npub const NSUndoFunctionKey: libc::c_ushort = 0xF743;\npub const NSRedoFunctionKey: libc::c_ushort = 0xF744;\npub const NSFindFunctionKey: libc::c_ushort = 0xF745;\npub const NSHelpFunctionKey: libc::c_ushort = 0xF746;\npub const NSModeSwitchFunctionKey: libc::c_ushort = 0xF747;\n\npub trait NSEvent: Sized {\n    // Creating Events\n    unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        characters: id /* (NSString *) */,\n        unmodCharacters: id /* (NSString *) */,\n        repeatKey: BOOL,\n        code: libc::c_ushort) -> id /* (NSEvent *) */;\n    unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        eventNumber: NSInteger,\n        clickCount: NSInteger,\n        pressure: libc::c_float) -> id /* (NSEvent *) */;\n    unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        eventNumber: NSInteger,\n        trackingNumber: NSInteger,\n        userData: *mut libc::c_void) -> id /* (NSEvent *) */;\n    unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        subtype: NSEventSubtype,\n        data1: NSInteger,\n        data2: NSInteger) -> id /* (NSEvent *) */;\n    unsafe fn eventWithEventRef_(_: Self, eventRef: *const libc::c_void) -> id;\n    unsafe fn eventWithCGEvent_(_: Self, cgEvent: *mut libc::c_void /* CGEventRef */) -> id;\n\n    // Getting General Event Information\n    unsafe fn context(self) -> id /* (NSGraphicsContext *) */;\n    unsafe fn locationInWindow(self) -> NSPoint;\n    unsafe fn modifierFlags(self) -> NSEventModifierFlags;\n    unsafe fn timestamp(self) -> NSTimeInterval;\n    // NOTE: renamed from `- type` due to Rust keyword collision\n    unsafe fn eventType(self) -> NSEventType;\n    unsafe fn window(self) -> id /* (NSWindow *) */;\n    unsafe fn windowNumber(self) -> NSInteger;\n    unsafe fn eventRef(self) -> *const libc::c_void;\n    unsafe fn CGEvent(self) -> *mut libc::c_void /* CGEventRef */;\n\n    // Getting Key Event Information\n    // NOTE: renamed from `+ modifierFlags` due to conflict with `- modifierFlags`\n    unsafe fn currentModifierFlags(_: Self) -> NSEventModifierFlags;\n    unsafe fn keyRepeatDelay(_: Self) -> NSTimeInterval;\n    unsafe fn keyRepeatInterval(_: Self) -> NSTimeInterval;\n    unsafe fn characters(self) -> id /* (NSString *) */;\n    unsafe fn charactersIgnoringModifiers(self) -> id /* (NSString *) */;\n    unsafe fn keyCode(self) -> libc::c_ushort;\n\n    // Getting Mouse Event Information\n    unsafe fn pressedMouseButtons(_: Self) -> NSUInteger;\n    unsafe fn doubleClickInterval(_: Self) -> NSTimeInterval;\n    unsafe fn mouseLocation(_: Self) -> NSPoint;\n    unsafe fn buttonNumber(self) -> NSInteger;\n    unsafe fn clickCount(self) -> NSInteger;\n    unsafe fn pressure(self) -> libc::c_float;\n    unsafe fn stage(self) -> NSInteger;\n    unsafe fn setMouseCoalescingEnabled_(_: Self, flag: BOOL);\n    unsafe fn isMouseCoalescingEnabled(_: Self) -> BOOL;\n\n    // Getting Mouse-Tracking Event Information\n    unsafe fn eventNumber(self) -> NSInteger;\n    unsafe fn trackingNumber(self) -> NSInteger;\n    unsafe fn trackingArea(self) -> id /* (NSTrackingArea *) */;\n    unsafe fn userData(self) -> *const libc::c_void;\n\n    // Getting Custom Event Information\n    unsafe fn data1(self) -> NSInteger;\n    unsafe fn data2(self) -> NSInteger;\n    unsafe fn subtype(self) -> NSEventSubtype;\n\n    // Getting Scroll Wheel Event Information\n    unsafe fn deltaX(self) -> CGFloat;\n    unsafe fn deltaY(self) -> CGFloat;\n    unsafe fn deltaZ(self) -> CGFloat;\n\n    // Getting Tablet Proximity Information\n    unsafe fn capabilityMask(self) -> NSUInteger;\n    unsafe fn deviceID(self) -> NSUInteger;\n    unsafe fn pointingDeviceID(self) -> NSUInteger;\n    unsafe fn pointingDeviceSerialNumber(self) -> NSUInteger;\n    unsafe fn pointingDeviceType(self) -> NSPointingDeviceType;\n    unsafe fn systemTabletID(self) -> NSUInteger;\n    unsafe fn tabletID(self) -> NSUInteger;\n    unsafe fn uniqueID(self) -> libc::c_ulonglong;\n    unsafe fn vendorID(self) -> NSUInteger;\n    unsafe fn vendorPointingDeviceType(self) -> NSUInteger;\n\n    // Getting Tablet Pointing Information\n    unsafe fn absoluteX(self) -> NSInteger;\n    unsafe fn absoluteY(self) -> NSInteger;\n    unsafe fn absoluteZ(self) -> NSInteger;\n    unsafe fn buttonMask(self) -> NSEventButtonMask;\n    unsafe fn rotation(self) -> libc::c_float;\n    unsafe fn tangentialPressure(self) -> libc::c_float;\n    unsafe fn tilt(self) -> NSPoint;\n    unsafe fn vendorDefined(self) -> id;\n\n    // Requesting and Stopping Periodic Events\n    unsafe fn startPeriodicEventsAfterDelay_withPeriod_(_: Self, delaySeconds: NSTimeInterval, periodSeconds: NSTimeInterval);\n    unsafe fn stopPeriodicEvents(_: Self);\n\n    // Getting Touch and Gesture Information\n    unsafe fn magnification(self) -> CGFloat;\n    unsafe fn touchesMatchingPhase_inView_(self, phase: NSTouchPhase, view: id /* (NSView *) */) -> id /* (NSSet *) */;\n    unsafe fn isSwipeTrackingFromScrollEventsEnabled(_: Self) -> BOOL;\n\n    // Monitoring Application Events\n    // TODO: addGlobalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)\n    // TODO: addLocalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)\n    unsafe fn removeMonitor_(_: Self, eventMonitor: id);\n\n    // Scroll Wheel and Flick Events\n    unsafe fn hasPreciseScrollingDeltas(self) -> BOOL;\n    unsafe fn scrollingDeltaX(self) -> CGFloat;\n    unsafe fn scrollingDeltaY(self) -> CGFloat;\n    unsafe fn momentumPhase(self) -> NSEventPhase;\n    unsafe fn phase(self) -> NSEventPhase;\n    // TODO: trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler_ (unsure how to bind to blocks)\n\n    // Converting a Mouse Event’s Position into a Sprite Kit Node’s Coordinate Space\n    unsafe fn locationInNode_(self, node: id /* (SKNode *) */) -> CGPoint;\n}\n\nimpl NSEvent for id {\n    // Creating Events\n\n    unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        characters: id /* (NSString *) */,\n        unmodCharacters: id /* (NSString *) */,\n        repeatKey: BOOL,\n        code: libc::c_ushort) -> id /* (NSEvent *) */\n    {\n        msg_send![class(\"NSEvent\"), keyEventWithType:eventType\n                                            location:location\n                                       modifierFlags:modifierFlags\n                                           timestamp:timestamp\n                                        windowNumber:windowNumber\n                                             context:context\n                                          characters:characters\n                         charactersIgnoringModifiers:unmodCharacters\n                                           isARepeat:repeatKey\n                                             keyCode:code]\n    }\n\n    unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        eventNumber: NSInteger,\n        clickCount: NSInteger,\n        pressure: libc::c_float) -> id /* (NSEvent *) */\n    {\n        msg_send![class(\"NSEvent\"), mouseEventWithType:eventType\n                                              location:location\n                                         modifierFlags:modifierFlags\n                                             timestamp:timestamp\n                                          windowNumber:windowNumber\n                                               context:context\n                                           eventNumber:eventNumber\n                                            clickCount:clickCount\n                                              pressure:pressure]\n    }\n\n    unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        eventNumber: NSInteger,\n        trackingNumber: NSInteger,\n        userData: *mut libc::c_void) -> id /* (NSEvent *) */\n    {\n        msg_send![class(\"NSEvent\"), enterExitEventWithType:eventType\n                                                  location:location\n                                             modifierFlags:modifierFlags\n                                                 timestamp:timestamp\n                                              windowNumber:windowNumber\n                                                   context:context\n                                               eventNumber:eventNumber\n                                            trackingNumber:trackingNumber\n                                                  userData:userData]\n    }\n\n    unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_(\n        _: Self,\n        eventType: NSEventType,\n        location: NSPoint,\n        modifierFlags: NSEventModifierFlags,\n        timestamp: NSTimeInterval,\n        windowNumber: NSInteger,\n        context: id /* (NSGraphicsContext *) */,\n        subtype: NSEventSubtype,\n        data1: NSInteger,\n        data2: NSInteger) -> id /* (NSEvent *) */\n    {\n        msg_send![class(\"NSEvent\"), otherEventWithType:eventType\n                                              location:location\n                                         modifierFlags:modifierFlags\n                                             timestamp:timestamp\n                                          windowNumber:windowNumber\n                                               context:context\n                                               subtype:subtype\n                                                 data1:data1\n                                                 data2:data2]\n    }\n\n    unsafe fn eventWithEventRef_(_: Self, eventRef: *const libc::c_void) -> id {\n        msg_send![class(\"NSEvent\"), eventWithEventRef:eventRef]\n    }\n\n    unsafe fn eventWithCGEvent_(_: Self, cgEvent: *mut libc::c_void /* CGEventRef */) -> id {\n        msg_send![class(\"NSEvent\"), eventWithCGEvent:cgEvent]\n    }\n\n    // Getting General Event Information\n\n    unsafe fn context(self) -> id /* (NSGraphicsContext *) */ {\n        msg_send![self, context]\n    }\n\n    unsafe fn locationInWindow(self) -> NSPoint {\n        msg_send![self, locationInWindow]\n    }\n\n    unsafe fn modifierFlags(self) -> NSEventModifierFlags {\n        msg_send![self, modifierFlags]\n    }\n\n    unsafe fn timestamp(self) -> NSTimeInterval {\n        msg_send![self, timestamp]\n    }\n    // NOTE: renamed from `- type` due to Rust keyword collision\n\n    unsafe fn eventType(self) -> NSEventType {\n        msg_send![self, type]\n    }\n\n    unsafe fn window(self) -> id /* (NSWindow *) */ {\n        msg_send![self, window]\n    }\n\n    unsafe fn windowNumber(self) -> NSInteger {\n        msg_send![self, windowNumber]\n    }\n\n    unsafe fn eventRef(self) -> *const libc::c_void {\n        msg_send![self, eventRef]\n    }\n\n    unsafe fn CGEvent(self) -> *mut libc::c_void /* CGEventRef */ {\n        msg_send![self, CGEvent]\n    }\n\n    // Getting Key Event Information\n\n    // NOTE: renamed from `+ modifierFlags` due to conflict with `- modifierFlags`\n\n    unsafe fn currentModifierFlags(_: Self) -> NSEventModifierFlags {\n        msg_send![class(\"NSEvent\"), currentModifierFlags]\n    }\n\n    unsafe fn keyRepeatDelay(_: Self) -> NSTimeInterval {\n        msg_send![class(\"NSEvent\"), keyRepeatDelay]\n    }\n\n    unsafe fn keyRepeatInterval(_: Self) -> NSTimeInterval {\n        msg_send![class(\"NSEvent\"), keyRepeatInterval]\n    }\n\n    unsafe fn characters(self) -> id /* (NSString *) */ {\n        msg_send![self, characters]\n    }\n\n    unsafe fn charactersIgnoringModifiers(self) -> id /* (NSString *) */ {\n        msg_send![self, charactersIgnoringModifiers]\n    }\n\n    unsafe fn keyCode(self) -> libc::c_ushort {\n        msg_send![self, keyCode]\n    }\n\n    // Getting Mouse Event Information\n\n    unsafe fn pressedMouseButtons(_: Self) -> NSUInteger {\n        msg_send![class(\"NSEvent\"), pressedMouseButtons]\n    }\n\n    unsafe fn doubleClickInterval(_: Self) -> NSTimeInterval {\n        msg_send![class(\"NSEvent\"), doubleClickInterval]\n    }\n\n    unsafe fn mouseLocation(_: Self) -> NSPoint {\n        msg_send![class(\"NSEvent\"), mouseLocation]\n    }\n\n    unsafe fn buttonNumber(self) -> NSInteger {\n        msg_send![self, buttonNumber]\n    }\n\n    unsafe fn clickCount(self) -> NSInteger {\n        msg_send![self, clickCount]\n    }\n\n    unsafe fn pressure(self) -> libc::c_float {\n        msg_send![self, pressure]\n    }\n\n    unsafe fn stage(self) -> NSInteger{\n        msg_send![self, stage]\n    }\n\n    unsafe fn setMouseCoalescingEnabled_(_: Self, flag: BOOL) {\n        msg_send![class(\"NSEvent\"), setMouseCoalescingEnabled:flag]\n    }\n\n    unsafe fn isMouseCoalescingEnabled(_: Self) -> BOOL {\n        msg_send![class(\"NSEvent\"), isMouseCoalescingEnabled]\n    }\n\n    // Getting Mouse-Tracking Event Information\n\n    unsafe fn eventNumber(self) -> NSInteger {\n        msg_send![self, eventNumber]\n    }\n\n    unsafe fn trackingNumber(self) -> NSInteger {\n        msg_send![self, trackingNumber]\n    }\n\n    unsafe fn trackingArea(self) -> id /* (NSTrackingArea *) */ {\n        msg_send![self, trackingArea]\n    }\n\n    unsafe fn userData(self) -> *const libc::c_void {\n        msg_send![self, userData]\n    }\n\n    // Getting Custom Event Information\n\n    unsafe fn data1(self) -> NSInteger {\n        msg_send![self, data1]\n    }\n\n    unsafe fn data2(self) -> NSInteger {\n        msg_send![self, data2]\n    }\n\n    unsafe fn subtype(self) -> NSEventSubtype {\n        msg_send![self, subtype]\n    }\n\n    // Getting Scroll Wheel Event Information\n\n    unsafe fn deltaX(self) -> CGFloat {\n        msg_send![self, deltaX]\n    }\n\n    unsafe fn deltaY(self) -> CGFloat {\n        msg_send![self, deltaY]\n    }\n\n    unsafe fn deltaZ(self) -> CGFloat {\n        msg_send![self, deltaZ]\n    }\n\n    // Getting Tablet Proximity Information\n\n    unsafe fn capabilityMask(self) -> NSUInteger {\n        msg_send![self, capabilityMask]\n    }\n\n    unsafe fn deviceID(self) -> NSUInteger {\n        msg_send![self, deviceID]\n    }\n\n    unsafe fn pointingDeviceID(self) -> NSUInteger {\n        msg_send![self, pointingDeviceID]\n    }\n\n    unsafe fn pointingDeviceSerialNumber(self) -> NSUInteger {\n        msg_send![self, pointingDeviceSerialNumber]\n    }\n\n    unsafe fn pointingDeviceType(self) -> NSPointingDeviceType {\n        msg_send![self, pointingDeviceType]\n    }\n\n    unsafe fn systemTabletID(self) -> NSUInteger {\n        msg_send![self, systemTabletID]\n    }\n\n    unsafe fn tabletID(self) -> NSUInteger {\n        msg_send![self, tabletID]\n    }\n\n    unsafe fn uniqueID(self) -> libc::c_ulonglong {\n        msg_send![self, uniqueID]\n    }\n\n    unsafe fn vendorID(self) -> NSUInteger {\n        msg_send![self, vendorID]\n    }\n\n    unsafe fn vendorPointingDeviceType(self) -> NSUInteger {\n        msg_send![self, vendorPointingDeviceType]\n    }\n\n    // Getting Tablet Pointing Information\n\n    unsafe fn absoluteX(self) -> NSInteger {\n        msg_send![self, absoluteX]\n    }\n\n    unsafe fn absoluteY(self) -> NSInteger {\n        msg_send![self, absoluteY]\n    }\n\n    unsafe fn absoluteZ(self) -> NSInteger {\n        msg_send![self, absoluteZ]\n    }\n\n    unsafe fn buttonMask(self) -> NSEventButtonMask {\n        msg_send![self, buttonMask]\n    }\n\n    unsafe fn rotation(self) -> libc::c_float {\n        msg_send![self, rotation]\n    }\n\n    unsafe fn tangentialPressure(self) -> libc::c_float {\n        msg_send![self, tangentialPressure]\n    }\n\n    unsafe fn tilt(self) -> NSPoint {\n        msg_send![self, tilt]\n    }\n\n    unsafe fn vendorDefined(self) -> id {\n        msg_send![self, vendorDefined]\n    }\n\n    // Requesting and Stopping Periodic Events\n\n    unsafe fn startPeriodicEventsAfterDelay_withPeriod_(_: Self, delaySeconds: NSTimeInterval, periodSeconds: NSTimeInterval) {\n        msg_send![class(\"NSEvent\"), startPeriodicEventsAfterDelay:delaySeconds withPeriod:periodSeconds]\n    }\n\n    unsafe fn stopPeriodicEvents(_: Self) {\n        msg_send![class(\"NSEvent\"), stopPeriodicEvents]\n    }\n\n    // Getting Touch and Gesture Information\n\n    unsafe fn magnification(self) -> CGFloat {\n        msg_send![self, magnification]\n    }\n\n    unsafe fn touchesMatchingPhase_inView_(self, phase: NSTouchPhase, view: id /* (NSView *) */) -> id /* (NSSet *) */ {\n        msg_send![self, touchesMatchingPhase:phase inView:view]\n    }\n\n    unsafe fn isSwipeTrackingFromScrollEventsEnabled(_: Self) -> BOOL {\n        msg_send![class(\"NSEvent\"), isSwipeTrackingFromScrollEventsEnabled]\n    }\n\n    // Monitoring Application Events\n\n    // TODO: addGlobalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)\n    // TODO: addLocalMonitorForEventsMatchingMask_handler_ (unsure how to bind to blocks)\n\n    unsafe fn removeMonitor_(_: Self, eventMonitor: id) {\n        msg_send![class(\"NSEvent\"), removeMonitor:eventMonitor]\n    }\n\n    // Scroll Wheel and Flick Events\n\n    unsafe fn hasPreciseScrollingDeltas(self) -> BOOL {\n        msg_send![self, hasPreciseScrollingDeltas]\n    }\n\n    unsafe fn scrollingDeltaX(self) -> CGFloat {\n        msg_send![self, scrollingDeltaX]\n    }\n\n    unsafe fn scrollingDeltaY(self) -> CGFloat {\n        msg_send![self, scrollingDeltaY]\n    }\n\n    unsafe fn momentumPhase(self) -> NSEventPhase {\n        msg_send![self, momentumPhase]\n    }\n\n    unsafe fn phase(self) -> NSEventPhase {\n        msg_send![self, phase]\n    }\n\n    // TODO: trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler_ (unsure how to bind to blocks)\n\n    // Converting a Mouse Event’s Position into a Sprite Kit Node’s Coordinate Space\n    unsafe fn locationInNode_(self, node: id /* (SKNode *) */) -> CGPoint {\n        msg_send![self, locationInNode:node]\n    }\n}\n\npub trait NSScreen: Sized {\n    // Getting NSScreen Objects\n    unsafe fn mainScreen(_: Self) -> id /* (NSScreen *) */;\n    unsafe fn deepestScreen(_: Self) -> id /* (NSScreen *) */;\n    unsafe fn screens(_: Self) -> id /* (NSArray *) */;\n\n    // Getting Screen Information\n    unsafe fn depth(self) -> NSWindowDepth;\n    unsafe fn frame(self) -> NSRect;\n    unsafe fn supportedWindowDepths(self) -> *const NSWindowDepth;\n    unsafe fn deviceDescription(self) -> id /* (NSDictionary *) */;\n    unsafe fn visibleFrame(self) -> NSRect;\n    unsafe fn colorSpace(self) -> id /* (NSColorSpace *) */;\n    unsafe fn screensHaveSeparateSpaces(_: Self) -> BOOL;\n\n    // Screen Backing Coordinate Conversion\n    unsafe fn backingAlignedRect_options_(self, aRect: NSRect, options: NSAlignmentOptions) -> NSRect;\n    unsafe fn backingScaleFactor(self) -> CGFloat;\n    unsafe fn convertRectFromBacking_(self, aRect: NSRect) -> NSRect;\n    unsafe fn convertRectToBacking_(self, aRect: NSRect) -> NSRect;\n}\n\nimpl NSScreen for id {\n    // Getting NSScreen Objects\n\n    unsafe fn mainScreen(_: Self) -> id /* (NSScreen *) */ {\n        msg_send![class(\"NSScreen\"), mainScreen]\n    }\n\n    unsafe fn deepestScreen(_: Self) -> id /* (NSScreen *) */ {\n        msg_send![class(\"NSScreen\"), deepestScreen]\n    }\n\n    unsafe fn screens(_: Self) -> id /* (NSArray *) */ {\n        msg_send![class(\"NSScreen\"), screens]\n    }\n\n    // Getting Screen Information\n\n    unsafe fn depth(self) -> NSWindowDepth {\n        msg_send![self, depth]\n    }\n\n    unsafe fn frame(self) -> NSRect {\n        msg_send![self, frame]\n    }\n\n    unsafe fn supportedWindowDepths(self) -> *const NSWindowDepth {\n        msg_send![self, supportedWindowDepths]\n    }\n\n    unsafe fn deviceDescription(self) -> id /* (NSDictionary *) */ {\n        msg_send![self, deviceDescription]\n    }\n\n    unsafe fn visibleFrame(self) -> NSRect {\n        msg_send![self, visibleFrame]\n    }\n\n    unsafe fn colorSpace(self) -> id /* (NSColorSpace *) */ {\n        msg_send![self, colorSpace]\n    }\n\n    unsafe fn screensHaveSeparateSpaces(_: Self) -> BOOL {\n        msg_send![class(\"NSScreen\"), screensHaveSeparateSpaces]\n    }\n\n    // Screen Backing Coordinate Conversion\n\n    unsafe fn backingAlignedRect_options_(self, aRect: NSRect, options: NSAlignmentOptions) -> NSRect {\n        msg_send![self, backingAlignedRect:aRect options:options]\n    }\n\n    unsafe fn backingScaleFactor(self) -> CGFloat {\n        msg_send![self, backingScaleFactor]\n    }\n\n    unsafe fn convertRectFromBacking_(self, aRect: NSRect) -> NSRect {\n        msg_send![self, convertRectFromBacking:aRect]\n    }\n\n    unsafe fn convertRectToBacking_(self, aRect: NSRect) -> NSRect {\n        msg_send![self, convertRectToBacking:aRect]\n    }\n}\n\npub trait NSButton: Sized {\n     unsafe fn setImage_(self, img: id /* (NSImage *) */);\n     unsafe fn setBezelStyle_(self, style: NSBezelStyle);\n     unsafe fn setTitle_(self, title: id /* (NSString*) */);\n     unsafe fn alloc(_: Self) -> id {\n         msg_send![class(\"NSButton\"), alloc]\n     }\n     unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;\n}\n\nimpl NSButton for id {\n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {\n        msg_send![self, initWithFrame:frameRect]\n    }\n    unsafe fn setBezelStyle_(self, style: NSBezelStyle) {\n        msg_send![self, setBezelStyle:style];\n    }\n    unsafe fn setTitle_(self, title: id /* (NSString*) */) {\n        msg_send![self, setTitle:title]\n    }\n    unsafe fn setImage_(self, img: id /* (NSImage *) */) {\n        msg_send![self, setImage:img]\n    }\n}\n\npub trait NSImage: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSImage\"), alloc]\n    }\n\n    unsafe fn initByReferencingFile_(self, file_name: id /* (NSString *) */) -> id;\n    unsafe fn initWithContentsOfFile_(self, file_name: id /* (NSString *) */) -> id;\n    unsafe fn initWithData_(self, data: id /* (NSData *) */) -> id;\n    unsafe fn initWithDataIgnoringOrientation_(self, data: id /* (NSData *) */) -> id;\n    unsafe fn initWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> id;\n    unsafe fn initWithSize_flipped_drawingHandler_(self, size: NSSize,\n                                                   drawingHandlerShouldBeCalledWithFlippedContext: BOOL,\n                                                   drawingHandler: *mut Block<(NSRect,), BOOL>);\n    unsafe fn initWithSize_(self, aSize: NSSize) -> id;\n\n    unsafe fn imageNamed_(_: Self, name: id /* (NSString *) */) -> id {\n        msg_send![class(\"NSImage\"), imageNamed:name]\n    }\n\n    unsafe fn name(self) -> id /* (NSString *) */;\n    unsafe fn setName_(self, name: id /* (NSString *) */) -> BOOL;\n\n    unsafe fn size(self) -> NSSize;\n    unsafe fn template(self) -> BOOL;\n\n    unsafe fn canInitWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> BOOL;\n    unsafe fn imageTypes(self) -> id /* (NSArray<NSString *> ) */;\n    unsafe fn imageUnfilteredTypes(self) -> id /* (NSArray<NSString *> ) */;\n\n    unsafe fn addRepresentation_(self, imageRep: id /* (NSImageRep *) */);\n    unsafe fn addRepresentations_(self, imageReps: id /* (NSArray<NSImageRep *> *) */);\n    unsafe fn representations(self) -> id /* (NSArray<NSImageRep *> *) */;\n    unsafe fn removeRepresentation_(self, imageRep: id /* (NSImageRep *) */);\n    unsafe fn bestRepresentationForRect_context_hints_(self, rect: NSRect,\n                                                       referenceContext: id /* (NSGraphicsContext *) */,\n                                                       hints: id /* (NSDictionary<NSString *, id> *) */)\n                                                       -> id /* (NSImageRep *) */;\n    unsafe fn prefersColorMatch(self) -> BOOL;\n    unsafe fn usesEPSOnResolutionMismatch(self) -> BOOL;\n    unsafe fn matchesOnMultipleResolution(self) -> BOOL;\n\n    unsafe fn drawInRect_(self, rect: NSRect);\n    unsafe fn drawAtPoint_fromRect_operation_fraction_(self, point: NSPoint, srcRect: NSRect,\n                                                       op: NSCompositingOperation, delta: CGFloat);\n    unsafe fn drawInRect_fromRect_operation_fraction_(self, dstRect: NSRect, srcRect: NSRect,\n                                                      op: NSCompositingOperation, delta: CGFloat);\n    unsafe fn drawInRect_fromRect_operation_fraction_respectFlipped_hints_(self, dstSpacePortionRect: NSRect,\n        srcSpacePortionRect: NSRect, op: NSCompositingOperation, delta: CGFloat, respectContextIsFlipped: BOOL,\n        hints: id /* (NSDictionary<NSString *, id> *) */);\n    unsafe fn drawRepresentation_inRect_(self, imageRep: id /* (NSImageRep *) */, dstRect: NSRect);\n\n    unsafe fn isValid(self) -> BOOL;\n    unsafe fn backgroundColor(self) -> id /* (NSColor *) */;\n\n    unsafe fn lockFocus(self);\n    unsafe fn lockFocusFlipped_(self, flipped: BOOL);\n    unsafe fn unlockFocus(self);\n\n    unsafe fn alignmentRect(self) -> NSRect;\n\n    unsafe fn cacheMode(self) -> NSImageCacheMode;\n    unsafe fn recache(self);\n\n    unsafe fn delegate(self) -> id /* (id<NSImageDelegate *> *) */;\n\n    unsafe fn TIFFRepresentation(self) -> id /* (NSData *) */;\n    unsafe fn TIFFRepresentationUsingCompression_factor_(self, comp: NSTIFFCompression, aFloat: f32)\n                                                         -> id /* (NSData *) */;\n\n    unsafe fn cancelIncrementalLoad(self);\n\n    unsafe fn hitTestRect_withImageDestinationRect_context_hints_flipped_(self, testRectDestSpace: NSRect,\n        imageRectDestSpace: NSRect, referenceContext: id /* (NSGraphicsContext *) */,\n        hints: id /* (NSDictionary<NSString *, id> *) */, flipped: BOOL) -> BOOL;\n\n    unsafe fn accessibilityDescription(self) -> id /* (NSString *) */;\n\n    unsafe fn layerContentsForContentsScale_(self, layerContentsScale: CGFloat) -> id /* (id) */;\n    unsafe fn recommendedLayerContentsScale_(self, preferredContentsScale: CGFloat) -> CGFloat;\n\n    unsafe fn matchesOnlyOnBestFittingAxis(self) -> BOOL;\n}\n\nimpl NSImage for id {\n    unsafe fn initByReferencingFile_(self, file_name: id /* (NSString *) */) -> id {\n        msg_send![self, initByReferencingFile:file_name]\n    }\n\n    unsafe fn initWithContentsOfFile_(self, file_name: id /* (NSString *) */) -> id {\n        msg_send![self, initWithContentsOfFile:file_name]\n    }\n\n    unsafe fn initWithData_(self, data: id /* (NSData *) */) -> id {\n        msg_send![self, initWithData:data]\n    }\n\n    unsafe fn initWithDataIgnoringOrientation_(self, data: id /* (NSData *) */) -> id {\n        msg_send![self, initWithDataIgnoringOrientation:data]\n    }\n\n    unsafe fn initWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> id {\n        msg_send![self, initWithPasteboard:pasteboard]\n    }\n\n    unsafe fn initWithSize_flipped_drawingHandler_(self, size: NSSize,\n                                                   drawingHandlerShouldBeCalledWithFlippedContext: BOOL,\n                                                   drawingHandler: *mut Block<(NSRect,), BOOL>) {\n        msg_send![self, initWithSize:size\n                             flipped:drawingHandlerShouldBeCalledWithFlippedContext\n                      drawingHandler:drawingHandler]\n    }\n\n    unsafe fn initWithSize_(self, aSize: NSSize) -> id {\n        msg_send![self, initWithSize:aSize]\n    }\n\n    unsafe fn name(self) -> id /* (NSString *) */ {\n        msg_send![self, name]\n    }\n\n    unsafe fn setName_(self, name: id /* (NSString *) */) -> BOOL {\n        msg_send![self, setName:name]\n    }\n\n    unsafe fn size(self) -> NSSize {\n        msg_send![self, size]\n    }\n\n    unsafe fn template(self) -> BOOL {\n        msg_send![self, template]\n    }\n\n    unsafe fn canInitWithPasteboard_(self, pasteboard: id /* (NSPasteboard *) */) -> BOOL {\n        msg_send![self, canInitWithPasteboard:pasteboard]\n    }\n\n    unsafe fn imageTypes(self) -> id /* (NSArray<NSString *> ) */ {\n        msg_send![self, imageTypes]\n    }\n\n    unsafe fn imageUnfilteredTypes(self) -> id /* (NSArray<NSString *> ) */ {\n        msg_send![self, imageUnfilteredTypes]\n    }\n\n    unsafe fn addRepresentation_(self, imageRep: id /* (NSImageRep *) */) {\n        msg_send![self, addRepresentation:imageRep]\n    }\n\n    unsafe fn addRepresentations_(self, imageReps: id /* (NSArray<NSImageRep *> *) */) {\n        msg_send![self, addRepresentations:imageReps]\n    }\n\n    unsafe fn representations(self) -> id /* (NSArray<NSImageRep *> *) */ {\n        msg_send![self, representations]\n    }\n\n    unsafe fn removeRepresentation_(self, imageRep: id /* (NSImageRep *) */) {\n        msg_send![self, removeRepresentation:imageRep]\n    }\n\n    unsafe fn bestRepresentationForRect_context_hints_(self, rect: NSRect,\n                                                       referenceContext: id /* (NSGraphicsContext *) */,\n                                                       hints: id /* (NSDictionary<NSString *, id> *) */)\n                                                       -> id /* (NSImageRep *) */ {\n        msg_send![self, bestRepresentationForRect:rect context:referenceContext hints:hints]\n    }\n\n    unsafe fn prefersColorMatch(self) -> BOOL {\n        msg_send![self, prefersColorMatch]\n    }\n\n    unsafe fn usesEPSOnResolutionMismatch(self) -> BOOL {\n        msg_send![self, usesEPSOnResolutionMismatch]\n    }\n\n    unsafe fn matchesOnMultipleResolution(self) -> BOOL {\n        msg_send![self, matchesOnMultipleResolution]\n    }\n\n    unsafe fn drawInRect_(self, rect: NSRect) {\n        msg_send![self, drawInRect:rect]\n    }\n\n    unsafe fn drawAtPoint_fromRect_operation_fraction_(self, point: NSPoint, srcRect: NSRect,\n                                                       op: NSCompositingOperation, delta: CGFloat) {\n        msg_send![self, drawAtPoint:point fromRect:srcRect operation:op fraction:delta]\n    }\n\n    unsafe fn drawInRect_fromRect_operation_fraction_(self, dstRect: NSRect, srcRect: NSRect,\n                                                      op: NSCompositingOperation, delta: CGFloat) {\n        msg_send![self, drawInRect:dstRect fromRect:srcRect operation:op fraction:delta]\n    }\n\n    unsafe fn drawInRect_fromRect_operation_fraction_respectFlipped_hints_(self, dstSpacePortionRect: NSRect,\n        srcSpacePortionRect: NSRect, op: NSCompositingOperation, delta: CGFloat, respectContextIsFlipped: BOOL,\n        hints: id /* (NSDictionary<NSString *, id> *) */) {\n        msg_send![self, drawInRect:dstSpacePortionRect\n                          fromRect:srcSpacePortionRect\n                         operation:op\n                          fraction:delta\n                    respectFlipped:respectContextIsFlipped\n                             hints:hints]\n    }\n\n    unsafe fn drawRepresentation_inRect_(self, imageRep: id /* (NSImageRep *) */, dstRect: NSRect) {\n        msg_send![self, drawRepresentation:imageRep inRect:dstRect]\n    }\n\n    unsafe fn isValid(self) -> BOOL {\n        msg_send![self, isValid]\n    }\n\n    unsafe fn backgroundColor(self) -> id /* (NSColor *) */ {\n        msg_send![self, backgroundColor]\n    }\n\n    unsafe fn lockFocus(self) {\n        msg_send![self, lockFocus]\n    }\n\n    unsafe fn lockFocusFlipped_(self, flipped: BOOL) {\n        msg_send![self, lockFocusFlipped:flipped]\n    }\n\n    unsafe fn unlockFocus(self) {\n        msg_send![self, unlockFocus]\n    }\n\n    unsafe fn alignmentRect(self) -> NSRect {\n        msg_send![self, alignmentRect]\n    }\n\n    unsafe fn cacheMode(self) -> NSImageCacheMode {\n        msg_send![self, cacheMode]\n    }\n\n    unsafe fn recache(self) {\n        msg_send![self, recache]\n    }\n\n    unsafe fn delegate(self) -> id /* (id<NSImageDelegate *> *) */ {\n        msg_send![self, delegate]\n    }\n\n    unsafe fn TIFFRepresentation(self) -> id /* (NSData *) */ {\n        msg_send![self, TIFFRepresentation]\n    }\n\n    unsafe fn TIFFRepresentationUsingCompression_factor_(self, comp: NSTIFFCompression, aFloat: f32)\n                                                         -> id /* (NSData *) */ {\n        msg_send![self, TIFFRepresentationUsingCompression:comp factor:aFloat]\n    }\n\n    unsafe fn cancelIncrementalLoad(self) {\n        msg_send![self, cancelIncrementalLoad]\n    }\n\n    unsafe fn hitTestRect_withImageDestinationRect_context_hints_flipped_(self, testRectDestSpace: NSRect,\n        imageRectDestSpace: NSRect, referenceContext: id /* (NSGraphicsContext *) */,\n        hints: id /* (NSDictionary<NSString *, id> *) */, flipped: BOOL) -> BOOL {\n        msg_send![self, hitTestRect:testRectDestSpace\n           withImageDestinationRect:imageRectDestSpace\n                            context:referenceContext\n                              hints:hints\n                            flipped:flipped]\n    }\n\n    unsafe fn accessibilityDescription(self) -> id /* (NSString *) */ {\n        msg_send![self, accessibilityDescription]\n    }\n\n    unsafe fn layerContentsForContentsScale_(self, layerContentsScale: CGFloat) -> id /* (id) */ {\n        msg_send![self, layerContentsForContentsScale:layerContentsScale]\n    }\n\n    unsafe fn recommendedLayerContentsScale_(self, preferredContentsScale: CGFloat) -> CGFloat {\n        msg_send![self, recommendedLayerContentsScale:preferredContentsScale]\n    }\n\n    unsafe fn matchesOnlyOnBestFittingAxis(self) -> BOOL {\n        msg_send![self, matchesOnlyOnBestFittingAxis]\n    }\n}\n\n#[link(name = \"AppKit\", kind = \"framework\")]\nextern {\n    // Image hints (NSString* const)\n    pub static NSImageHintCTM: id;\n    pub static NSImageHintInterpolation: id;\n\n    // System image names (NSString const*)\n    pub static NSImageNameQuickLookTemplate: id;\n    pub static NSImageNameBluetoothTemplate: id;\n    pub static NSImageNameIChatTheaterTemplate: id;\n    pub static NSImageNameSlideshowTemplate: id;\n    pub static NSImageNameActionTemplate: id;\n    pub static NSImageNameSmartBadgeTemplate: id;\n    pub static NSImageNamePathTemplate: id;\n    pub static NSImageNameInvalidDataFreestandingTemplate: id;\n    pub static NSImageNameLockLockedTemplate: id;\n    pub static NSImageNameLockUnlockedTemplate: id;\n    pub static NSImageNameGoRightTemplate: id;\n    pub static NSImageNameGoLeftTemplate: id;\n    pub static NSImageNameRightFacingTriangleTemplate: id;\n    pub static NSImageNameLeftFacingTriangleTemplate: id;\n    pub static NSImageNameAddTemplate: id;\n    pub static NSImageNameRemoveTemplate: id;\n    pub static NSImageNameRevealFreestandingTemplate: id;\n    pub static NSImageNameFollowLinkFreestandingTemplate: id;\n    pub static NSImageNameEnterFullScreenTemplate: id;\n    pub static NSImageNameExitFullScreenTemplate: id;\n    pub static NSImageNameStopProgressTemplate: id;\n    pub static NSImageNameStopProgressFreestandingTemplate: id;\n    pub static NSImageNameRefreshTemplate: id;\n    pub static NSImageNameRefreshFreestandingTemplate: id;\n\n    pub static NSImageNameMultipleDocuments: id;\n\n    pub static NSImageNameUser: id;\n    pub static NSImageNameUserGroup: id;\n    pub static NSImageNameEveryone: id;\n    pub static NSImageNameUserGuest: id;\n\n    pub static NSImageNameBonjour: id;\n    pub static NSImageNameDotMac: id;\n    pub static NSImageNameComputer: id;\n    pub static NSImageNameFolderBurnable: id;\n    pub static NSImageNameFolderSmart: id;\n    pub static NSImageNameNetwork: id;\n\n    pub static NSImageNameUserAccounts: id;\n    pub static NSImageNamePreferencesGeneral: id;\n    pub static NSImageNameAdvanced: id;\n    pub static NSImageNameInfo: id;\n    pub static NSImageNameFontPanel: id;\n    pub static NSImageNameColorPanel: id;\n    pub static NSImageNameFolder: id;\n    pub static NSImageNameTrashEmpty: id;\n    pub static NSImageNameTrashFull: id;\n    pub static NSImageNameHomeTemplate: id;\n    pub static NSImageNameBookmarksTemplate: id;\n    pub static NSImageNameCaution: id;\n    pub static NSImageNameStatusAvailable: id;\n    pub static NSImageNameStatusPartiallyAvailable: id;\n    pub static NSImageNameStatusUnavailable: id;\n    pub static NSImageNameStatusNone: id;\n    pub static NSImageNameApplicationIcon: id;\n    pub static NSImageNameMenuOnStateTemplate: id;\n    pub static NSImageNameMenuMixedStateTemplate: id;\n    pub static NSImageNameMobileMe: id;\n\n    pub static NSImageNameIconViewTemplate: id;\n    pub static NSImageNameListViewTemplate: id;\n    pub static NSImageNameColumnViewTemplate: id;\n    pub static NSImageNameFlowViewTemplate: id;\n    pub static NSImageNameShareTemplate: id;\n}\n\n#[repr(usize)]\n#[derive(Clone, Copy, Debug, Eq, PartialEq)]\npub enum NSCompositingOperation {\n   NSCompositeClear = 0,\n   NSCompositeCopy = 1,\n   NSCompositeSourceOver = 2,\n   NSCompositeSourceIn = 3,\n   NSCompositeSourceOut = 4,\n   NSCompositeSourceAtop = 5,\n   NSCompositeDestinationOver = 6,\n   NSCompositeDestinationIn = 7,\n   NSCompositeDestinationOut = 8,\n   NSCompositeDestinationAtop = 9,\n   NSCompositeXOR = 10,\n   NSCompositePlusDarker = 11,\n   NSCompositeHighlight = 12,\n   NSCompositePlusLighter = 13\n}\n\n#[repr(usize)]\n#[derive(Clone, Copy, Debug, Eq, PartialEq)]\npub enum NSImageCacheMode {\n    NSImageCacheDefault,\n    NSImageCacheAlways,\n    NSImageCacheBySize,\n    NSImageCacheNever\n}\n\n#[repr(usize)]\n#[derive(Clone, Copy, Debug, Eq, PartialEq)]\npub enum NSTIFFCompression {\n    NSTIFFCompressionNone = 1,\n    NSTIFFCompressionCCITTFAX3 = 3,\n    NSTIFFCompressionCCITTFAX4 = 4,\n    NSTIFFCompressionLZW = 5,\n    NSTIFFCompressionJPEG = 6,\n    NSTIFFCompressionNEXT = 32766,\n    NSTIFFCompressionPackBits = 32773,\n    NSTIFFCompressionOldJPEG = 32865\n}\n\n#[repr(usize)]\n#[derive(Clone, Copy, Debug, Eq, PartialEq)]\npub enum NSImageLoadStatus {\n    NSImageLoadStatusCompleted,\n    NSImageLoadStatusCancelled,\n    NSImageLoadStatusInvalidData,\n    NSImageLoadStatusUnexpectedEOF,\n    NSImageLoadStatusReadError\n}\n\npub trait NSSound: Sized {\n    unsafe fn canInitWithPasteboard_(_: Self, pasteboard: id) -> BOOL {\n        msg_send![class(\"NSSound\"), canInitWithPasteboard:pasteboard]\n    }\n\n    unsafe fn initWithContentsOfFile_withReference_(self, filepath: id, byRef: BOOL) -> id;\n    unsafe fn initWithContentsOfURL_withReference_(self, fileUrl: id, byRef: BOOL) -> id;\n    unsafe fn initWithData_(self, audioData: id) -> id;\n    unsafe fn initWithPasteboard_(self, pasteboard: id) -> id;\n\n    unsafe fn name(self) -> id;\n    unsafe fn volume(self) -> f32;\n    unsafe fn currentTime(self) -> NSTimeInterval;\n    unsafe fn loops(self) -> BOOL;\n    unsafe fn playbackDeviceIdentifier(self) -> id;\n    unsafe fn delegate(self) -> id;\n\n    unsafe fn soundUnfilteredTypes(_: Self) -> id {\n        msg_send![class(\"NSSound\"), soundUnfilteredTypes]\n    }\n\n    unsafe fn soundNamed_(_: Self, soundName: id) -> id {\n        msg_send![class(\"NSSound\"), soundNamed:soundName]\n    }\n\n    unsafe fn duration(self) -> NSTimeInterval;\n\n    unsafe fn playing(self) -> BOOL;\n    unsafe fn pause(self) -> BOOL;\n    unsafe fn play(self) -> BOOL;\n    unsafe fn resume(self) -> BOOL;\n    unsafe fn stop(self) -> BOOL;\n\n    unsafe fn writeToPasteboard_(self, pasteboard: id);\n}\n\nimpl NSSound for id {\n    unsafe fn initWithContentsOfFile_withReference_(self, filepath: id, byRef: BOOL) -> id {\n        msg_send![self, initWithContentsOfFile:filepath withReference:byRef]\n    }\n\n    unsafe fn initWithContentsOfURL_withReference_(self, fileUrl: id, byRef: BOOL) -> id {\n        msg_send![self, initWithContentsOfURL:fileUrl withReference:byRef]\n    }\n\n    unsafe fn initWithData_(self, audioData: id) -> id {\n        msg_send![self, initWithData:audioData]\n    }\n\n    unsafe fn initWithPasteboard_(self, pasteboard: id) -> id {\n        msg_send![self, initWithPasteboard:pasteboard]\n    }\n\n    unsafe fn name(self) -> id {\n        msg_send![self, name]\n    }\n\n    unsafe fn volume(self) -> f32 {\n        msg_send![self, volume]\n    }\n\n    unsafe fn currentTime(self) -> NSTimeInterval {\n        msg_send![self, currentTime]\n    }\n\n    unsafe fn loops(self) -> BOOL {\n        msg_send![self, loops]\n    }\n\n    unsafe fn playbackDeviceIdentifier(self) -> id {\n        msg_send![self, playbackDeviceIdentifier]\n    }\n\n    unsafe fn delegate(self) -> id {\n        msg_send![self, delegate]\n    }\n\n    unsafe fn duration(self) -> NSTimeInterval {\n        msg_send![self, duration]\n    }\n\n    unsafe fn playing(self) -> BOOL {\n        msg_send![self, playing]\n    }\n\n    unsafe fn pause(self) -> BOOL {\n        msg_send![self, pause]\n    }\n\n    unsafe fn play(self) -> BOOL {\n        msg_send![self, play]\n    }\n\n    unsafe fn resume(self) -> BOOL {\n        msg_send![self, resume]\n    }\n\n    unsafe fn stop(self) -> BOOL {\n        msg_send![self, stop]\n    }\n\n    unsafe fn writeToPasteboard_(self, pasteboard: id) {\n        msg_send![self, writeToPasteboard:pasteboard]\n    }\n}\n\npub const NSVariableStatusItemLength: CGFloat = -1.0;\npub const NSSquareStatusItemLength: CGFloat = -2.0;\n\npub trait NSStatusItem: Sized {\n    unsafe fn statusBar(self) -> id /* (NSStatusBar *) */;\n    unsafe fn button(self) -> id /* (NSStatusBarButton *) */;\n    unsafe fn menu(self) -> id;\n    unsafe fn setMenu_(self, menu: id);\n    unsafe fn length(self) -> CGFloat;\n    unsafe fn setLength_(self, length: CGFloat);\n}\n\nimpl NSStatusItem for id {\n    unsafe fn statusBar(self) -> id /* (NSStatusBar *) */ {\n        msg_send![self, statusBar]\n    }\n\n    unsafe fn button(self) -> id /* (NSStatusBarButton *) */ {\n        msg_send![self, button]\n    }\n\n    unsafe fn menu(self) -> id {\n        msg_send![self, menu]\n    }\n\n    unsafe fn setMenu_(self, menu: id) {\n        msg_send![self, setMenu:menu]\n    }\n\n    unsafe fn length(self) -> CGFloat {\n        msg_send![self, length]\n    }\n\n    unsafe fn setLength_(self, length: CGFloat) {\n        msg_send![self, setLength: length]\n    }\n}\n\npub trait NSStatusBar: Sized {\n    unsafe fn systemStatusBar(_: Self) -> id {\n        msg_send![class(\"NSStatusBar\"), systemStatusBar]\n    }\n\n    unsafe fn statusItemWithLength_(self, length: CGFloat) -> id /* (NSStatusItem *) */;\n    unsafe fn removeStatusItem_(self, item: id /* (NSStatusItem *) */);\n    unsafe fn isVertical(self) -> BOOL;\n}\n\nimpl NSStatusBar for id {\n    unsafe fn statusItemWithLength_(self, length: CGFloat) -> id /* (NSStatusItem *) */ {\n        msg_send![self, statusItemWithLength:length]\n    }\n\n    unsafe fn removeStatusItem_(self, item: id /* (NSStatusItem *) */) {\n        msg_send![self, removeStatusItem:item]\n    }\n\n    unsafe fn isVertical(self) -> BOOL {\n        msg_send![self, isVertical]\n    }\n}\n\nextern {\n    pub fn NSRectFill(rect: NSRect);\n}\n\npub trait NSTextField: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSTextField\"), alloc]\n    }\n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;\n    unsafe fn setEditable_(self, editable: BOOL);\n    unsafe fn setStringValue_(self, label: id /* NSString */);\n}\n\nimpl NSTextField for id {\n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {\n        msg_send![self, initWithFrame:frameRect]\n    }\n    unsafe fn setEditable_(self, editable: BOOL) {\n        msg_send![self, setEditable:editable];\n    }\n    unsafe fn setStringValue_(self, label: id) {\n        msg_send![self, setStringValue:label];\n    }\n}\n\n#[repr(u64)]\npub enum NSTabViewType {\n    NSTopTabsBezelBorder     = 0,\n    NSLeftTabsBezelBorder    = 1,\n    NSBottomTabsBezelBorder  = 2,\n    NSRightTabsBezelBorder   = 3,\n    NSNoTabsBezelBorder      = 4,\n    NSNoTabsLineBorder       = 5,\n    NSNoTabsNoBorder         = 6\n}\n\npub trait NSTabView: Sized {\n    unsafe fn new(_: Self) -> id  {\n        msg_send![class(\"NSTabView\"), new]\n    }\n    \n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;\n    unsafe fn addTabViewItem_(self, tabViewItem: id);\n    unsafe fn insertTabViewItem_atIndex_(self,tabViewItem:id, index:NSInteger);\n    unsafe fn removeTabViewItem_(self,tabViewItem:id);\n    unsafe fn indexOfTabViewItem_(self, tabViewItem:id) -> id;\n    unsafe fn indexOfTabViewItemWithIdentifier_(self,identifier:id) -> id;\n    unsafe fn numberOfTabViewItems(self) -> id;\n    unsafe fn tabViewItemAtIndex_(self,index:id) -> id;\n    unsafe fn tabViewItems(self) -> id;\n    unsafe fn selectFirstTabViewItem_(self,sender:id);\n    unsafe fn selectLastTabViewItem_(self,sender:id);\n    unsafe fn selectNextTabViewItem_(self, sender:id);\n    unsafe fn selectPreviousTabViewItem_(self,sender:id);\n    unsafe fn selectTabViewItem_(self,tabViewItem:id);\n    unsafe fn selectTabViewItemAtIndex_(self,index:id);\n    unsafe fn selectTabViewItemWithIdentifier_(self,identifier:id);\n    unsafe fn selectedTabViewItem(self) -> id;\n    unsafe fn takeSelectedTabViewItemFromSender_(self,sender:id);\n    unsafe fn font(self) -> id;\n    unsafe fn setFont_(self, font:id);\n    unsafe fn tabViewType(self) -> NSTabViewType;\n    unsafe fn setTabViewType_(self,tabViewType: NSTabViewType);\n    unsafe fn controlTint(self) -> id;\n    unsafe fn setControlTint_(self,controlTint:id);\n    unsafe fn drawsBackground(self) -> BOOL;\n    unsafe fn setDrawsBackground_(self,drawsBackground:BOOL);\n    unsafe fn minimumSize(self) -> id;\n    unsafe fn contentRect(self) -> id;\n    unsafe fn controlSize(self) -> id;\n    unsafe fn setControlSize_(self,controlSize:id);\n    unsafe fn allowsTruncatedLabels(self) -> BOOL;\n    unsafe fn setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL);\n    unsafe fn setDelegate_(self, delegate:id);\n    unsafe fn delegate(self) -> id ;\n    unsafe fn tabViewAtPoint_(self, point:id) -> id;\n}\n\nimpl NSTabView for id {\n    unsafe fn initWithFrame_(self, frameRect: NSRect) -> id {\n        msg_send![self, initWithFrame:frameRect]\n    }\n\n    unsafe fn addTabViewItem_(self, tabViewItem: id) {\n        msg_send![self, addTabViewItem:tabViewItem]\n    }\n    unsafe fn insertTabViewItem_atIndex_(self, tabViewItem: id,index:NSInteger) {\n        msg_send![self, addTabViewItem:tabViewItem atIndex:index]\n    }\n    unsafe fn removeTabViewItem_(self,tabViewItem:id){\n        msg_send![self, removeTabViewItem:tabViewItem]\n    }\n\n    unsafe fn indexOfTabViewItem_(self, tabViewItem:id) -> id{\n        msg_send![self, indexOfTabViewItem:tabViewItem]\n    }\n\n    unsafe fn indexOfTabViewItemWithIdentifier_(self,identifier:id) -> id{\n        msg_send![self, indexOfTabViewItemWithIdentifier:identifier]\n    }\n    unsafe fn numberOfTabViewItems(self) -> id{\n        msg_send![self, numberOfTabViewItems]\n    }\n\n    unsafe fn tabViewItemAtIndex_(self,index:id)->id{\n        msg_send![self, tabViewItemAtIndex:index]\n    }\n\n    unsafe fn tabViewItems(self)->id{\n        msg_send![self, tabViewItems]\n    }\n\n    unsafe fn selectFirstTabViewItem_(self,sender:id){\n        msg_send![self, selectFirstTabViewItem:sender]\n    }\n\n    unsafe fn selectLastTabViewItem_(self,sender:id){\n        msg_send![self, selectLastTabViewItem:sender]\n    }\n    unsafe fn selectNextTabViewItem_(self, sender:id){\n        msg_send![self, selectNextTabViewItem:sender]\n    }\n    unsafe fn selectPreviousTabViewItem_(self,sender:id){\n        msg_send![self, selectPreviousTabViewItem:sender]\n    }\n\n    unsafe fn selectTabViewItem_(self,tabViewItem:id){\n        msg_send![self, selectTabViewItem:tabViewItem]\n    }\n\n    unsafe fn selectTabViewItemAtIndex_(self,index:id){\n        msg_send![self, selectTabViewItemAtIndex:index]\n    }\n    unsafe fn selectTabViewItemWithIdentifier_(self,identifier:id){\n        msg_send![self, selectTabViewItemWithIdentifier:identifier]\n    }\n    unsafe fn selectedTabViewItem(self) -> id{\n        msg_send![self, selectedTabViewItem]\n    }\n    unsafe fn takeSelectedTabViewItemFromSender_(self,sender:id){\n        msg_send![self, takeSelectedTabViewItemFromSender:sender]\n    }\n\n    unsafe fn font(self)->id{\n        msg_send![self, font]\n    }\n\n    unsafe fn setFont_(self, font:id){\n        msg_send![self, setFont:font]\n    }\n\n    unsafe fn tabViewType(self)->NSTabViewType{\n        msg_send![self, tabViewType]\n    }\n    unsafe fn setTabViewType_(self,tabViewType: NSTabViewType){\n        msg_send![self, setTabViewType:tabViewType]\n    }\n\n    unsafe fn controlTint(self) -> id{\n        msg_send![self, controlTint]\n    }\n    unsafe fn setControlTint_(self,controlTint:id){\n        msg_send![self, setControlTint:controlTint]\n    }\n\n    unsafe fn drawsBackground(self) -> BOOL{\n        msg_send![self, drawsBackground]\n    }\n    unsafe fn setDrawsBackground_(self,drawsBackground:BOOL){\n        msg_send![self, setDrawsBackground:drawsBackground as libc::c_int]\n    }\n\n    unsafe fn minimumSize(self) -> id{\n        msg_send![self, minimumSize]\n    }\n    unsafe fn contentRect(self) -> id{\n        msg_send![self, contentRect]\n    }\n    unsafe fn controlSize(self) -> id{\n        msg_send![self, controlSize]\n    }\n    unsafe fn setControlSize_(self,controlSize:id){\n        msg_send![self, setControlSize:controlSize]\n    }\n\n    unsafe fn allowsTruncatedLabels(self) -> BOOL{\n        msg_send![self, allowsTruncatedLabels]\n    }\n    unsafe fn setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL){\n        msg_send![self, setAllowsTruncatedLabels:allowTruncatedLabels as libc::c_int]\n    }\n\n    unsafe fn setDelegate_(self, delegate:id){\n        msg_send![self, setDelegate:delegate]\n    }\n    unsafe fn delegate(self) -> id {\n        msg_send![self, delegate]\n    }\n\n    unsafe fn tabViewAtPoint_(self, point:id) -> id{\n        msg_send![self, tabViewAtPoint:point]\n    }\n}\n\n#[repr(u64)]\npub enum NSTabState {\n    NSSelectedTab = 0,\n    NSBackgroundTab = 1,\n    NSPressedTab = 2\n}\n\npub trait NSTabViewItem: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSTabViewItem\"), alloc]\n    }\n    unsafe fn new(_: Self) -> id {\n        msg_send![class(\"NSTabViewItem\"), new]\n    }\n\n    unsafe fn initWithIdentifier_(self, identifier:id) -> id;\n    unsafe fn drawLabel_inRect_(self,shouldTruncateLabel:BOOL,labelRect:NSRect);\n    unsafe fn label(self) -> id;\n    unsafe fn setLabel_(self,label:id);\n    unsafe fn sizeOfLabel_(self, computeMin:BOOL);\n    unsafe fn tabState(self) -> NSTabState;\n    unsafe fn identifier(self)-> id;\n    unsafe fn setIdentifier_(self,identifier:id);\n    unsafe fn color(self)-> id;\n    unsafe fn setColor_(self,color:id);\n    unsafe fn view(self) -> id;\n    unsafe fn setView_(self, view:id);\n    unsafe fn initialFirstResponder(self)->id;\n    unsafe fn setInitialFirstResponder_(self,initialFirstResponder:id);\n    unsafe fn tabView(self) -> id;\n    unsafe fn tooltip(self) -> id;\n    unsafe fn setTooltip_(self,toolTip:id);\n}\n\nimpl NSTabViewItem for id {\n    unsafe fn initWithIdentifier_(self, identifier: id) -> id {\n        msg_send![self, initWithIdentifier:identifier]\n    }\n\n    unsafe fn drawLabel_inRect_(self, shouldTruncateLabel:BOOL,labelRect:NSRect){\n        msg_send![self, drawLabel:shouldTruncateLabel as libc::c_int inRect:labelRect]\n    }\n\n    unsafe fn label(self)->id{\n        msg_send![self, label]\n    }\n    unsafe fn setLabel_(self,label : id){\n        msg_send![self, setLabel:label]\n    }\n\n    unsafe fn sizeOfLabel_(self,computeMin:BOOL){\n        msg_send![self, sizeOfLabel:computeMin as libc::c_int]\n    }\n\n    unsafe fn tabState(self) -> NSTabState{\n        msg_send![self, tabState]\n    }\n\n    unsafe fn identifier(self)-> id {\n        msg_send![self, identifier]\n    }\n\n    unsafe fn setIdentifier_(self,identifier:id){\n        msg_send![self, identifier:identifier]\n    }\n\n    unsafe fn color(self)-> id{\n        msg_send![self, color]\n    }\n\n    unsafe fn setColor_(self,color:id){\n        msg_send![self, color:color]\n    }\n\n    unsafe fn view(self) -> id {\n        msg_send![self, view]\n    }\n\n    unsafe fn setView_(self, view:id){\n        msg_send![self, setView:view]\n    }\n\n    unsafe fn initialFirstResponder(self)->id{\n        msg_send![self, initialFirstResponder]\n    }\n\n    unsafe fn setInitialFirstResponder_(self,initialFirstResponder:id){\n        msg_send![self, setInitialFirstResponder:initialFirstResponder]\n    }\n\n    unsafe fn tabView(self) -> id{\n        msg_send![self, tabView]\n    }\n\n    unsafe fn tooltip(self) -> id{\n        msg_send![self, tooltip]\n    }\n\n    unsafe fn setTooltip_(self,toolTip:id){\n        msg_send![self, setTooltip:toolTip]\n    }\n}\n\npub trait NSLayoutConstraint: Sized {\n    unsafe fn activateConstraints(_: Self, constraints: id) -> id;\n}\n\nimpl NSLayoutConstraint for id {\n    unsafe fn activateConstraints(_: Self, constraints: id) -> id {\n        msg_send![class(\"NSLayoutConstraint\"), activateConstraints:constraints]\n    }\n}\n\npub trait NSLayoutDimension: Sized {\n    unsafe fn constraintEqualToConstant(self, c: CGFloat) -> id;\n    unsafe fn constraintLessThanOrEqualToConstant(self, c: CGFloat) -> id;\n    unsafe fn constraintGreaterThanOrEqualToConstant(self, c: CGFloat) -> id;\n}\n\nimpl NSLayoutDimension for id {\n    unsafe fn constraintEqualToConstant(self, c: CGFloat) -> id {\n        msg_send![self, constraintEqualToConstant:c]\n    }\n\n    unsafe fn constraintLessThanOrEqualToConstant(self, c: CGFloat) -> id {\n        msg_send![self, constraintLessThanOrEqualToConstant:c]\n    }\n\n    unsafe fn constraintGreaterThanOrEqualToConstant(self, c: CGFloat) -> id {\n        msg_send![self, constraintGreaterThanOrEqualToConstant:c]\n    }\n }\n\npub trait NSColor: Sized {\n    unsafe fn clearColor(_: Self) -> id;\n}\n\nimpl NSColor for id {\n    unsafe fn clearColor(_: Self) -> id {\n        msg_send![class(\"NSColor\"), clearColor]\n    }\n}\n\n#[cfg(test)]\nmod test {\n    use super::*;\n\n    #[test]\n    pub fn test_nsapp() {\n        unsafe {\n            let _nsApp = NSApp();\n        }\n    }\n}\n"
  },
  {
    "path": "src/base.rs",
    "content": "// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\nuse objc::runtime;\nuse std::mem;\n\npub use objc::runtime::{BOOL, NO, YES};\n\npub type Class = *mut runtime::Class;\n#[allow(non_camel_case_types)]\npub type id = *mut runtime::Object;\npub type SEL = runtime::Sel;\n\n#[allow(non_upper_case_globals)]\npub const nil: id = 0 as id;\n#[allow(non_upper_case_globals)]\npub const Nil: Class = 0 as Class;\n\n/// A convenience method to convert the name of a class to the class object itself.\n#[inline]\npub fn class(name: &str) -> Class {\n    unsafe {\n        mem::transmute(runtime::Class::get(name))\n    }\n}\n\n/// A convenience method to convert the name of a selector to the selector object.\n#[inline]\npub fn selector(name: &str) -> SEL {\n    runtime::Sel::register(name)\n}\n"
  },
  {
    "path": "src/foundation.rs",
    "content": "// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\n#![allow(non_upper_case_globals)]\n\nuse std::ptr;\nuse base::{id, class, BOOL, NO, SEL, nil};\nuse block::Block;\nuse libc;\n\n\n#[cfg(target_pointer_width = \"32\")]\npub type NSInteger = libc::c_int;\n#[cfg(target_pointer_width = \"32\")]\npub type NSUInteger = libc::c_uint;\n\n#[cfg(target_pointer_width = \"64\")]\npub type NSInteger = libc::c_long;\n#[cfg(target_pointer_width = \"64\")]\npub type NSUInteger = libc::c_ulong;\n\nconst UTF8_ENCODING: usize = 4;\n\n#[cfg(target_os = \"macos\")]\nmod macos {\n    use std::mem;\n    use base::{id, class};\n    use core_graphics::base::CGFloat;\n    use core_graphics::geometry::CGRect;\n    use objc;\n\n    #[repr(C)]\n    #[derive(Copy, Clone)]\n    pub struct NSPoint {\n        pub x: f64,\n        pub y: f64,\n    }\n\n    impl NSPoint {\n        #[inline]\n        pub fn new(x: f64, y: f64) -> NSPoint {\n            NSPoint {\n                x: x,\n                y: y,\n            }\n        }\n    }\n\n    unsafe impl objc::Encode for NSPoint {\n        fn encode() -> objc::Encoding {\n            let encoding = format!(\"{{CGPoint={}{}}}\",\n                                   f64::encode().as_str(),\n                                   f64::encode().as_str());\n            unsafe { objc::Encoding::from_str(&encoding) }\n        }\n    }\n\n    #[repr(C)]\n    #[derive(Copy, Clone)]\n    pub struct NSSize {\n        pub width: f64,\n        pub height: f64,\n    }\n\n    impl NSSize {\n        #[inline]\n        pub fn new(width: f64, height: f64) -> NSSize {\n            NSSize {\n                width: width,\n                height: height,\n            }\n        }\n    }\n\n    unsafe impl objc::Encode for NSSize {\n        fn encode() -> objc::Encoding {\n            let encoding = format!(\"{{CGSize={}{}}}\",\n                                   f64::encode().as_str(),\n                                   f64::encode().as_str());\n            unsafe { objc::Encoding::from_str(&encoding) }\n        }\n    }\n\n    #[repr(C)]\n    #[derive(Copy, Clone)]\n    pub struct NSRect {\n        pub origin: NSPoint,\n        pub size: NSSize,\n    }\n\n    impl NSRect {\n        #[inline]\n        pub fn new(origin: NSPoint, size: NSSize) -> NSRect {\n            NSRect {\n                origin: origin,\n                size: size\n            }\n        }\n\n        #[inline]\n        pub fn as_CGRect(&self) -> &CGRect {\n            unsafe {\n                mem::transmute::<&NSRect, &CGRect>(self)\n            }\n        }\n\n        #[inline]\n        pub fn inset(&self, x: CGFloat, y: CGFloat) -> NSRect {\n            unsafe {\n                NSInsetRect(*self, x, y)\n            }\n        }\n    }\n\n    unsafe impl objc::Encode for NSRect {\n        fn encode() -> objc::Encoding {\n            let encoding = format!(\"{{CGRect={}{}}}\",\n                                   NSPoint::encode().as_str(),\n                                   NSSize::encode().as_str());\n            unsafe { objc::Encoding::from_str(&encoding) }\n        }\n    }\n\n    // Same as CGRectEdge\n    #[repr(u32)]\n    pub enum NSRectEdge {\n        NSRectMinXEdge,\n        NSRectMinYEdge,\n        NSRectMaxXEdge,\n        NSRectMaxYEdge,\n    }\n\n    #[link(name = \"Foundation\", kind = \"framework\")]\n    extern {\n        fn NSInsetRect(rect: NSRect, x: CGFloat, y: CGFloat) -> NSRect;\n    }\n\n    pub trait NSValue: Sized {\n        unsafe fn valueWithPoint(_: Self, point: NSPoint) -> id {\n            msg_send![class(\"NSValue\"), valueWithPoint:point]\n        }\n\n        unsafe fn valueWithSize(_: Self, size: NSSize) -> id {\n            msg_send![class(\"NSValue\"), valueWithSize:size]\n        }\n    }\n\n    impl NSValue for id {\n    }\n}\n\n#[cfg(target_os = \"macos\")]\npub use self::macos::*;\n\n#[repr(C)]\npub struct NSRange {\n    pub location: NSUInteger,\n    pub length: NSUInteger,\n}\n\nimpl NSRange {\n    #[inline]\n    pub fn new(location: NSUInteger, length: NSUInteger) -> NSRange {\n        NSRange {\n            location: location,\n            length: length\n        }\n    }\n}\n\n#[link(name = \"Foundation\", kind = \"framework\")]\nextern {\n    pub static NSDefaultRunLoopMode: id;\n}\n\npub trait NSAutoreleasePool: Sized {\n    unsafe fn new(_: Self) -> id {\n        msg_send![class(\"NSAutoreleasePool\"), new]\n    }\n\n    unsafe fn autorelease(self) -> Self;\n    unsafe fn drain(self);\n}\n\nimpl NSAutoreleasePool for id {\n    unsafe fn autorelease(self) -> id {\n        msg_send![self, autorelease]\n    }\n\n    unsafe fn drain(self) {\n        msg_send![self, drain]\n    }\n}\n\npub trait NSProcessInfo: Sized {\n    unsafe fn processInfo(_: Self) -> id {\n        msg_send![class(\"NSProcessInfo\"), processInfo]\n    }\n\n    unsafe fn processName(self) -> id;\n}\n\nimpl NSProcessInfo for id {\n    unsafe fn processName(self) -> id {\n        msg_send![self, processName]\n    }\n}\n\npub type NSTimeInterval = libc::c_double;\n\npub trait NSArray: Sized {\n    unsafe fn array(_: Self) -> id {\n        msg_send![class(\"NSArray\"), array]\n    }\n\n    unsafe fn arrayWithObjects(_: Self, objects: &[id]) -> id {\n        msg_send![class(\"NSArray\"), arrayWithObjects:objects.as_ptr()\n                                    count:objects.len()]\n    }\n\n    unsafe fn arrayWithObject(_: Self, object: id) -> id {\n        msg_send![class(\"NSArray\"), arrayWithObject:object]\n    }\n\n    unsafe fn arrayByAddingObjectFromArray(self, object: id) -> id;\n    unsafe fn arrayByAddingObjectsFromArray(self, objects: id) -> id;\n}\n\nimpl NSArray for id {\n    unsafe fn arrayByAddingObjectFromArray(self, object: id) -> id {\n        msg_send![self, arrayByAddingObjectFromArray:object]\n    }\n\n    unsafe fn arrayByAddingObjectsFromArray(self, objects: id) -> id {\n        msg_send![self, arrayByAddingObjectsFromArray:objects]\n    }\n}\n\npub trait NSDictionary: Sized {\n    unsafe fn dictionary(_: Self) -> id {\n        msg_send![class(\"NSDictionary\"), dictionary]\n    }\n\n    unsafe fn dictionaryWithContentsOfFile_(_: Self, path: id) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithContentsOfFile:path]\n    }\n\n    unsafe fn dictionaryWithContentsOfURL_(_: Self, aURL: id) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithContentsOfURL:aURL]\n    }\n\n    unsafe fn dictionaryWithDictionary_(_: Self, otherDictionary: id) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithDictionary:otherDictionary]\n    }\n\n    unsafe fn dictionaryWithObject_forKey_(_: Self, anObject: id, aKey: id) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithObject:anObject forKey:aKey]\n    }\n\n    unsafe fn dictionaryWithObjects_forKeys_(_: Self, objects: id, keys: id) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithObjects:objects forKeys:keys]\n    }\n\n    unsafe fn dictionaryWithObjects_forKeys_count_(_: Self, objects: *const id, keys: *const id, count: NSUInteger) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithObjects:objects forKeys:keys count:count]\n    }\n\n    unsafe fn dictionaryWithObjectsAndKeys_(_: Self, firstObject: id) -> id {\n        msg_send![class(\"NSDictionary\"), dictionaryWithObjectsAndKeys:firstObject]\n    }\n\n    unsafe fn init(self) -> id;\n    unsafe fn initWithContentsOfFile_(self, path: id) -> id;\n    unsafe fn initWithContentsOfURL_(self, aURL: id) -> id;\n    unsafe fn initWithDictionary_(self, otherDicitonary: id) -> id;\n    unsafe fn initWithDictionary_copyItems_(self, otherDicitonary: id, flag: BOOL) -> id;\n    unsafe fn initWithObjects_forKeys_(self, objects: id, keys: id) -> id;\n    unsafe fn initWithObjects_forKeys_count_(self, objects: id, keys: id, count: NSUInteger) -> id;\n    unsafe fn initWithObjectsAndKeys_(self, firstObject: id) -> id;\n\n    unsafe fn sharedKeySetForKeys_(_: Self, keys: id) -> id {\n        msg_send![class(\"NSDictionary\"), sharedKeySetForKeys:keys]\n    }\n\n    unsafe fn count(self) -> NSUInteger;\n\n    unsafe fn isEqualToDictionary_(self, otherDictionary: id) -> BOOL;\n\n    unsafe fn allKeys(self) -> id;\n    unsafe fn allKeysForObject_(self, anObject: id) -> id;\n    unsafe fn allValues(self) -> id;\n    unsafe fn objectForKey_(self, aKey: id) -> id;\n    unsafe fn objectForKeyedSubscript_(self, key: id) -> id;\n    unsafe fn objectsForKeys_notFoundMarker_(self, keys: id, anObject: id) -> id;\n    unsafe fn valueForKey_(self, key: id) -> id;\n\n    unsafe fn keyEnumerator(self) -> id;\n    unsafe fn objectEnumerator(self) -> id;\n    unsafe fn enumerateKeysAndObjectsUsingBlock_(self, block: *mut Block<(id, id, *mut BOOL), ()>);\n    unsafe fn enumerateKeysAndObjectsWithOptions_usingBlock_(self, opts: NSEnumerationOptions,\n                                                             block: *mut Block<(id, id, *mut BOOL), ()>);\n\n    unsafe fn keysSortedByValueUsingSelector_(self, comparator: SEL) -> id;\n    unsafe fn keysSortedByValueUsingComparator_(self, cmptr: NSComparator) -> id;\n    unsafe fn keysSortedByValueWithOptions_usingComparator_(self, opts: NSEnumerationOptions, cmptr: NSComparator) -> id;\n\n    unsafe fn keysOfEntriesPassingTest_(self, predicate: *mut Block<(id, id, *mut BOOL), BOOL>) -> id;\n    unsafe fn keysOfEntriesWithOptions_PassingTest_(self, opts: NSEnumerationOptions,\n                                                    predicate: *mut Block<(id, id, *mut BOOL), BOOL>) -> id;\n\n    unsafe fn writeToFile_atomically_(self, path: id, flag: BOOL) -> BOOL;\n    unsafe fn writeToURL_atomically_(self, aURL: id, flag: BOOL) -> BOOL;\n\n    unsafe fn fileCreationDate(self) -> id;\n    unsafe fn fileExtensionHidden(self) -> BOOL;\n    unsafe fn fileGroupOwnerAccountID(self) -> id;\n    unsafe fn fileGroupOwnerAccountName(self) -> id;\n    unsafe fn fileIsAppendOnly(self) -> BOOL;\n    unsafe fn fileIsImmutable(self) -> BOOL;\n    unsafe fn fileModificationDate(self) -> id;\n    unsafe fn fileOwnerAccountID(self) -> id;\n    unsafe fn fileOwnerAccountName(self) -> id;\n    unsafe fn filePosixPermissions(self) -> NSUInteger;\n    unsafe fn fileSize(self) -> libc::c_ulonglong;\n    unsafe fn fileSystemFileNumber(self) -> NSUInteger;\n    unsafe fn fileSystemNumber(self) -> NSInteger;\n    unsafe fn fileType(self) -> id;\n\n    unsafe fn description(self) -> id;\n    unsafe fn descriptionInStringsFileFormat(self) -> id;\n    unsafe fn descriptionWithLocale_(self, locale: id) -> id;\n    unsafe fn descriptionWithLocale_indent_(self, locale: id, indent: NSUInteger) -> id;\n}\n\nimpl NSDictionary for id {\n    unsafe fn init(self) -> id {\n        msg_send![self, init]\n    }\n\n    unsafe fn initWithContentsOfFile_(self, path: id) -> id {\n        msg_send![self, initWithContentsOfFile:path]\n    }\n\n    unsafe fn initWithContentsOfURL_(self, aURL: id) -> id {\n        msg_send![self, initWithContentsOfURL:aURL]\n    }\n\n    unsafe fn initWithDictionary_(self, otherDictionary: id) -> id {\n        msg_send![self, initWithDictionary:otherDictionary]\n    }\n\n    unsafe fn initWithDictionary_copyItems_(self, otherDictionary: id, flag: BOOL) -> id {\n        msg_send![self, initWithDictionary:otherDictionary copyItems:flag]\n    }\n\n    unsafe fn initWithObjects_forKeys_(self, objects: id, keys: id) -> id {\n        msg_send![self, initWithObjects:objects forKeys:keys]\n    }\n\n    unsafe fn initWithObjects_forKeys_count_(self, objects: id, keys: id, count: NSUInteger) -> id {\n        msg_send![self, initWithObjects:objects forKeys:keys count:count]\n    }\n\n    unsafe fn initWithObjectsAndKeys_(self, firstObject: id) -> id {\n        msg_send![self, initWithObjectsAndKeys:firstObject]\n    }\n\n    unsafe fn count(self) -> NSUInteger {\n        msg_send![self, count]\n    }\n\n    unsafe fn isEqualToDictionary_(self, otherDictionary: id) -> BOOL {\n        msg_send![self, isEqualToDictionary:otherDictionary]\n    }\n\n    unsafe fn allKeys(self) -> id {\n        msg_send![self, allKeys]\n    }\n\n    unsafe fn allKeysForObject_(self, anObject: id) -> id {\n        msg_send![self, allKeysForObject:anObject]\n    }\n\n    unsafe fn allValues(self) -> id {\n        msg_send![self, allValues]\n    }\n\n    unsafe fn objectForKey_(self, aKey: id) -> id {\n        msg_send![self, objectForKey:aKey]\n    }\n\n    unsafe fn objectForKeyedSubscript_(self, key: id) -> id {\n        msg_send![self, objectForKeyedSubscript:key]\n    }\n\n    unsafe fn objectsForKeys_notFoundMarker_(self, keys: id, anObject: id) -> id {\n        msg_send![self, objectsForKeys:keys notFoundMarker:anObject]\n    }\n\n    unsafe fn valueForKey_(self, key: id) -> id {\n        msg_send![self, valueForKey:key]\n    }\n\n    unsafe fn keyEnumerator(self) -> id {\n        msg_send![self, keyEnumerator]\n    }\n\n    unsafe fn objectEnumerator(self) -> id {\n        msg_send![self, objectEnumerator]\n    }\n\n    unsafe fn enumerateKeysAndObjectsUsingBlock_(self, block: *mut Block<(id, id, *mut BOOL), ()>) {\n        msg_send![self, enumerateKeysAndObjectsUsingBlock:block]\n    }\n\n    unsafe fn enumerateKeysAndObjectsWithOptions_usingBlock_(self, opts: NSEnumerationOptions,\n                                                     block: *mut Block<(id, id, *mut BOOL), ()>) {\n        msg_send![self, enumerateKeysAndObjectsWithOptions:opts usingBlock:block]\n    }\n\n    unsafe fn keysSortedByValueUsingSelector_(self, comparator: SEL) -> id {\n        msg_send![self, keysSortedByValueUsingSelector:comparator]\n    }\n\n    unsafe fn keysSortedByValueUsingComparator_(self, cmptr: NSComparator) -> id {\n        msg_send![self, keysSortedByValueUsingComparator:cmptr]\n    }\n\n    unsafe fn keysSortedByValueWithOptions_usingComparator_(self, opts: NSEnumerationOptions, cmptr: NSComparator) -> id {\n        let rv: id = msg_send![self, keysSortedByValueWithOptions:opts usingComparator:cmptr];\n        rv\n    }\n\n    unsafe fn keysOfEntriesPassingTest_(self, predicate: *mut Block<(id, id, *mut BOOL), BOOL>) -> id {\n        msg_send![self, keysOfEntriesPassingTest:predicate]\n    }\n\n    unsafe fn keysOfEntriesWithOptions_PassingTest_(self, opts: NSEnumerationOptions,\n                                                    predicate: *mut Block<(id, id, *mut BOOL), BOOL>) -> id {\n        msg_send![self, keysOfEntriesWithOptions:opts PassingTest:predicate]\n    }\n\n    unsafe fn writeToFile_atomically_(self, path: id, flag: BOOL) -> BOOL {\n        msg_send![self, writeToFile:path atomically:flag]\n    }\n\n    unsafe fn writeToURL_atomically_(self, aURL: id, flag: BOOL) -> BOOL {\n        msg_send![self, writeToURL:aURL atomically:flag]\n    }\n\n    unsafe fn fileCreationDate(self) -> id {\n        msg_send![self, fileCreationDate]\n    }\n\n    unsafe fn fileExtensionHidden(self) -> BOOL {\n        msg_send![self, fileExtensionHidden]\n    }\n\n    unsafe fn fileGroupOwnerAccountID(self) -> id {\n        msg_send![self, fileGroupOwnerAccountID]\n    }\n\n    unsafe fn fileGroupOwnerAccountName(self) -> id {\n        msg_send![self, fileGroupOwnerAccountName]\n    }\n\n    unsafe fn fileIsAppendOnly(self) -> BOOL {\n        msg_send![self, fileIsAppendOnly]\n    }\n\n    unsafe fn fileIsImmutable(self) -> BOOL {\n        msg_send![self, fileIsImmutable]\n    }\n\n    unsafe fn fileModificationDate(self) -> id {\n        msg_send![self, fileModificationDate]\n    }\n\n    unsafe fn fileOwnerAccountID(self) -> id {\n        msg_send![self, fileOwnerAccountID]\n    }\n\n    unsafe fn fileOwnerAccountName(self) -> id {\n        msg_send![self, fileOwnerAccountName]\n    }\n\n    unsafe fn filePosixPermissions(self) -> NSUInteger {\n        msg_send![self, filePosixPermissions]\n    }\n\n    unsafe fn fileSize(self) -> libc::c_ulonglong {\n        msg_send![self, fileSize]\n    }\n\n    unsafe fn fileSystemFileNumber(self) -> NSUInteger {\n        msg_send![self, fileSystemFileNumber]\n    }\n\n    unsafe fn fileSystemNumber(self) -> NSInteger {\n        msg_send![self, fileSystemNumber]\n    }\n\n    unsafe fn fileType(self) -> id {\n        msg_send![self, fileType]\n    }\n\n    unsafe fn description(self) -> id {\n        msg_send![self, description]\n    }\n\n    unsafe fn descriptionInStringsFileFormat(self) -> id {\n        msg_send![self, descriptionInStringsFileFormat]\n    }\n\n    unsafe fn descriptionWithLocale_(self, locale: id) -> id {\n        msg_send![self, descriptionWithLocale:locale]\n    }\n\n    unsafe fn descriptionWithLocale_indent_(self, locale: id, indent: NSUInteger) -> id {\n        msg_send![self, descriptionWithLocale:locale indent:indent]\n    }\n}\n\nbitflags! {\n    pub struct NSEnumerationOptions: libc::c_ulonglong {\n        const NSEnumerationConcurrent = 1 << 0;\n        const NSEnumerationReverse = 1 << 1;\n    }\n}\n\npub type NSComparator = *mut Block<(id, id), NSComparisonResult>;\n\n#[repr(isize)]\n#[derive(Clone, Copy, Debug, Eq, PartialEq)]\npub enum NSComparisonResult {\n    NSOrderedAscending = -1,\n    NSOrderedSame = 0,\n    NSOrderedDescending = 1\n}\n\npub trait NSString: Sized {\n    unsafe fn alloc(_: Self) -> id {\n        msg_send![class(\"NSString\"), alloc]\n    }\n\n    unsafe fn stringByAppendingString_(self, other: id) -> id;\n    unsafe fn init_str(self, string: &str) -> Self;\n    unsafe fn UTF8String(self) -> *const libc::c_char;\n    unsafe fn len(self) -> usize;\n    unsafe fn isEqualToString(self, &str) -> bool;\n}\n\nimpl NSString for id {\n    unsafe fn isEqualToString(self, other: &str) -> bool {\n        let other = NSString::alloc(nil).init_str(other);\n        let rv: BOOL = msg_send![self, isEqualToString:other];\n        rv != NO\n    }\n\n    unsafe fn stringByAppendingString_(self, other: id) -> id {\n        msg_send![self, stringByAppendingString:other]\n    }\n\n    unsafe fn init_str(self, string: &str) -> id {\n        return msg_send![self,\n                         initWithBytes:string.as_ptr()\n                             length:string.len()\n                             encoding:UTF8_ENCODING as id];\n    }\n\n    unsafe fn len(self) -> usize {\n        msg_send![self, lengthOfBytesUsingEncoding:UTF8_ENCODING]\n    }\n\n    unsafe fn UTF8String(self) -> *const libc::c_char {\n        msg_send![self, UTF8String]\n    }\n}\n\npub trait NSDate: Sized {\n    unsafe fn distantPast(_: Self) -> id {\n        msg_send![class(\"NSDate\"), distantPast]\n    }\n\n    unsafe fn distantFuture(_: Self) -> id {\n        msg_send![class(\"NSDate\"), distantFuture]\n    }\n}\n\nimpl NSDate for id {\n\n}\n\n#[repr(C)]\nstruct NSFastEnumerationState {\n    pub state: libc::c_ulong,\n    pub items_ptr: *mut id,\n    pub mutations_ptr: *mut libc::c_ulong,\n    pub extra: [libc::c_ulong; 5]\n}\n\nconst NS_FAST_ENUM_BUF_SIZE: usize = 16;\n\npub struct NSFastIterator {\n    state: NSFastEnumerationState,\n    buffer: [id; NS_FAST_ENUM_BUF_SIZE],\n    mut_val: Option<libc::c_ulong>,\n    len: usize,\n    idx: usize,\n    object: id\n}\n\nimpl Iterator for NSFastIterator {\n    type Item = id;\n\n    fn next(&mut self) -> Option<id> {\n        if self.idx >= self.len {\n            self.len = unsafe {\n                msg_send![self.object, countByEnumeratingWithState:&mut self.state objects:self.buffer.as_mut_ptr() count:NS_FAST_ENUM_BUF_SIZE]\n            };\n            self.idx = 0;\n        }\n\n        let new_mut = unsafe {\n            *self.state.mutations_ptr\n        };\n\n        if let Some(old_mut) = self.mut_val {\n            assert!(old_mut == new_mut, \"The collection was mutated while being enumerated\");\n        }\n\n        if self.idx < self.len {\n            let object = unsafe {\n                *self.state.items_ptr.offset(self.idx as isize)\n            };\n            self.mut_val = Some(new_mut);\n            self.idx += 1;\n            Some(object)\n        } else {\n            None\n        }\n    }\n}\n\npub trait NSFastEnumeration: Sized {\n    unsafe fn iter(self) -> NSFastIterator;\n}\n\nimpl NSFastEnumeration for id {\n    unsafe fn iter(self) -> NSFastIterator {\n        NSFastIterator {\n            state: NSFastEnumerationState {\n                state: 0,\n                items_ptr: ptr::null_mut(),\n                mutations_ptr: ptr::null_mut(),\n                extra: [0; 5]\n            },\n            buffer: [nil; NS_FAST_ENUM_BUF_SIZE],\n            mut_val: None,\n            len: 0,\n            idx: 0,\n            object: self\n        }\n    }\n}\n\npub trait NSRunLoop: Sized {\n    unsafe fn currentRunLoop() -> Self;\n\n    unsafe fn performSelector_target_argument_order_modes_(self,\n                                                           aSelector: SEL,\n                                                           target: id,\n                                                           anArgument: id,\n                                                           order: NSUInteger,\n                                                           modes: id);\n}\n\nimpl NSRunLoop for id {\n    unsafe fn currentRunLoop() -> id {\n        msg_send![class(\"NSRunLoop\"), currentRunLoop]\n    }\n\n    unsafe fn performSelector_target_argument_order_modes_(self,\n                                                           aSelector: SEL,\n                                                           target: id,\n                                                           anArgument: id,\n                                                           order: NSUInteger,\n                                                           modes: id) {\n        msg_send![self, performSelector:aSelector\n                                 target:target\n                               argument:anArgument\n                                  order:order\n                                  modes:modes]\n    }\n}\n\npub trait NSData: Sized {\n    unsafe fn data(_: Self) -> id {\n        msg_send![class(\"NSData\"), data]\n    }\n\n    unsafe fn dataWithBytes_length_(_: Self, bytes: *const libc::c_void, length: NSUInteger) -> id {\n        msg_send![class(\"NSData\"), dataWithBytes:bytes length:length]\n    }\n\n    unsafe fn dataWithBytesNoCopy_length_(_: Self, bytes: *const libc::c_void, length: NSUInteger) -> id {\n        msg_send![class(\"NSData\"), dataWithBytesNoCopy:bytes length:length]\n    }\n\n    unsafe fn dataWithBytesNoCopy_length_freeWhenDone_(_: Self, bytes: *const libc::c_void,\n                                                      length: NSUInteger, freeWhenDone: BOOL) -> id {\n        msg_send![class(\"NSData\"), dataWithBytesNoCopy:bytes length:length freeWhenDone:freeWhenDone]\n    }\n\n    unsafe fn dataWithContentsOfFile_(_: Self, path: id) -> id {\n        msg_send![class(\"NSData\"), dataWithContentsOfFile:path]\n    }\n\n    unsafe fn dataWithContentsOfFile_options_error_(_: Self, path: id, mask: NSDataReadingOptions,\n                                                    errorPtr: *mut id) -> id {\n        msg_send![class(\"NSData\"), dataWithContentsOfFile:path options:mask error:errorPtr]\n    }\n\n    unsafe fn dataWithContentsOfURL_(_: Self, aURL: id) -> id {\n        msg_send![class(\"NSData\"), dataWithContentsOfURL:aURL]\n    }\n\n    unsafe fn dataWithContentsOfURL_options_error_(_: Self, aURL: id, mask: NSDataReadingOptions,\n                                                   errorPtr: *mut id) -> id {\n        msg_send![class(\"NSData\"), dataWithContentsOfURL:aURL options:mask error:errorPtr]\n    }\n\n    unsafe fn dataWithData_(_: Self, aData: id) -> id {\n        msg_send![class(\"NSData\"), dataWithData:aData]\n    }\n\n    unsafe fn initWithBase64EncodedData_options_(self, base64Data: id, options: NSDataBase64DecodingOptions)\n                                                 -> id;\n    unsafe fn initWithBase64EncodedString_options_(self, base64String: id, options: NSDataBase64DecodingOptions)\n                                                   -> id;\n    unsafe fn initWithBytes_length_(self, bytes: *const libc::c_void, length: NSUInteger) -> id;\n    unsafe fn initWithBytesNoCopy_length_(self, bytes: *const libc::c_void, length: NSUInteger) -> id;\n    unsafe fn initWithBytesNoCopy_length_deallocator_(self, bytes: *const libc::c_void, length: NSUInteger,\n                                                      deallocator: *mut Block<(*const libc::c_void, NSUInteger), ()>)\n                                                      -> id;\n    unsafe fn initWithBytesNoCopy_length_freeWhenDone_(self, bytes: *const libc::c_void,\n                                                       length: NSUInteger, freeWhenDone: BOOL) -> id;\n    unsafe fn initWithContentsOfFile_(self, path: id) -> id;\n    unsafe fn initWithContentsOfFile_options_error(self, path: id, mask: NSDataReadingOptions, errorPtr: *mut id)\n                                                   -> id;\n    unsafe fn initWithContentsOfURL_(self, aURL: id) -> id;\n    unsafe fn initWithContentsOfURL_options_error_(self, aURL: id, mask: NSDataReadingOptions, errorPtr: *mut id)\n                                                   -> id;\n    unsafe fn initWithData_(self, data: id) -> id;\n\n    unsafe fn bytes(self) -> *const libc::c_void;\n    unsafe fn description(self) -> id;\n    unsafe fn enumerateByteRangesUsingBlock_(self, block: *mut Block<(*const libc::c_void, NSRange, *mut BOOL), ()>);\n    unsafe fn getBytes_length_(self, buffer: *mut libc::c_void, length: NSUInteger);\n    unsafe fn getBytes_range_(self, buffer: *mut libc::c_void, range: NSRange);\n    unsafe fn subdataWithRange_(self, range: NSRange) -> id;\n    unsafe fn rangeOfData_options_range_(self, dataToFind: id, options: NSDataSearchOptions, searchRange: NSRange)\n                                         -> NSRange;\n\n    unsafe fn base64EncodedDataWithOptions_(self, options: NSDataBase64EncodingOptions) -> id;\n    unsafe fn base64EncodedStringWithOptions_(self, options: NSDataBase64EncodingOptions) -> id;\n\n    unsafe fn isEqualToData_(self, otherData: id) -> id;\n    unsafe fn length(self) -> NSUInteger;\n\n    unsafe fn writeToFile_atomically_(self, path: id, atomically: BOOL) -> BOOL;\n    unsafe fn writeToFile_options_error_(self, path: id, mask: NSDataWritingOptions, errorPtr: *mut id) -> BOOL;\n    unsafe fn writeToURL_atomically_(self, aURL: id, atomically: BOOL) -> BOOL;\n    unsafe fn writeToURL_options_error_(self, aURL: id, mask: NSDataWritingOptions, errorPtr: *mut id) -> BOOL;\n}\n\nimpl NSData for id {\n    unsafe fn initWithBase64EncodedData_options_(self, base64Data: id, options: NSDataBase64DecodingOptions)\n                                                 -> id {\n        msg_send![self, initWithBase64EncodedData:base64Data options:options]\n    }\n\n    unsafe fn initWithBase64EncodedString_options_(self, base64String: id, options: NSDataBase64DecodingOptions)\n                                                   -> id {\n        msg_send![self, initWithBase64EncodedString:base64String options:options]\n    }\n\n    unsafe fn initWithBytes_length_(self, bytes: *const libc::c_void, length: NSUInteger) -> id {\n        msg_send![self,initWithBytes:bytes length:length]\n    }\n\n    unsafe fn initWithBytesNoCopy_length_(self, bytes: *const libc::c_void, length: NSUInteger) -> id {\n        msg_send![self, initWithBytesNoCopy:bytes length:length]\n    }\n\n    unsafe fn initWithBytesNoCopy_length_deallocator_(self, bytes: *const libc::c_void, length: NSUInteger,\n                                                      deallocator: *mut Block<(*const libc::c_void, NSUInteger), ()>)\n                                                      -> id {\n        msg_send![self, initWithBytesNoCopy:bytes length:length deallocator:deallocator]\n    }\n\n    unsafe fn initWithBytesNoCopy_length_freeWhenDone_(self, bytes: *const libc::c_void,\n                                                       length: NSUInteger, freeWhenDone: BOOL) -> id {\n        msg_send![self, initWithBytesNoCopy:bytes length:length freeWhenDone:freeWhenDone]\n    }\n\n    unsafe fn initWithContentsOfFile_(self, path: id) -> id {\n        msg_send![self, initWithContentsOfFile:path]\n    }\n\n    unsafe fn initWithContentsOfFile_options_error(self, path: id, mask: NSDataReadingOptions, errorPtr: *mut id)\n                                                   -> id {\n        msg_send![self, initWithContentsOfFile:path options:mask error:errorPtr]\n    }\n\n    unsafe fn initWithContentsOfURL_(self, aURL: id) -> id {\n        msg_send![self, initWithContentsOfURL:aURL]\n    }\n\n    unsafe fn initWithContentsOfURL_options_error_(self, aURL: id, mask: NSDataReadingOptions, errorPtr: *mut id)\n                                                   -> id {\n        msg_send![self, initWithContentsOfURL:aURL options:mask error:errorPtr]\n    }\n\n    unsafe fn initWithData_(self, data: id) -> id {\n        msg_send![self, initWithData:data]\n    }\n\n    unsafe fn bytes(self) -> *const libc::c_void {\n        msg_send![self, bytes]\n    }\n\n    unsafe fn description(self) -> id {\n        msg_send![self, description]\n    }\n\n    unsafe fn enumerateByteRangesUsingBlock_(self, block: *mut Block<(*const libc::c_void, NSRange, *mut BOOL), ()>) {\n        msg_send![self, enumerateByteRangesUsingBlock:block]\n    }\n\n    unsafe fn getBytes_length_(self, buffer: *mut libc::c_void, length: NSUInteger) {\n        msg_send![self, getBytes:buffer length:length]\n    }\n\n    unsafe fn getBytes_range_(self, buffer: *mut libc::c_void, range: NSRange) {\n        msg_send![self, getBytes:buffer range:range]\n    }\n\n    unsafe fn subdataWithRange_(self, range: NSRange) -> id {\n        msg_send![self, subdataWithRange:range]\n    }\n\n    unsafe fn rangeOfData_options_range_(self, dataToFind: id, options: NSDataSearchOptions, searchRange: NSRange)\n                                         -> NSRange {\n        msg_send![self, rangeOfData:dataToFind options:options range:searchRange]\n    }\n\n    unsafe fn base64EncodedDataWithOptions_(self, options: NSDataBase64EncodingOptions) -> id {\n        msg_send![self, base64EncodedDataWithOptions:options]\n    }\n\n    unsafe fn base64EncodedStringWithOptions_(self, options: NSDataBase64EncodingOptions) -> id {\n        msg_send![self, base64EncodedStringWithOptions:options]\n    }\n\n    unsafe fn isEqualToData_(self, otherData: id) -> id {\n        msg_send![self, isEqualToData:otherData]\n    }\n\n    unsafe fn length(self) -> NSUInteger {\n        msg_send![self, length]\n    }\n\n    unsafe fn writeToFile_atomically_(self, path: id, atomically: BOOL) -> BOOL {\n        msg_send![self, writeToFile:path atomically:atomically]\n    }\n\n    unsafe fn writeToFile_options_error_(self, path: id, mask: NSDataWritingOptions, errorPtr: *mut id) -> BOOL {\n        msg_send![self, writeToFile:path options:mask error:errorPtr]\n    }\n\n    unsafe fn writeToURL_atomically_(self, aURL: id, atomically: BOOL) -> BOOL {\n        msg_send![self, writeToURL:aURL atomically:atomically]\n    }\n\n    unsafe fn writeToURL_options_error_(self, aURL: id, mask: NSDataWritingOptions, errorPtr: *mut id) -> BOOL {\n        msg_send![self, writeToURL:aURL options:mask error:errorPtr]\n    }\n}\n\nbitflags! {\n    pub struct NSDataReadingOptions: libc::c_ulonglong {\n       const NSDataReadingMappedIfSafe = 1 << 0;\n       const NSDataReadingUncached = 1 << 1;\n       const NSDataReadingMappedAlways = 1 << 3;\n    }\n}\n\nbitflags! {\n    pub struct NSDataBase64EncodingOptions: libc::c_ulonglong {\n        const NSDataBase64Encoding64CharacterLineLength = 1 << 0;\n        const NSDataBase64Encoding76CharacterLineLength = 1 << 1;\n        const NSDataBase64EncodingEndLineWithCarriageReturn = 1 << 4;\n        const NSDataBase64EncodingEndLineWithLineFeed = 1 << 5;\n    }\n}\n\nbitflags! {\n    pub struct NSDataBase64DecodingOptions: libc::c_ulonglong {\n       const NSDataBase64DecodingIgnoreUnknownCharacters = 1 << 0;\n    }\n}\n\nbitflags! {\n    pub struct NSDataWritingOptions: libc::c_ulonglong {\n        const NSDataWritingAtomic = 1 << 0;\n        const NSDataWritingWithoutOverwriting = 1 << 1;\n    }\n}\n\nbitflags! {\n    pub struct NSDataSearchOptions: libc::c_ulonglong {\n        const NSDataSearchBackwards = 1 << 0;\n        const NSDataSearchAnchored = 1 << 1;\n    }\n}\n"
  },
  {
    "path": "src/lib.rs",
    "content": "// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\n#![crate_name = \"cocoa\"]\n#![crate_type = \"rlib\"]\n\n#![allow(non_snake_case)]\n\nextern crate block;\n#[macro_use]\nextern crate bitflags;\nextern crate libc;\nextern crate core_graphics;\n#[macro_use]\nextern crate objc;\n\n#[cfg(target_os = \"macos\")]\npub mod appkit;\npub mod base;\npub mod foundation;\n"
  },
  {
    "path": "tests/foundation.rs",
    "content": "#[macro_use]\nextern crate objc;\nextern crate block;\nextern crate cocoa;\n\n#[cfg(test)]\nmod foundation {\n    mod nsstring {\n        use cocoa::foundation::NSString;\n        use cocoa::base::nil;\n        use std::slice;\n        use std::str;\n\n        #[test]\n        fn test_utf8() {\n            let expected = \"Iñtërnâtiônàlizætiøn\";\n            unsafe {\n                let built = NSString::alloc(nil).init_str(expected);\n                let bytes = built.UTF8String() as *const u8;\n                let objc_string = str::from_utf8(slice::from_raw_parts(bytes, built.len()))\n                    .unwrap();\n                assert!(objc_string.len() == expected.len());\n                assert!(objc_string == expected);\n            }\n        }\n\n        #[test]\n        fn test_string() {\n            let expected = \"Hello World!\";\n            unsafe {\n                let built = NSString::alloc(nil).init_str(expected);\n                let bytes = built.UTF8String() as *const u8;\n                let objc_string = str::from_utf8(slice::from_raw_parts(bytes, built.len()))\n                    .unwrap();\n                assert!(objc_string.len() == expected.len());\n                assert!(objc_string == expected);\n            }\n        }\n\n        #[test]\n        fn test_length() {\n            let expected = \"Hello!\";\n            unsafe {\n                let built = NSString::alloc(nil).init_str(expected);\n                assert!(built.len() == expected.len());\n            }\n        }\n\n        #[test]\n        fn test_append_by_appending_string() {\n            let initial_str = \"Iñtërnâtiônàlizætiøn\";\n            let to_append = \"_more_strings\";\n            let expected = concat!(\"Iñtërnâtiônàlizætiøn\", \"_more_strings\");\n            unsafe {\n                let built = NSString::alloc(nil).init_str(initial_str);\n                let built_to_append = NSString::alloc(nil).init_str(to_append);\n                let append_string = built.stringByAppendingString_(built_to_append);\n                let bytes = append_string.UTF8String() as *const u8;\n                let objc_string = str::from_utf8(slice::from_raw_parts(bytes, append_string.len()))\n                    .unwrap();\n                assert!(objc_string == expected);\n            }\n        }\n    }\n\n    mod nsfastenumeration {\n        use std::str;\n        use std::slice;\n        use cocoa::foundation::{NSString, NSFastEnumeration};\n        use cocoa::base::{id, nil};\n\n        #[test]\n        fn test_iter() {\n            unsafe {\n                let string = NSString::alloc(nil).init_str(\"this is a test string\");\n                let separator = NSString::alloc(nil).init_str(\" \");\n                let components: id = msg_send![string, componentsSeparatedByString: separator];\n\n                let combined = components.iter()\n                    .map(|s| {\n                        let bytes = s.UTF8String() as *const u8;\n                        str::from_utf8(slice::from_raw_parts(bytes, s.len())).unwrap()\n                    })\n                    .fold(String::new(), |mut acc, s| {\n                        acc.push_str(s);\n                        acc\n                    });\n\n                assert_eq!(combined, \"thisisateststring\");\n            }\n        }\n\n        #[test]\n        #[should_panic]\n        fn test_mutation() {\n            unsafe {\n                let string = NSString::alloc(nil).init_str(\"this is a test string\");\n                let separator = NSString::alloc(nil).init_str(\" \");\n                let components: id = msg_send![string, componentsSeparatedByString: separator];\n                let mut_components: id = msg_send![components, mutableCopy];\n                let mut iter = mut_components.iter();\n                iter.next();\n                msg_send![mut_components, removeObjectAtIndex:1];\n                iter.next();\n            }\n        }\n    }\n\n    mod nsdictionary {\n        use block::ConcreteBlock;\n        use cocoa::foundation::{NSArray, NSComparisonResult, NSDictionary, NSFastEnumeration,\n                                NSString};\n        use cocoa::base::{id, nil};\n\n        #[test]\n        fn test_get() {\n            const KEY: &'static str = \"The key\";\n            const VALUE: &'static str = \"Some value\";\n            unsafe {\n                let key = NSString::alloc(nil).init_str(KEY);\n                let value = NSString::alloc(nil).init_str(VALUE);\n                let dict = NSDictionary::dictionaryWithObject_forKey_(nil, value, key);\n\n                let retrieved_value = dict.objectForKey_(key);\n                assert!(retrieved_value.isEqualToString(VALUE));\n            }\n        }\n\n        #[test]\n        fn test_iter() {\n            let mkstr = |s| unsafe { NSString::alloc(nil).init_str(s) };\n            let keys = vec![\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n            let objects = vec![\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"];\n            unsafe {\n                use std::{slice, str};\n                use std::cmp::{Ord, Ordering};\n\n                let keys_raw_vec = keys.clone().into_iter().map(&mkstr).collect::<Vec<_>>();\n                let objs_raw_vec = objects.clone().into_iter().map(&mkstr).collect::<Vec<_>>();\n\n                let keys_array = NSArray::arrayWithObjects(nil, &keys_raw_vec);\n                let objs_array = NSArray::arrayWithObjects(nil, &objs_raw_vec);\n\n                let dict =\n                    NSDictionary::dictionaryWithObjects_forKeys_(nil, objs_array, keys_array);\n\n                // NSDictionary does not store its contents in order of insertion, so ask for\n                // sorted iterators to ensure that each item is the same as its counterpart in\n                // the vector.\n\n                // First test cocoa sorting...\n                let mut comparator = ConcreteBlock::new(|s0: id, s1: id| {\n                    let (bytes0, len0) = (s0.UTF8String() as *const u8, s0.len());\n                    let (bytes1, len1) = (s1.UTF8String() as *const u8, s1.len());\n                    let (s0, s1) = (str::from_utf8(slice::from_raw_parts(bytes0, len0)).unwrap(),\n                                    str::from_utf8(slice::from_raw_parts(bytes1, len1)).unwrap());\n                    let (c0, c1) = (s0.chars().next().unwrap(), s1.chars().next().unwrap());\n                    match c0.cmp(&c1) {\n                        Ordering::Less => NSComparisonResult::NSOrderedAscending,\n                        Ordering::Equal => NSComparisonResult::NSOrderedSame,\n                        Ordering::Greater => NSComparisonResult::NSOrderedDescending,\n                    }\n                });\n\n                let associated_iter = keys.iter().zip(objects.iter());\n                for (k_id, (k, v)) in dict.keysSortedByValueUsingComparator_(&mut *comparator)\n                    .iter()\n                    .zip(associated_iter) {\n                    assert!(k_id.isEqualToString(k));\n                    let v_id = dict.objectForKey_(k_id);\n                    assert!(v_id.isEqualToString(v));\n                }\n\n                // Then use rust sorting\n                let mut keys_arr = dict.allKeys().iter().collect::<Vec<_>>();\n                keys_arr.sort();\n                for (k0, k1) in keys_arr.into_iter().zip(keys.iter()) {\n                    assert!(k0.isEqualToString(k1));\n                }\n\n                let mut objects_arr = dict.allValues().iter().collect::<Vec<_>>();\n                objects_arr.sort();\n                for (v0, v1) in objects_arr.into_iter().zip(objects.iter()) {\n                    assert!(v0.isEqualToString(v1));\n                }\n            }\n        }\n    }\n}\n"
  }
]