├── .gitignore ├── LICENSE ├── README.md ├── appkit └── src │ └── main │ └── scala │ └── cocoa │ └── appkit │ ├── AppKit.scala │ ├── NSAlert.scala │ ├── NSApplication.scala │ ├── NSApplicationDelegate.scala │ ├── NSArrayController.scala │ ├── NSButton.scala │ ├── NSColor.scala │ ├── NSComboBox.scala_ │ ├── NSComboBoxDataSource.scala_ │ ├── NSComboBoxDelegate.scala_ │ ├── NSControl.scala │ ├── NSControlTextEditingDelegate.scala │ ├── NSController.scala │ ├── NSDatePicker.scala_ │ ├── NSEvent.scala │ ├── NSImage.scala │ ├── NSImageDelegate.scala │ ├── NSImageRep.scala │ ├── NSLevelIndicator.scala_ │ ├── NSObjectController.scala │ ├── NSResponder.scala │ ├── NSTableCellView.scala_ │ ├── NSTableColumn.scala_ │ ├── NSTableRowView.scala_ │ ├── NSTableView.scala_ │ ├── NSTableViewDataSource.scala_ │ ├── NSTableViewDelegate.scala_ │ ├── NSText.scala │ ├── NSTextDelegate.scala │ ├── NSTextField.scala │ ├── NSTextFieldDelegate.scala │ ├── NSTextView.scala_ │ ├── NSTextViewDelegate.scala_ │ ├── NSView.scala │ ├── NSWindow.scala │ ├── NSWindowDelegate.scala │ └── package.scala ├── build.sbt ├── coredata └── src │ └── main │ └── scala │ └── cocoa │ └── coredata │ ├── NSEntityDescription.scala │ ├── NSManagedObject.scala │ ├── NSManagedObjectContext.scala │ ├── NSManagedObjectID.scala │ ├── NSManagedObjectModel.scala │ ├── NSPersistentContainer.scala │ └── package.scala ├── docs ├── Gemfile ├── Gemfile.lock ├── _config.yml ├── _data │ ├── alerts.yml │ ├── definitions.yml │ ├── glossary.yml │ ├── samplelist.yml │ ├── sidebars │ │ └── sncocoa_sidebar.yml │ ├── strings.yml │ ├── tags.yml │ ├── terms.yml │ └── topnav.yml ├── _includes │ ├── archive.html │ ├── callout.html │ ├── disqus.html │ ├── feedback.html │ ├── footer.html │ ├── head.html │ ├── head_print.html │ ├── image.html │ ├── important.html │ ├── initialize_shuffle.html │ ├── inline_image.html │ ├── links.html │ ├── note.html │ ├── sidebar.html │ ├── taglogic.html │ ├── tip.html │ ├── toc.html │ ├── topnav.html │ └── warning.html ├── _layouts │ ├── default.html │ ├── default_print.html │ ├── none.html │ ├── page.html │ ├── page_print.html │ └── post.html ├── css │ ├── bootstrap.min.css │ ├── boxshadowproperties.css │ ├── customstyles.css │ ├── font-awesome.min.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── modern-business.css │ ├── printstyles.css │ ├── syntax.css │ ├── theme-blue.css │ └── theme-green.css ├── index.md ├── js │ ├── customscripts.js │ ├── jekyll-search.js │ ├── jquery.ba-throttle-debounce.min.js │ ├── jquery.navgoco.min.js │ ├── jquery.shuffle.min.js │ └── toc.js ├── pages │ └── sncocoa │ │ ├── guide │ │ ├── snc_basic_interop.md │ │ ├── snc_collections.md │ │ ├── snc_create_binding.md │ │ └── snc_memory_management.md │ │ ├── overview │ │ ├── snc_get_started.md │ │ └── snc_sbt_settings.md │ │ └── status │ │ ├── snc_status_appkit.md │ │ ├── snc_status_coredata.md │ │ └── snc_status_foundation.md └── runJekyll.sh ├── foundation └── src │ ├── main │ └── scala │ │ ├── cocoa │ │ └── foundation │ │ │ ├── Foundation.scala │ │ │ ├── Macros.scala │ │ │ ├── NSArray.scala │ │ │ ├── NSCharacterSet.scala │ │ │ ├── NSCoder.scala │ │ │ ├── NSCoding.scala │ │ │ ├── NSConverters.scala_ │ │ │ ├── NSCopying.scala │ │ │ ├── NSData.scala │ │ │ ├── NSDate.scala_ │ │ │ ├── NSDictionary.scala │ │ │ ├── NSDiscardableContent.scala │ │ │ ├── NSEnumerator.scala │ │ │ ├── NSError.scala │ │ │ ├── NSFileSecurity.scala │ │ │ ├── NSIndexSet.scala │ │ │ ├── NSInvocation.scala_ │ │ │ ├── NSLocale.scala │ │ │ ├── NSMethodSignature.scala_ │ │ │ ├── NSMutableArray.scala │ │ │ ├── NSMutableArray.scala_ │ │ │ ├── NSMutableCharacterSet.scala │ │ │ ├── NSMutableCopying.scala │ │ │ ├── NSMutableData.scala │ │ │ ├── NSMutableDictionary.scala │ │ │ ├── NSMutableIndexSet.scala │ │ │ ├── NSMutableString.scala │ │ │ ├── NSNotification.scala │ │ │ ├── NSNotificationCenter.scala │ │ │ ├── NSNumber.scala │ │ │ ├── NSObject.scala │ │ │ ├── NSProxy.scala_ │ │ │ ├── NSPurgeableData.scala │ │ │ ├── NSSecureCoding.scala │ │ │ ├── NSString.scala │ │ │ ├── NSString.scala_ │ │ │ ├── NSTimeZone.scala_ │ │ │ ├── NSURL.scala │ │ │ ├── NSURLComponents.scala │ │ │ ├── NSURLQueryItem.scala │ │ │ ├── NSValue.scala │ │ │ ├── Protocol.scala │ │ │ ├── convert │ │ │ ├── DecorateAsScala.scala │ │ │ ├── Decorators.scala │ │ │ ├── WrapAsScala.scala │ │ │ └── Wrappers.scala │ │ │ ├── decorators.scala_ │ │ │ └── package.scala │ │ └── wrapDictionary.scala │ └── test │ └── scala │ └── cocoa │ └── foundation │ └── test │ ├── NSArrayTest.scala │ ├── NSCharacterSetTest.scala │ ├── NSDataTest.scala │ ├── NSDictionaryTest.scala │ ├── NSErrorTest.scala │ ├── NSMutableArrayTest.scala │ ├── NSMutableCharacterSetTest.scala │ ├── NSMutableDataTest.scala │ ├── NSMutableStringTest.scala │ ├── NSNumberTest.scala │ ├── NSObjectTest.scala │ ├── NSStringTest.scala │ ├── NSURLComponentsTest.scala │ ├── NSURLTest.scala │ └── NSValueTest.scala ├── project ├── build.properties └── plugins.sbt ├── test └── src │ ├── main │ └── scala │ │ └── Main.scala │ └── test │ └── scala │ └── objc │ └── test │ └── ScalaObjCTest.scala └── uikit └── src └── main └── scala └── cocoa └── uikit ├── UIApplication.scala ├── UIApplicationDelegate.scala ├── UIKit.scala └── UIViewController.scala /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .idea/ 3 | _site/ 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017,2018 Johannes Kastner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # scalanative-cocoa 2 | Experimental [scala-native](https://github.com/scala-native/scala-native) bridge for Objective-C / Cocoa. 3 | 4 | **WARNING**: This project is in an early experimental stage. Most of the bindings to Cocoa are still missing. The API and especially the semantics for creating Objective-C classes in Scala may change any time! 5 | 6 | **[Documentation](https://jokade.github.io/scalanative-cocoa/)** 7 | 8 | ### sbt Settings 9 | Add this to your `build.sbt`: 10 | ```scala 11 | libraryDependencies += "de.surfice" %%% "scalanative-cocoa-foundation" % "0.0.1-SNAPSHOT" 12 | 13 | addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full) 14 | 15 | resolvers += Resolver.sonatypeRepo("snapshots") 16 | ``` 17 | Replace `scalanative-cocoa-foundation` with `scalanative-cocoa-appkit` if you want to use AppKit. However, it's probably best to start with the template in that case (see below). 18 | 19 | scalanative-cocoa requires scala-native 0.3.2. 20 | 21 | 22 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/AppKit.scala: -------------------------------------------------------------------------------- 1 | package cocoa.appkit 2 | 3 | import cocoa.foundation.{BOOL, NSInteger, NSString} 4 | import scalanative.native._ 5 | import objc.runtime.id 6 | 7 | 8 | @extern 9 | object AppKit { 10 | 11 | 12 | // from NSApplication.h 13 | type _NSModalSession = Ptr[Byte] 14 | type NSThreadPrivate = Ptr[Byte] 15 | type __appFlags = Ptr[Byte] 16 | def NSApplicationMain(argc: CInt, argv: Ptr[Ptr[CSignedChar]]): CInt = extern 17 | def NSApplicationLoad(): BOOL = extern 18 | def NSShowsServicesMenuItem(itemName: NSString): BOOL = extern 19 | def NSSetShowsServicesMenuItem(itemName: NSString, enabled: BOOL): NSInteger = extern 20 | def NSUpdateDynamicServices(): Unit = extern 21 | // def NSPerformService_pboard_(itemName: NSString, pboard: NSPasteboard): BOOL = extern 22 | // def NSRegisterServicesProvider_name_(provider: id, name: NSServiceProviderName): Unit = extern 23 | // def NSUnregisterServicesProvider_(name: NSServiceProviderName): Unit = extern 24 | 25 | 26 | // from NSEvent.h 27 | def NSEventMaskFromType_(`type`: NSEventType): NSEventMask = extern 28 | 29 | } 30 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSAlert.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSArray, NSError, NSObject, NSObjectClass, NSString, SEL, id} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | @ObjC 11 | trait NSAlertDelegate extends NSObject { 12 | @inline def alertShowHelp_(alert: NSAlert): BOOL = extern 13 | } 14 | 15 | @ObjC 16 | class NSAlert extends NSObject { 17 | @inline def addButtonWithTitle_(title: NSString): NSButton = extern 18 | @inline def layout(): Unit = extern 19 | @inline def runModal(): NSModalResponse = extern 20 | @inline def beginSheetModalForWindow_handler_(sheetWindow: NSWindow, handler: Ptr[Byte]): Unit = extern 21 | @inline def messageText(): NSString = extern 22 | @inline def setMessageText_(messageText: NSString): Unit = extern 23 | @inline def informativeText(): NSString = extern 24 | @inline def setInformativeText_(informativeText: NSString): Unit = extern 25 | @inline def icon(): NSImage = extern 26 | @inline def setIcon_(icon: NSImage): Unit = extern 27 | @inline def buttons(): NSArray[NSButton] = extern 28 | @inline def showsHelp(): BOOL = extern 29 | @inline def setShowsHelp_(showsHelp: BOOL): Unit = extern 30 | @inline def helpAnchor(): NSHelpAnchorName = extern 31 | @inline def setHelpAnchor_(helpAnchor: NSHelpAnchorName): Unit = extern 32 | @inline def alertStyle(): NSAlertStyle = extern 33 | @inline def setAlertStyle_(alertStyle: NSAlertStyle): Unit = extern 34 | @inline def delegate(): NSAlertDelegate = extern 35 | @inline def setDelegate_(delegate: NSAlertDelegate): Unit = extern 36 | @inline def showsSuppressionButton(): BOOL = extern 37 | @inline def setShowsSuppressionButton_(showsSuppressionButton: BOOL): Unit = extern 38 | @inline def suppressionButton(): NSButton = extern 39 | @inline def accessoryView(): NSView = extern 40 | @inline def setAccessoryView_(accessoryView: NSView): Unit = extern 41 | @inline def window(): NSWindow = extern 42 | @inline def beginSheetModalForWindow_delegate_didEndSelector_contextInfo_(window: NSWindow, delegate: id, didEndSelector: SEL, contextInfo: Ptr[Byte]): Unit = extern 43 | } 44 | 45 | @ObjCClass 46 | abstract class NSAlertClass extends NSObjectClass { 47 | @inline def alertWithError_(error: NSError): NSAlert = extern 48 | } 49 | 50 | object NSAlert extends NSAlertClass { 51 | override type InstanceType = NSAlert 52 | 53 | def apply(messageText: String, 54 | defaultButton: String, 55 | alternateButton: String = "", 56 | informativeText: String = "", 57 | otherButton: String = "", 58 | alertStyle: NSAlertStyle = NSAlertStyle.Informational): NSAlert = apply( 59 | NSString(messageText), 60 | NSString(defaultButton), 61 | if( alternateButton != "") NSString(alternateButton) else null, 62 | if( informativeText != "") NSString(informativeText) else null, 63 | if( otherButton != "") NSString(otherButton) else null, 64 | alertStyle) 65 | 66 | def apply(messageText: NSString, 67 | defaultButton: NSString, 68 | alternateButton: NSString, 69 | informativeText: NSString, 70 | otherButton: NSString, 71 | alertStyle: NSAlertStyle): NSAlert = { 72 | val alert = NSAlert.alloc().init() 73 | alert.setMessageText_(messageText) 74 | alert.addButtonWithTitle_(defaultButton) 75 | if( alternateButton != null ) 76 | alert.addButtonWithTitle_(alternateButton) 77 | if( otherButton != null ) 78 | alert.addButtonWithTitle_(otherButton) 79 | if( informativeText != null ) 80 | alert.setInformativeText_(informativeText) 81 | alert.setAlertStyle_(alertStyle) 82 | alert 83 | } 84 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSApplicationDelegate.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scalanative.native._ 5 | import cocoa.foundation.{BOOL, NSCoder, NSData, NSError, NSNotification, NSObject, NSString, NSURL, id} 6 | 7 | import objc._ 8 | 9 | 10 | @ObjC 11 | trait NSApplicationDelegate extends NSObject { 12 | @inline def applicationShouldTerminate_(sender: NSApplication): NSApplicationTerminateReply = extern 13 | @inline def application_urls_(application: NSApplication, urls: NSURL): Unit = extern 14 | @inline def application_filename_(sender: NSApplication, filename: NSString): BOOL = extern 15 | @inline def application_filenames_(sender: NSApplication, filenames: NSString): Unit = extern 16 | @inline def applicationShouldOpenUntitledFile_(sender: NSApplication): BOOL = extern 17 | @inline def applicationOpenUntitledFile_(sender: NSApplication): BOOL = extern 18 | @inline def application_filename_(sender: id, filename: NSString): BOOL = extern 19 | // @inline def application_fileNames_printSettings_showPrintPanels_(application: NSApplication, fileNames: NSString, printSettings: id, showPrintPanels: BOOL): NSApplicationPrintReply = extern 20 | @inline def applicationShouldTerminateAfterLastWindowClosed_(sender: NSApplication): BOOL = extern 21 | @inline def applicationShouldHandleReopen_flag_(sender: NSApplication, flag: BOOL): BOOL = extern 22 | // @inline def applicationDockMenu_(sender: NSApplication): NSMenu = extern 23 | @inline def application_error_(application: NSApplication, error: NSError): NSError = extern 24 | @inline def application_deviceToken_(application: NSApplication, deviceToken: NSData): Unit = extern 25 | @inline def application_userInfo_(application: NSApplication, userInfo: id): Unit = extern 26 | @inline def application_coder_(app: NSApplication, coder: NSCoder): Unit = extern 27 | @inline def application_userActivityType_(application: NSApplication, userActivityType: NSString): BOOL = extern 28 | // @inline def application_userActivity_restorationHandler_(application: NSApplication, userActivity: NSUserActivity, restorationHandler: Ptr[Byte]): BOOL = extern 29 | @inline def application_userActivityType_error_(application: NSApplication, userActivityType: NSString, error: NSError): Unit = extern 30 | // @inline def application_userActivity_(application: NSApplication, userActivity: NSUserActivity): Unit = extern 31 | // @inline def application_metadata_(application: NSApplication, metadata: CKShareMetadata): Unit = extern 32 | @inline def applicationWillFinishLaunching_(notification: NSNotification): Unit = extern 33 | @inline def applicationDidFinishLaunching_(notification: NSNotification): Unit = extern 34 | @inline def applicationWillHide_(notification: NSNotification): Unit = extern 35 | @inline def applicationDidHide_(notification: NSNotification): Unit = extern 36 | @inline def applicationWillUnhide_(notification: NSNotification): Unit = extern 37 | @inline def applicationDidUnhide_(notification: NSNotification): Unit = extern 38 | @inline def applicationWillBecomeActive_(notification: NSNotification): Unit = extern 39 | @inline def applicationDidBecomeActive_(notification: NSNotification): Unit = extern 40 | @inline def applicationWillResignActive_(notification: NSNotification): Unit = extern 41 | @inline def applicationDidResignActive_(notification: NSNotification): Unit = extern 42 | @inline def applicationWillUpdate_(notification: NSNotification): Unit = extern 43 | @inline def applicationDidUpdate_(notification: NSNotification): Unit = extern 44 | @inline def applicationWillTerminate_(notification: NSNotification): Unit = extern 45 | @inline def applicationDidChangeScreenParameters_(notification: NSNotification): Unit = extern 46 | @inline def applicationDidChangeOcclusionState_(notification: NSNotification): Unit = extern 47 | } 48 | 49 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSArrayController.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scalanative.native._ 5 | import objc._ 6 | import cocoa.foundation._ 7 | 8 | 9 | @ObjC 10 | class NSArrayController[T<:NSObject] extends NSObjectController[T] { 11 | @inline def rearrangeObjects(): Unit = extern 12 | @inline def didChangeArrangementCriteria(): Unit = extern 13 | @inline def arrangeObjects_(objects: NSArray[T]): NSArray[T] = extern 14 | @inline def setSelectionIndexes_(indexes: NSIndexSet): BOOL = extern 15 | @inline def setSelectionIndex_(index: NSUInteger): BOOL = extern 16 | @inline def addSelectionIndexes_(indexes: NSIndexSet): BOOL = extern 17 | @inline def removeSelectionIndexes_(indexes: NSIndexSet): BOOL = extern 18 | @inline def setSelectedObjects_(objects: NSArray[T]): BOOL = extern 19 | @inline def addSelectedObjects_(objects: NSArray[T]): BOOL = extern 20 | @inline def removeSelectedObjects_(objects: NSArray[T]): BOOL = extern 21 | @inline def insert_(sender: id): Unit = extern 22 | @inline def selectNext_(sender: id): Unit = extern 23 | @inline def selectPrevious_(sender: id): Unit = extern 24 | @inline def addObjects_(objects: NSArray[T]): Unit = extern 25 | @inline def insertObject_index_(`object`: id, index: NSUInteger): Unit = extern 26 | @inline def insertObjects_indexes_(objects: NSArray[T], indexes: NSIndexSet): Unit = extern 27 | @inline def removeObjectAtArrangedObjectIndex_(index: NSUInteger): Unit = extern 28 | @inline def removeObjectsAtArrangedObjectIndexes_(indexes: NSIndexSet): Unit = extern 29 | @inline def removeObjects_(objects: NSArray[T]): Unit = extern 30 | @inline def automaticallyRearrangesObjects(): BOOL = extern 31 | @inline def setAutomaticallyRearrangesObjects_(automaticallyRearrangesObjects: BOOL): Unit = extern 32 | @inline def automaticRearrangementKeyPaths(): NSArray[T] = extern 33 | // @inline def sortDescriptors(): NSArray[T][NSSortDescriptor] = extern 34 | // @inline def setSortDescriptors_(sortDescriptors: NSArray[T][NSSortDescriptor]): Unit = extern 35 | // @inline def filterPredicate(): NSPredicate = extern 36 | // @inline def setFilterPredicate_(filterPredicate: NSPredicate): Unit = extern 37 | @inline def clearsFilterPredicateOnInsertion(): BOOL = extern 38 | @inline def setClearsFilterPredicateOnInsertion_(clearsFilterPredicateOnInsertion: BOOL): Unit = extern 39 | @inline def arrangedObjects(): id = extern 40 | @inline def avoidsEmptySelection(): BOOL = extern 41 | @inline def setAvoidsEmptySelection_(avoidsEmptySelection: BOOL): Unit = extern 42 | @inline def preservesSelection(): BOOL = extern 43 | @inline def setPreservesSelection_(preservesSelection: BOOL): Unit = extern 44 | @inline def selectsInsertedObjects(): BOOL = extern 45 | @inline def setSelectsInsertedObjects_(selectsInsertedObjects: BOOL): Unit = extern 46 | @inline def alwaysUsesMultipleValuesMarker(): BOOL = extern 47 | @inline def setAlwaysUsesMultipleValuesMarker_(alwaysUsesMultipleValuesMarker: BOOL): Unit = extern 48 | @inline def selectionIndexes(): NSIndexSet = extern 49 | @inline def selectionIndex(): NSUInteger = extern 50 | @inline def canInsert(): BOOL = extern 51 | @inline def canSelectNext(): BOOL = extern 52 | @inline def canSelectPrevious(): BOOL = extern 53 | } 54 | 55 | @ObjCClass 56 | abstract class NSArrayControllerClass extends NSObjectControllerClass { 57 | } 58 | 59 | object NSArrayController extends NSArrayControllerClass { 60 | override type InstanceType = NSArrayController[_] 61 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSComboBox.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSArray, NSInteger, NSObject, NSObjectClass, NSSize, id} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | 9 | @ObjC 10 | class NSComboBox extends NSTextField { 11 | @inline def reloadData(): Unit = extern 12 | @inline def noteNumberOfItemsChanged(): Unit = extern 13 | @inline def scrollItemAtIndexToTop(index: NSInteger): Unit = extern 14 | @inline def scrollItemAtIndexToVisible(index: NSInteger): Unit = extern 15 | @inline def selectItemAtIndex(index: NSInteger): Unit = extern 16 | @inline def deselectItemAtIndex(index: NSInteger): Unit = extern 17 | @inline def addItemWithObjectValue(`object`: id): Unit = extern 18 | @inline def addItemsWithObjectValues[T<:NSObject](objects: NSArray[T]): Unit = extern 19 | @inline def insertItemWithObjectValue(`object`: id, index: NSInteger): Unit = extern 20 | @inline def removeItemWithObjectValue(`object`: id): Unit = extern 21 | @inline def removeItemAtIndex(index: NSInteger): Unit = extern 22 | @inline def removeAllItems(): Unit = extern 23 | @inline def selectItemWithObjectValue(`object`: id): Unit = extern 24 | @inline def itemObjectValueAtIndex(index: NSInteger): id = extern 25 | @inline def indexOfItemWithObjectValue(`object`: id): NSInteger = extern 26 | @inline def hasVerticalScroller(): BOOL = extern 27 | @inline def setHasVerticalScroller(hasVerticalScroller: BOOL): Unit = extern 28 | @inline def intercellSpacing(): NSSize = extern 29 | @inline def setIntercellSpacing(intercellSpacing: NSSize): Unit = extern 30 | // @inline def itemHeight(): CGFloat = extern 31 | // @inline def setItemHeight(itemHeight: CGFloat): Unit = extern 32 | @inline def numberOfVisibleItems(): NSInteger = extern 33 | @inline def setNumberOfVisibleItems(numberOfVisibleItems: NSInteger): Unit = extern 34 | @inline def isButtonBordered(): BOOL = extern 35 | @inline def setButtonBordered(buttonBordered: BOOL): Unit = extern 36 | @inline def usesDataSource(): BOOL = extern 37 | @inline def setUsesDataSource(usesDataSource: BOOL): Unit = extern 38 | @inline def indexOfSelectedItem(): NSInteger = extern 39 | @inline def numberOfItems(): NSInteger = extern 40 | @inline def completes(): BOOL = extern 41 | @inline def setCompletes(completes: BOOL): Unit = extern 42 | @inline def dataSource(): NSComboBoxDataSource = extern 43 | @inline def setDataSource(dataSource: NSComboBoxDataSource): Unit = extern 44 | @inline def objectValueOfSelectedItem(): id = extern 45 | @inline def objectValues[T<:NSObject](): NSArray[T] = extern 46 | } 47 | 48 | @ObjCClass 49 | abstract class NSComboBoxClass extends NSObjectClass { 50 | } 51 | 52 | object NSComboBox extends NSComboBoxClass { 53 | override type InstanceType = NSComboBox 54 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSComboBoxDataSource.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{NSInteger, NSObject, NSString, NSUInteger, id} 5 | 6 | import scalanative.native._ 7 | 8 | 9 | @ObjC 10 | trait NSComboBoxDataSource extends NSObject { 11 | @inline def numberOfItemsInComboBox(aComboBox: NSComboBox): NSInteger = extern 12 | @inline def comboBox(aComboBox: NSComboBox, index: NSInteger): id = extern 13 | @inline def comboBox(aComboBox: NSComboBox, string: NSString): NSUInteger = extern 14 | // @inline def comboBox(aComboBox: NSComboBox, string: NSString): NSString = extern 15 | } 16 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSComboBoxDelegate.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.NSNotification 5 | 6 | import scalanative.native._ 7 | 8 | /* 9 | @ObjC 10 | trait NSComboBoxDelegate extends NSTextFieldDelegate { 11 | @inline def comboBoxWillPopUp(notification: NSNotification): Unit = extern 12 | @inline def comboBoxWillDismiss(notification: NSNotification): Unit = extern 13 | @inline def comboBoxSelectionDidChange(notification: NSNotification): Unit = extern 14 | @inline def comboBoxSelectionIsChanging(notification: NSNotification): Unit = extern 15 | } 16 | */ 17 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSControlTextEditingDelegate.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scalanative.native._ 5 | import cocoa.foundation.{BOOL, NSArray, NSInteger, NSObject, NSRange, NSString, SEL, id} 6 | 7 | import objc._ 8 | 9 | @ObjC 10 | trait NSControlTextEditingDelegate extends NSObject { 11 | @inline def control_fieldEditor_(control: NSControl, fieldEditor: NSText): BOOL = extern 12 | @inline def control_string_error_(control: NSControl, string: NSString, error: NSString): BOOL = extern 13 | @inline def control_obj_(control: NSControl, obj: id): BOOL = extern 14 | // @inline def control_textView_commandSelector_(control: NSControl, textView: NSTextView, commandSelector: SEL): BOOL = extern 15 | // @inline def control_textView_words_charRange_index_(control: NSControl, textView: NSTextView, words: NSString, charRange: NSRange, index: NSInteger): NSArray[NSString] = extern 16 | } 17 | 18 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSController.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scala.language.experimental.macros 5 | import scalanative.native._ 6 | import objc._ 7 | import cocoa.foundation._ 8 | 9 | 10 | @ObjC 11 | class NSController extends NSObject with NSCoding { 12 | @inline def objectDidBeginEditing_(editor: id): Unit = extern 13 | @inline def objectDidEndEditing_(editor: id): Unit = extern 14 | @inline def discardEditing(): Unit = extern 15 | @inline def commitEditing(): BOOL = extern 16 | @inline def commitEditingWithDelegate_didCommitSelector_contextInfo_(delegate: id, didCommitSelector: SEL, contextInfo: Ptr[Byte]): Unit = extern 17 | @inline def isEditing(): BOOL = extern 18 | } 19 | 20 | @ObjCClass 21 | abstract class NSControllerClass extends NSObjectClass { 22 | } 23 | 24 | object NSController extends NSControllerClass { 25 | override type InstanceType = NSController 26 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSDatePicker.scala_: -------------------------------------------------------------------------------- 1 | package cocoa.appkit 2 | 3 | import scalanative.native._ 4 | import cocoa.foundation.{BOOL, NSDate, NSLocale, NSTimeInterval, NSTimeZone} 5 | import objc.runtime.id 6 | 7 | import scala.language.experimental.macros 8 | 9 | 10 | @ObjC 11 | class NSDatePicker extends NSControl { 12 | @inline def datePickerStyle(): NSDatePickerStyle = extern 13 | @inline def setDatePickerStyle(datePickerStyle: NSDatePickerStyle): Unit = extern 14 | @inline def isBezeled(): BOOL = extern 15 | @inline def setBezeled(bezeled: BOOL): Unit = extern 16 | @inline def isBordered(): BOOL = extern 17 | @inline def setBordered(bordered: BOOL): Unit = extern 18 | @inline def drawsBackground(): BOOL = extern 19 | @inline def setDrawsBackground(drawsBackground: BOOL): Unit = extern 20 | // @inline def backgroundColor(): NSColor = extern 21 | // @inline def setBackgroundColor(backgroundColor: NSColor): Unit = extern 22 | // @inline def textColor(): NSColor = extern 23 | // @inline def setTextColor(textColor: NSColor): Unit = extern 24 | @inline def datePickerMode(): NSDatePickerMode = extern 25 | @inline def setDatePickerMode(datePickerMode: NSDatePickerMode): Unit = extern 26 | @inline def datePickerElements(): NSDatePickerElementFlags = extern 27 | @inline def setDatePickerElements(datePickerElements: NSDatePickerElementFlags): Unit = extern 28 | // @inline def calendar(): NSCalendar = extern 29 | // @inline def setCalendar(calendar: NSCalendar): Unit = extern 30 | @inline def locale(): NSLocale = extern 31 | @inline def setLocale(locale: NSLocale): Unit = extern 32 | @inline def timeZone(): NSTimeZone = extern 33 | @inline def setTimeZone(timeZone: NSTimeZone): Unit = extern 34 | @inline def dateValue(): NSDate = extern 35 | @inline def setDateValue(dateValue: NSDate): Unit = extern 36 | @inline def timeInterval(): NSTimeInterval = extern 37 | @inline def setTimeInterval(timeInterval: NSTimeInterval): Unit = extern 38 | @inline def minDate(): NSDate = extern 39 | @inline def setMinDate(minDate: NSDate): Unit = extern 40 | @inline def maxDate(): NSDate = extern 41 | @inline def setMaxDate(maxDate: NSDate): Unit = extern 42 | @inline def delegate(): id = extern 43 | @inline def setDelegate(delegate: id): Unit = extern 44 | } 45 | 46 | 47 | @ObjCClass 48 | abstract class NSDatePickerClass extends NSControlClass { 49 | } 50 | 51 | object NSDatePicker extends NSDatePickerClass { 52 | override type InstanceType = NSDatePicker 53 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSImageDelegate.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scala.language.experimental.macros 5 | import scalanative.native._ 6 | import objc._ 7 | import cocoa.foundation._ 8 | 9 | 10 | @ObjC 11 | trait NSImageDelegate extends NSObject { 12 | @inline def imageDidNotDraw_rect_(sender: NSImage, rect: NSRect): NSImage = extern 13 | @inline def image_rep_(image: NSImage, rep: NSImageRep): Unit = extern 14 | @inline def image_rep_rows_(image: NSImage, rep: NSImageRep, rows: NSInteger): Unit = extern 15 | @inline def image_rep_status_(image: NSImage, rep: NSImageRep, status: NSImageLoadStatus): Unit = extern 16 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSImageRep.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation._ 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | 11 | @ObjC 12 | class NSImageRep extends NSObject with NSCopying with NSCoding { 13 | @inline def draw(): BOOL = extern 14 | @inline def drawAtPoint_(point: NSPoint): BOOL = extern 15 | @inline def drawInRect_(rect: NSRect): BOOL = extern 16 | // @inline def drawInRect_srcSpacePortionRect_op_requestedAlpha_respectContextIsFlipped_hints_(dstSpacePortionRect: NSRect, srcSpacePortionRect: NSRect, op: NSCompositingOperation, requestedAlpha: CGFloat, respectContextIsFlipped: BOOL, hints: id): BOOL = extern 17 | // @inline def CGImageForProposedRect_context_hints_(proposedDestRect: NSRect, context: NSGraphicsContext, hints: id): CGImageRef = extern 18 | @inline def size(): NSSize = extern 19 | @inline def setSize_(size: NSSize): Unit = extern 20 | @inline def hasAlpha(): BOOL = extern 21 | @inline def setAlpha_(alpha: BOOL): Unit = extern 22 | @inline def isOpaque(): BOOL = extern 23 | @inline def setOpaque_(opaque: BOOL): Unit = extern 24 | // @inline def colorSpaceName(): NSColorSpaceName = extern 25 | // @inline def setColorSpaceName_(colorSpaceName: NSColorSpaceName): Unit = extern 26 | @inline def bitsPerSample(): NSInteger = extern 27 | @inline def setBitsPerSample_(bitsPerSample: NSInteger): Unit = extern 28 | @inline def pixelsWide(): NSInteger = extern 29 | @inline def setPixelsWide_(pixelsWide: NSInteger): Unit = extern 30 | @inline def pixelsHigh(): NSInteger = extern 31 | @inline def setPixelsHigh_(pixelsHigh: NSInteger): Unit = extern 32 | @inline def layoutDirection(): NSImageLayoutDirection = extern 33 | @inline def setLayoutDirection_(layoutDirection: NSImageLayoutDirection): Unit = extern 34 | } 35 | 36 | @ObjCClass 37 | abstract class NSImageRepClass extends NSObjectClass { 38 | @inline def registerImageRepClass_(imageRepClass: id): Unit = extern 39 | @inline def unregisterImageRepClass_(imageRepClass: id): Unit = extern 40 | @inline def imageRepClassForFileType_(`type`: NSString): id = extern 41 | // @inline def imageRepClassForPasteboardType_(`type`: NSPasteboardType): id = extern 42 | @inline def imageRepClassForType_(`type`: NSString): id = extern 43 | @inline def imageRepClassForData_(data: NSData): id = extern 44 | @inline def canInitWithData_(data: NSData): BOOL = extern 45 | @inline def imageUnfilteredFileTypes(): NSArray[NSString] = extern 46 | // @inline def imageUnfilteredPasteboardTypes(): NSArray[NSPasteboardType] = extern 47 | @inline def imageFileTypes(): NSArray[NSString] = extern 48 | // @inline def imagePasteboardTypes(): NSArray[NSPasteboardType] = extern 49 | // @inline def canInitWithPasteboard_(pasteboard: NSPasteboard): BOOL = extern 50 | @inline def imageRepsWithContentsOfFile_(filename: NSString): NSArray[NSImageRep] = extern 51 | @inline def imageRepWithContentsOfFile_(filename: NSString): NSImageRep = extern 52 | @inline def imageRepsWithContentsOfURL_(url: NSURL): NSArray[NSImageRep] = extern 53 | @inline def imageRepWithContentsOfURL_(url: NSURL): NSImageRep = extern 54 | // @inline def imageRepsWithPasteboard_(pasteboard: NSPasteboard): NSArray[NSImageRep] = extern 55 | // @inline def imageRepWithPasteboard_(pasteboard: NSPasteboard): NSImageRep = extern 56 | @inline def registeredImageRepClasses(): NSArray[NSObject] = extern 57 | @inline def imageUnfilteredTypes(): NSArray[NSString] = extern 58 | @inline def imageTypes(): NSArray[NSString] = extern 59 | } 60 | 61 | object NSImageRep extends NSImageRepClass { 62 | override type InstanceType = NSImageRep 63 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSLevelIndicator.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{NSInteger, NSObjectClass, NSRect} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | 9 | 10 | @ObjC 11 | class NSLevelIndicator extends NSControl { 12 | @inline def tickMarkValueAtIndex(index: NSInteger): Double = extern 13 | @inline def rectOfTickMarkAtIndex(index: NSInteger): NSRect = extern 14 | // @inline def levelIndicatorStyle(): NSLevelIndicatorStyle = extern 15 | // @inline def setLevelIndicatorStyle(levelIndicatorStyle: NSLevelIndicatorStyle): Unit = extern 16 | @inline def minValue(): Double = extern 17 | @inline def setMinValue(minValue: Double): Unit = extern 18 | @inline def maxValue(): Double = extern 19 | @inline def setMaxValue(maxValue: Double): Unit = extern 20 | @inline def warningValue(): Double = extern 21 | @inline def setWarningValue(warningValue: Double): Unit = extern 22 | @inline def criticalValue(): Double = extern 23 | @inline def setCriticalValue(criticalValue: Double): Unit = extern 24 | // @inline def tickMarkPosition(): NSTickMarkPosition = extern 25 | // @inline def setTickMarkPosition(tickMarkPosition: NSTickMarkPosition): Unit = extern 26 | @inline def numberOfTickMarks(): NSInteger = extern 27 | @inline def setNumberOfTickMarks(numberOfTickMarks: NSInteger): Unit = extern 28 | @inline def numberOfMajorTickMarks(): NSInteger = extern 29 | @inline def setNumberOfMajorTickMarks(numberOfMajorTickMarks: NSInteger): Unit = extern 30 | } 31 | 32 | 33 | @ObjCClass 34 | abstract class NSLevelIndicatorClass extends NSObjectClass { 35 | } 36 | 37 | object NSLevelIndicator extends NSLevelIndicatorClass { 38 | override type InstanceType = NSLevelIndicator 39 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSObjectController.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scala.language.experimental.macros 5 | import scalanative.native._ 6 | import objc._ 7 | import cocoa.foundation._ 8 | 9 | @ObjC 10 | class NSObjectController[T<:NSObject] extends NSController { 11 | @inline def initWithContent_(content: id): NSObjectController[T] = extern 12 | @inline def prepareContent(): Unit = extern 13 | @inline def newObject(): id = extern 14 | @inline def addObject_(`object`: id): Unit = extern 15 | @inline def removeObject_(`object`: id): Unit = extern 16 | @inline def add_(sender: id): Unit = extern 17 | @inline def remove_(sender: id): Unit = extern 18 | @inline def validateUserInterfaceItem_(item: id): BOOL = extern 19 | @inline def content(): id = extern 20 | @inline def setContent_(content: id): Unit = extern 21 | @inline def selection(): id = extern 22 | @inline def selectedObjects(): NSArray[T] = extern 23 | @inline def automaticallyPreparesContent(): BOOL = extern 24 | @inline def setAutomaticallyPreparesContent_(automaticallyPreparesContent: BOOL): Unit = extern 25 | @inline def objectClass(): id = extern 26 | @inline def setObjectClass_(objectClass: id): Unit = extern 27 | @inline def isEditable(): BOOL = extern 28 | @inline def setEditable_(editable: BOOL): Unit = extern 29 | @inline def canAdd(): BOOL = extern 30 | @inline def canRemove(): BOOL = extern 31 | // @inline def fetchWithRequest_merge_error_(fetchRequest: NSFetchRequest, merge: BOOL, error: NSError): BOOL = extern 32 | @inline def fetch_(sender: id): Unit = extern 33 | // @inline def defaultFetchRequest(): NSFetchRequest = extern 34 | // @inline def managedObjectContext(): NSManagedObjectContext = extern 35 | // @inline def setManagedObjectContext_(managedObjectContext: NSManagedObjectContext): Unit = extern 36 | @inline def entityName(): NSString = extern 37 | @inline def setEntityName_(entityName: NSString): Unit = extern 38 | // @inline def fetchPredicate(): NSPredicate = extern 39 | // @inline def setFetchPredicate_(fetchPredicate: NSPredicate): Unit = extern 40 | @inline def usesLazyFetching(): BOOL = extern 41 | @inline def setUsesLazyFetching_(usesLazyFetching: BOOL): Unit = extern 42 | } 43 | 44 | @ObjCClass 45 | abstract class NSObjectControllerClass extends NSControllerClass { 46 | } 47 | 48 | object NSObjectController extends NSObjectControllerClass { 49 | override type InstanceType = NSObjectController[_] 50 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTableCellView.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scalanative.native._ 5 | 6 | @ObjC 7 | class NSTableCellView extends NSView { 8 | def textField: NSTextField = extern 9 | } 10 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTableColumn.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSCoding, NSInteger, NSObject, NSObjectClass, NSString, id} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | 9 | 10 | @ObjC 11 | class NSTableColumn extends NSObject with NSCoding { //with NSUserInterfaceItemIdentification { 12 | @inline def initWithIdentifier(identifier: NSString): NSTableColumn = extern 13 | @inline def sizeToFit(): Unit = extern 14 | @inline def identifier(): NSString = extern 15 | @inline def setIdentifier(identifier: NSString): Unit = extern 16 | @inline def tableView(): NSTableView = extern 17 | @inline def setTableView(tableView: NSTableView): Unit = extern 18 | // @inline def width(): CGFloat = extern 19 | // @inline def setWidth(width: CGFloat): Unit = extern 20 | // @inline def minWidth(): CGFloat = extern 21 | // @inline def setMinWidth(minWidth: CGFloat): Unit = extern 22 | // @inline def maxWidth(): CGFloat = extern 23 | // @inline def setMaxWidth(maxWidth: CGFloat): Unit = extern 24 | @inline def title(): NSString = extern 25 | @inline def setTitle(title: NSString): Unit = extern 26 | // @inline def headerCell(): NSTableHeaderCell = extern 27 | // @inline def setHeaderCell(headerCell: NSTableHeaderCell): Unit = extern 28 | @inline def isEditable(): BOOL = extern 29 | @inline def setEditable(editable: BOOL): Unit = extern 30 | // @inline def sortDescriptorPrototype(): NSSortDescriptor = extern 31 | // @inline def setSortDescriptorPrototype(sortDescriptorPrototype: NSSortDescriptor): Unit = extern 32 | // @inline def resizingMask(): NSTableColumnResizingOptions = extern 33 | // @inline def setResizingMask(resizingMask: NSTableColumnResizingOptions): Unit = extern 34 | @inline def headerToolTip(): NSString = extern 35 | @inline def setHeaderToolTip(headerToolTip: NSString): Unit = extern 36 | @inline def isHidden(): BOOL = extern 37 | @inline def setHidden(hidden: BOOL): Unit = extern 38 | @inline def setResizable(flag: BOOL): Unit = extern 39 | @inline def isResizable(): BOOL = extern 40 | @inline def dataCellForRow(row: NSInteger): id = extern 41 | @inline def dataCell(): id = extern 42 | @inline def setDataCell(dataCell: id): Unit = extern 43 | } 44 | 45 | @ObjCClass 46 | abstract class NSTableColumnClass extends NSObjectClass { 47 | } 48 | 49 | object NSTableColumn extends NSTableColumnClass { 50 | override type InstanceType = NSTableColumn 51 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTableRowView.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSInteger, NSObjectClass, NSRect, id} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | 9 | 10 | @ObjC 11 | class NSTableRowView extends NSView { //with NSAccessibilityRow { 12 | @inline def drawBackgroundInRect(dirtyRect: NSRect): Unit = extern 13 | @inline def drawSelectionInRect(dirtyRect: NSRect): Unit = extern 14 | @inline def drawSeparatorInRect(dirtyRect: NSRect): Unit = extern 15 | @inline def drawDraggingDestinationFeedbackInRect(dirtyRect: NSRect): Unit = extern 16 | @inline def viewAtColumn(column: NSInteger): id = extern 17 | @inline def selectionHighlightStyle(): NSTableViewSelectionHighlightStyle = extern 18 | @inline def setSelectionHighlightStyle(selectionHighlightStyle: NSTableViewSelectionHighlightStyle): Unit = extern 19 | @inline def isEmphasized(): BOOL = extern 20 | @inline def setEmphasized(emphasized: BOOL): Unit = extern 21 | @inline def isGroupRowStyle(): BOOL = extern 22 | @inline def setGroupRowStyle(groupRowStyle: BOOL): Unit = extern 23 | @inline def isSelected(): BOOL = extern 24 | @inline def setSelected(selected: BOOL): Unit = extern 25 | @inline def isPreviousRowSelected(): BOOL = extern 26 | @inline def setPreviousRowSelected(previousRowSelected: BOOL): Unit = extern 27 | @inline def isNextRowSelected(): BOOL = extern 28 | @inline def setNextRowSelected(nextRowSelected: BOOL): Unit = extern 29 | @inline def isFloating(): BOOL = extern 30 | @inline def setFloating(floating: BOOL): Unit = extern 31 | @inline def isTargetForDropOperation(): BOOL = extern 32 | @inline def setTargetForDropOperation(targetForDropOperation: BOOL): Unit = extern 33 | @inline def draggingDestinationFeedbackStyle(): NSTableViewDraggingDestinationFeedbackStyle = extern 34 | @inline def setDraggingDestinationFeedbackStyle(draggingDestinationFeedbackStyle: NSTableViewDraggingDestinationFeedbackStyle): Unit = extern 35 | // @inline def indentationForDropOperation(): CGFloat = extern 36 | // @inline def setIndentationForDropOperation(indentationForDropOperation: CGFloat): Unit = extern 37 | // @inline def interiorBackgroundStyle(): NSBackgroundStyle = extern 38 | // @inline def backgroundColor(): NSColor = extern 39 | // @inline def setBackgroundColor(backgroundColor: NSColor): Unit = extern 40 | @inline def numberOfColumns(): NSInteger = extern 41 | } 42 | 43 | 44 | @ObjCClass 45 | abstract class NSTableRowViewClass extends NSObjectClass { 46 | } 47 | 48 | object NSTableRowView extends NSTableRowViewClass { 49 | override type InstanceType = NSTableRowView 50 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTableViewDataSource.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSArray, NSInteger, NSObject, NSPoint, NSString, NSURL, id} 5 | import de.surfice.smacrotools.debug 6 | 7 | import scalanative.native._ 8 | 9 | @ObjC 10 | trait NSTableViewDataSource extends NSObject { 11 | def numberOfRowsInTableView(tableView: NSTableView): NSInteger 12 | def tableView_objectValueForTableColumn_row_(tableView: NSTableView, objectValueForTableColumn: NSTableColumn, row: NSInteger): NSObject = extern 13 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn, row: NSInteger): id = extern 14 | // @inline def tableView(tableView: NSTableView, `object`: id, tableColumn: NSTableColumn, row: NSInteger): Unit = extern 15 | // @inline def tableView(tableView: NSTableView, oldDescriptors: NSSortDescriptor): Unit = extern 16 | // @inline def tableView(tableView: NSTableView, row: NSInteger): id[NSPasteboardWriting] = extern 17 | // @inline def tableView(tableView: NSTableView, session: NSDraggingSession, screenPoint: NSPoint, rowIndexes: NSIndexSet): Unit = extern 18 | // @inline def tableView(tableView: NSTableView, session: NSDraggingSession, screenPoint: NSPoint, operation: NSDragOperation): Unit = extern 19 | // @inline def tableView(tableView: NSTableView, draggingInfo: id): Unit = extern 20 | // @inline def tableView(tableView: NSTableView, rowIndexes: NSIndexSet, pboard: NSPasteboard): BOOL = extern 21 | // @inline def tableView(tableView: NSTableView, info: id, row: NSInteger, dropOperation: NSTableViewDropOperation): NSDragOperation = extern 22 | // @inline def tableView(tableView: NSTableView, info: id, row: NSInteger, dropOperation: NSTableViewDropOperation): BOOL = extern 23 | // @inline def tableView(tableView: NSTableView, dropDestination: NSURL, indexSet: NSIndexSet): NSArray[NSString] = extern 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTableViewDelegate.scala_: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSArray, NSInteger, NSNotification, NSString, id} 5 | 6 | import scalanative.native._ 7 | 8 | @ObjC 9 | trait NSTableViewDelegate extends NSControlTextEditingDelegate { 10 | @inline def tableView_viewForTableColumn_row_(tableView: NSTableView, column: NSTableColumn, row: NSInteger): NSView = extern 11 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn, row: NSInteger): NSView = extern 12 | // @inline def tableView(tableView: NSTableView, row: NSInteger): NSTableRowView = extern 13 | // @inline def tableView(tableView: NSTableView, rowView: NSTableRowView, row: NSInteger): Unit = extern 14 | // @inline def tableView(tableView: NSTableView, rowView: NSTableRowView, row: NSInteger): Unit = extern 15 | // @inline def tableView(tableView: NSTableView, cell: id, tableColumn: NSTableColumn, row: NSInteger): Unit = extern 16 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn, row: NSInteger): BOOL = extern 17 | // @inline def tableView(tableView: NSTableView, cell: NSCell, rect: NSRectPointer, tableColumn: NSTableColumn, row: NSInteger, mouseLocation: NSPoint): NSString = extern 18 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn, row: NSInteger): BOOL = extern 19 | // @inline def tableView(tableView: NSTableView, cell: NSCell, tableColumn: NSTableColumn, row: NSInteger): BOOL = extern 20 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn, row: NSInteger): NSCell = extern 21 | // @inline def selectionShouldChangeInTableView(tableView: NSTableView): BOOL = extern 22 | // @inline def tableView(tableView: NSTableView, row: NSInteger): BOOL = extern 23 | // @inline def tableView(tableView: NSTableView, proposedSelectionIndexes: NSIndexSet): NSIndexSet = extern 24 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn): BOOL = extern 25 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn): Unit = extern 26 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn): Unit = extern 27 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn): Unit = extern 28 | // @inline def tableView(tableView: NSTableView, row: NSInteger): CGFloat = extern 29 | // @inline def tableView(tableView: NSTableView, tableColumn: NSTableColumn, row: NSInteger): NSString = extern 30 | // @inline def tableView(tableView: NSTableView, startRow: NSInteger, endRow: NSInteger, searchString: NSString): NSInteger = extern 31 | // @inline def tableView(tableView: NSTableView, event: NSEvent, searchString: NSString): BOOL = extern 32 | // @inline def tableView(tableView: NSTableView, row: NSInteger): BOOL = extern 33 | // @inline def tableView(tableView: NSTableView, column: NSInteger): CGFloat = extern 34 | // @inline def tableView(tableView: NSTableView, columnIndex: NSInteger, newColumnIndex: NSInteger): BOOL = extern 35 | // @inline def tableView(tableView: NSTableView, row: NSInteger, edge: NSTableRowActionEdge): NSArray[NSTableViewRowAction] = extern 36 | @inline def tableViewSelectionDidChange(notification: NSNotification): Unit = extern 37 | // @inline def tableViewColumnDidMove(notification: NSNotification): Unit = extern 38 | // @inline def tableViewColumnDidResize(notification: NSNotification): Unit = extern 39 | // @inline def tableViewSelectionIsChanging(notification: NSNotification): Unit = extern 40 | } 41 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTextDelegate.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scalanative.native._ 5 | import objc._ 6 | import cocoa.foundation.{BOOL, NSNotification, NSObject} 7 | 8 | 9 | @ObjC 10 | trait NSTextDelegate extends NSObject { 11 | @inline def textShouldBeginEditing_(textObject: NSText): BOOL = extern 12 | @inline def textShouldEndEditing_(textObject: NSText): BOOL = extern 13 | @inline def textDidBeginEditing_(notification: NSNotification): Unit = extern 14 | @inline def textDidEndEditing_(notification: NSNotification): Unit = extern 15 | @inline def textDidChange_(notification: NSNotification): Unit = extern 16 | } 17 | 18 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTextField.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import scalanative.native._ 5 | import cocoa.foundation.{BOOL, NSInteger, NSNotification, NSObjectClass, NSString, id} 6 | 7 | import objc._ 8 | 9 | @ObjC 10 | class NSTextField extends NSControl { //with NSUserInterfaceValidations with NSAccessibilityNavigableStaticText { 11 | @inline def selectText_(sender: id): Unit = extern 12 | @inline def textShouldBeginEditing_(textObject: NSText): BOOL = extern 13 | @inline def textShouldEndEditing_(textObject: NSText): BOOL = extern 14 | @inline def textDidBeginEditing_(notification: NSNotification): Unit = extern 15 | @inline def textDidEndEditing_(notification: NSNotification): Unit = extern 16 | @inline def textDidChange_(notification: NSNotification): Unit = extern 17 | @inline def placeholderString(): NSString = extern 18 | @inline def setPlaceholderString_(placeholderString: NSString): Unit = extern 19 | // @inline def placeholderAttributedString(): NSAttributedString = extern 20 | // @inline def setPlaceholderAttributedString_(placeholderAttributedString: NSAttributedString): Unit = extern 21 | // @inline def backgroundColor(): NSColor = extern 22 | // @inline def setBackgroundColor_(backgroundColor: NSColor): Unit = extern 23 | @inline def drawsBackground(): BOOL = extern 24 | @inline def setDrawsBackground_(drawsBackground: BOOL): Unit = extern 25 | // @inline def textColor(): NSColor = extern 26 | // @inline def setTextColor_(textColor: NSColor): Unit = extern 27 | @inline def isBordered(): BOOL = extern 28 | @inline def setBordered_(bordered: BOOL): Unit = extern 29 | @inline def isBezeled(): BOOL = extern 30 | @inline def setBezeled_(bezeled: BOOL): Unit = extern 31 | @inline def isEditable(): BOOL = extern 32 | @inline def setEditable_(editable: BOOL): Unit = extern 33 | @inline def isSelectable(): BOOL = extern 34 | @inline def setSelectable_(selectable: BOOL): Unit = extern 35 | @inline def delegate(): NSTextFieldDelegate = extern 36 | @inline def setDelegate_(delegate: NSTextFieldDelegate): Unit = extern 37 | // @inline def bezelStyle(): NSTextFieldBezelStyle = extern 38 | // @inline def setBezelStyle_(bezelStyle: NSTextFieldBezelStyle): Unit = extern 39 | @inline def preferredMaxLayoutWidth(): CGFloat = extern 40 | @inline def setPreferredMaxLayoutWidth_(preferredMaxLayoutWidth: CGFloat): Unit = extern 41 | @inline def maximumNumberOfLines(): NSInteger = extern 42 | @inline def setMaximumNumberOfLines_(maximumNumberOfLines: NSInteger): Unit = extern 43 | @inline def allowsDefaultTighteningForTruncation(): BOOL = extern 44 | @inline def setAllowsDefaultTighteningForTruncation_(allowsDefaultTighteningForTruncation: BOOL): Unit = extern 45 | @inline def isAutomaticTextCompletionEnabled(): BOOL = extern 46 | @inline def setAutomaticTextCompletionEnabled_(automaticTextCompletionEnabled: BOOL): Unit = extern 47 | @inline def allowsCharacterPickerTouchBarItem(): BOOL = extern 48 | @inline def setAllowsCharacterPickerTouchBarItem_(allowsCharacterPickerTouchBarItem: BOOL): Unit = extern 49 | @inline def allowsEditingTextAttributes(): BOOL = extern 50 | @inline def setAllowsEditingTextAttributes_(allowsEditingTextAttributes: BOOL): Unit = extern 51 | @inline def importsGraphics(): BOOL = extern 52 | @inline def setImportsGraphics_(importsGraphics: BOOL): Unit = extern 53 | @inline def setTitleWithMnemonic_(stringWithAmpersand: NSString): Unit = extern 54 | } 55 | @ObjCClass 56 | abstract class NSTextFieldClass extends NSObjectClass { 57 | @inline def labelWithString_(stringValue: NSString): NSTextField = extern 58 | @inline def wrappingLabelWithString_(stringValue: NSString): NSTextField = extern 59 | // @inline def labelWithAttributedString_(attributedStringValue: NSAttributedString): NSTextField = extern 60 | @inline def textFieldWithString_(stringValue: NSString): NSTextField = extern 61 | } 62 | 63 | object NSTextField extends NSTextFieldClass { 64 | override type InstanceType = NSTextField 65 | } -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTextFieldDelegate.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.appkit 3 | 4 | import cocoa.foundation.{BOOL, NSUInteger} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | 11 | @ObjC 12 | trait NSTextFieldDelegate extends NSControlTextEditingDelegate { 13 | // @inline def textField_textView_selectedRange_(textField: NSTextField, textView: NSTextView, selectedRange: NSRange): NSArray = extern 14 | // @inline def textField_textView_candidates_selectedRange_(textField: NSTextField, textView: NSTextView, candidates: NSTextCheckingResult, selectedRange: NSRange): NSArray[NSTextCheckingResult] = extern 15 | // @inline def textField_textView_index_(textField: NSTextField, textView: NSTextView, index: NSUInteger): BOOL = extern 16 | } 17 | -------------------------------------------------------------------------------- /appkit/src/main/scala/cocoa/appkit/NSTextViewDelegate.scala_: -------------------------------------------------------------------------------- 1 | package cocoa.appkit 2 | 3 | import scalanative.native._ 4 | import cocoa.foundation.{BOOL, NSArray, NSDictionary, NSInteger, NSNotification, NSObject, NSRange, NSRect, NSString, NSUInteger, NSURL, NSValue} 5 | import objc.runtime.{SEL, id} 6 | 7 | import scala.language.experimental.macros 8 | 9 | 10 | @ObjC 11 | trait NSTextViewDelegate { //extends NSTextDelegate { 12 | @inline def textView(textView: NSTextView, link: id, charIndex: NSUInteger): BOOL = extern 13 | // @inline def textView(textView: NSTextView, cell: id, cellFrame: NSRect, charIndex: NSUInteger): Unit = extern 14 | // @inline def textView(textView: NSTextView, cell: id, cellFrame: NSRect, charIndex: NSUInteger): Unit = extern 15 | // @inline def textView(view: NSTextView, cell: id, rect: NSRect, event: NSEvent, charIndex: NSUInteger): Unit = extern 16 | // @inline def textView(view: NSTextView, cell: id, charIndex: NSUInteger): NSArray[NSString] = extern 17 | // @inline def textView(view: NSTextView, cell: id, charIndex: NSUInteger, pboard: NSPasteboard, `type`: NSString): BOOL = extern 18 | @inline def textView(textView: NSTextView, oldSelectedCharRange: NSRange, newSelectedCharRange: NSRange): NSRange = extern 19 | @inline def textView(textView: NSTextView, oldSelectedCharRanges: NSValue, newSelectedCharRanges: NSValue): NSArray[NSValue] = extern 20 | @inline def textView(textView: NSTextView, affectedRanges: NSValue, replacementStrings: NSString): BOOL = extern 21 | @inline def textView(textView: NSTextView, oldTypingAttributes: id, newTypingAttributes: id): NSDictionary[NSString, NSObject] = extern 22 | @inline def textViewDidChangeSelection(notification: NSNotification): Unit = extern 23 | @inline def textViewDidChangeTypingAttributes(notification: NSNotification): Unit = extern 24 | @inline def textView(textView: NSTextView, tooltip: NSString, characterIndex: NSUInteger): NSString = extern 25 | @inline def textView(textView: NSTextView, words: NSString, charRange: NSRange, index: NSInteger): NSArray[NSString] = extern 26 | @inline def textView(textView: NSTextView, affectedCharRange: NSRange, replacementString: NSString): BOOL = extern 27 | @inline def textView(textView: NSTextView, commandSelector: SEL): BOOL = extern 28 | @inline def textView(textView: NSTextView, value: NSInteger, affectedCharRange: NSRange): NSInteger = extern 29 | // @inline def textView(view: NSTextView, menu: NSMenu, event: NSEvent, charIndex: NSUInteger): NSMenu = extern 30 | // @inline def textView(view: NSTextView, range: NSRange, options: id, checkingTypes: NSTextCheckingTypes): NSDictionary[NSString, id] = extern 31 | // @inline def textView(view: NSTextView, range: NSRange, checkingTypes: NSTextCheckingTypes, options: id, results: NSTextCheckingResult, orthography: NSOrthography, wordCount: NSInteger): NSArray[NSTextCheckingResult] = extern 32 | // @inline def textView(textView: NSTextView, textAttachment: NSTextAttachment, charIndex: NSUInteger): NSURL = extern 33 | // @inline def textView(textView: NSTextView, servicePicker: NSSharingServicePicker, items: NSArray): NSSharingServicePicker = extern 34 | // @inline def undoManagerForTextView(view: NSTextView): NSUndoManager = extern 35 | // @inline def textView(textView: NSTextView, link: id): BOOL = extern 36 | @inline def textView(textView: NSTextView, cell: id, cellFrame: NSRect): Unit = extern 37 | @inline def textView(view: NSTextView, cell: id, rect: NSRect, event: NSEvent): Unit = extern 38 | } 39 | -------------------------------------------------------------------------------- /build.sbt: -------------------------------------------------------------------------------- 1 | organization in ThisBuild := "de.surfice" 2 | 3 | version in ThisBuild := "0.0.2-SNAPSHOT" 4 | 5 | scalaVersion in ThisBuild := "2.11.12" 6 | 7 | val Version = new { 8 | val slogging = "0.5.3" 9 | val objc = "0.0.5-SNAPSHOT" 10 | val utest = "0.6.3" 11 | } 12 | 13 | 14 | lazy val commonSettings = Seq( 15 | scalacOptions ++= Seq("-deprecation","-unchecked","-feature","-language:implicitConversions","-Xlint"), 16 | addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full), 17 | libraryDependencies ++= Seq( 18 | "de.surfice" %%% "scalanative-interop-objc" % Version.objc, 19 | "com.lihaoyi" %%% "utest" % Version.utest % "test" 20 | ), 21 | testFrameworks += new TestFramework("utest.runner.Framework") 22 | ) 23 | 24 | lazy val nativeSettings = Seq( 25 | nativeCompileOptions ++= Seq("-g"), 26 | nativeLinkStubs := true 27 | ) 28 | 29 | lazy val cocoa = project.in(file(".")) 30 | .aggregate(foundation,appkit,coredata) 31 | .settings(dontPublish:_*) 32 | .settings( 33 | name := "sncocoa" 34 | ) 35 | 36 | lazy val foundation = project 37 | .enablePlugins(ScalaNativePlugin) 38 | .settings(commonSettings ++ nativeSettings ++ publishingSettings:_*) 39 | .settings( 40 | name := "scalanative-cocoa-foundation" 41 | ) 42 | 43 | lazy val appkit = project 44 | .enablePlugins(ScalaNativePlugin) 45 | .dependsOn(foundation) 46 | .settings(commonSettings ++ nativeSettings ++ publishingSettings:_*) 47 | .settings( 48 | name := "scalanative-cocoa-appkit" 49 | ) 50 | 51 | lazy val uikit = project 52 | .enablePlugins(ScalaNativePlugin) 53 | .dependsOn(foundation) 54 | .settings(commonSettings ++ nativeSettings ++ publishingSettings:_*) 55 | .settings( 56 | name := "scalanative-cocoa-uikit" 57 | ) 58 | 59 | lazy val coredata = project 60 | .enablePlugins(ScalaNativePlugin) 61 | .dependsOn(foundation) 62 | .settings(commonSettings ++ nativeSettings ++ publishingSettings:_*) 63 | .settings( 64 | name := "scalanative-cocoa-coredata" 65 | ) 66 | 67 | lazy val test = project 68 | .enablePlugins(ScalaNativePlugin) 69 | .dependsOn(appkit) 70 | .settings(commonSettings ++ nativeSettings ++ dontPublish:_*) 71 | .settings( 72 | nativeLinkingOptions ++= Seq( 73 | "-framework", "Foundation", 74 | "/Volumes/JKDATA/dev/scala-native/cocoa/util.o" 75 | ) 76 | ) 77 | 78 | lazy val dontPublish = Seq( 79 | publish := {}, 80 | publishLocal := {}, 81 | com.typesafe.sbt.pgp.PgpKeys.publishSigned := {}, 82 | com.typesafe.sbt.pgp.PgpKeys.publishLocalSigned := {}, 83 | publishArtifact := false, 84 | publishTo := Some(Resolver.file("Unused transient repository",file("target/unusedrepo"))) 85 | ) 86 | 87 | lazy val publishingSettings = Seq( 88 | publishMavenStyle := true, 89 | publishTo := { 90 | val nexus = "https://oss.sonatype.org/" 91 | if (isSnapshot.value) 92 | Some("snapshots" at nexus + "content/repositories/snapshots") 93 | else 94 | Some("releases" at nexus + "service/local/staging/deploy/maven2") 95 | }, 96 | pomExtra := ( 97 | https://github.com/jokade/scalantive-cocoa 98 | 99 | 100 | MIT License 101 | http://www.opensource.org/licenses/mit-license.php 102 | 103 | 104 | 105 | git@github.com:jokade/scalantive-cocoa 106 | scm:git:git@github.com:jokade/scalantive-cocoa.git 107 | 108 | 109 | 110 | jokade 111 | Johannes Kastner 112 | jokade@karchedon.de 113 | 114 | 115 | ) 116 | ) 117 | 118 | -------------------------------------------------------------------------------- /coredata/src/main/scala/cocoa/coredata/NSEntityDescription.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.coredata 3 | 4 | import cocoa.foundation.{BOOL, NSArray, NSCoding, NSCopying, NSData, NSDictionary, NSFastEnumeration, NSObject, NSObjectClass, NSString} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | 11 | @ObjC 12 | class NSEntityDescription extends NSObject with NSCoding with NSCopying with NSFastEnumeration { 13 | // @inline def relationshipsWithDestinationEntity_(entity: NSEntityDescription): NSArray[NSRelationshipDescription] = extern 14 | @inline def isKindOfEntity_(entity: NSEntityDescription): BOOL = extern 15 | @inline def managedObjectModel(): NSManagedObjectModel = extern 16 | @inline def managedObjectClassName(): NSString = extern 17 | @inline def setManagedObjectClassName_(managedObjectClassName: NSString): Unit = extern 18 | @inline def name(): NSString = extern 19 | @inline def setName_(name: NSString): Unit = extern 20 | @inline def isAbstract(): BOOL = extern 21 | @inline def setAbstract_(flag: BOOL): Unit = extern 22 | @inline def subentitiesByName(): NSDictionary[NSString, NSEntityDescription] = extern 23 | @inline def subentities(): NSArray[NSEntityDescription] = extern 24 | @inline def setSubentities_(subentities: NSArray[NSEntityDescription]): Unit = extern 25 | @inline def superentity(): NSEntityDescription = extern 26 | // @inline def propertiesByName(): NSDictionary[NSString, NSPropertyDescription] = extern 27 | // @inline def properties(): NSArray[NSPropertyDescription] = extern 28 | // @inline def setProperties_(properties: NSArray[NSPropertyDescription]): Unit = extern 29 | @inline def userInfo(): NSDictionary[NSObject,NSObject] = extern 30 | @inline def setUserInfo_(userInfo: NSDictionary[NSObject,NSObject]): Unit = extern 31 | // @inline def attributesByName(): NSDictionary[NSString, NSAttributeDescription] = extern 32 | // @inline def relationshipsByName(): NSDictionary[NSString, NSRelationshipDescription] = extern 33 | @inline def versionHash(): NSData = extern 34 | @inline def versionHashModifier(): NSString = extern 35 | @inline def setVersionHashModifier_(versionHashModifier: NSString): Unit = extern 36 | @inline def renamingIdentifier(): NSString = extern 37 | @inline def setRenamingIdentifier_(renamingIdentifier: NSString): Unit = extern 38 | // @inline def indexes(): NSArray[NSFetchIndexDescription] = extern 39 | // @inline def setIndexes_(indexes: NSArray[NSFetchIndexDescription]): Unit = extern 40 | // @inline def uniquenessConstraints(): NSArray[NSArray] = extern 41 | // @inline def setUniquenessConstraints_(uniquenessConstraints: NSArray[NSArray]): Unit = extern 42 | // @inline def compoundIndexes(): NSArray[NSArray] = extern 43 | // @inline def setCompoundIndexes_(compoundIndexes: NSArray[NSArray]): Unit = extern 44 | // @inline def coreSpotlightDisplayNameExpression(): NSExpression = extern 45 | // @inline def setCoreSpotlightDisplayNameExpression_(coreSpotlightDisplayNameExpression: NSExpression): Unit = extern 46 | } 47 | 48 | @ObjCClass 49 | abstract class NSEntityDescriptionClass extends NSObjectClass { 50 | @inline def entityForName_inManagedObjectContext_(entityName: NSString, context: NSManagedObjectContext): NSEntityDescription = extern 51 | @inline def insertNewObjectForEntityForName_inManagedObjectContext_(entityName: NSString, context: NSManagedObjectContext): NSManagedObject = extern 52 | } 53 | 54 | object NSEntityDescription extends NSEntityDescriptionClass { 55 | override type InstanceType = NSEntityDescription 56 | } -------------------------------------------------------------------------------- /coredata/src/main/scala/cocoa/coredata/NSManagedObject.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.coredata 3 | 4 | import cocoa.foundation._ 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | @ObjC 11 | class NSManagedObject extends NSObject { 12 | // @inline def initWithEntity_context_(entity: NSEntityDescription, context: NSManagedObjectContext): NSManagedObject = extern 13 | @inline def initWithContext_(moc: NSManagedObjectContext): NSManagedObject = extern 14 | @inline def hasFaultForRelationshipNamed_(key: NSString): BOOL = extern 15 | @inline def objectIDsForRelationshipNamed_(key: NSString): NSArray[NSManagedObjectID] = extern 16 | @inline def willAccessValueForKey_(key: NSString): Unit = extern 17 | @inline def didAccessValueForKey_(key: NSString): Unit = extern 18 | @inline def willChangeValueForKey_(key: NSString): Unit = extern 19 | @inline def didChangeValueForKey_(key: NSString): Unit = extern 20 | // @inline def willChangeValueForKey_inMutationKind_inObjects_(inKey: NSString, inMutationKind: NSKeyValueSetMutationKind, inObjects: NSSet): Unit = extern 21 | // @inline def didChangeValueForKey_inMutationKind_inObjects_(inKey: NSString, inMutationKind: NSKeyValueSetMutationKind, inObjects: NSSet): Unit = extern 22 | @inline def awakeFromFetch(): Unit = extern 23 | @inline def awakeFromInsert(): Unit = extern 24 | @inline def awakeFromSnapshotEvents_(flags: NSSnapshotEventType): Unit = extern 25 | @inline def prepareForDeletion(): Unit = extern 26 | @inline def willSave(): Unit = extern 27 | @inline def didSave(): Unit = extern 28 | @inline def willTurnIntoFault(): Unit = extern 29 | @inline def didTurnIntoFault(): Unit = extern 30 | @inline def valueForKey_(key: NSString): id = extern 31 | @inline def setValue_key_(value: id, key: NSString): Unit = extern 32 | @inline def primitiveValueForKey_(key: NSString): id = extern 33 | @inline def setPrimitiveValue_key_(value: id, key: NSString): Unit = extern 34 | @inline def committedValuesForKeys_(keys: NSString): NSDictionary[NSString, NSObject] = extern 35 | @inline def changedValues(): NSDictionary[NSString, NSObject] = extern 36 | @inline def changedValuesForCurrentEvent(): NSDictionary[NSString, NSObject] = extern 37 | @inline def validateValue_key_error_(value: id, key: NSString, error: NSError): BOOL = extern 38 | @inline def validateForDelete_(error: NSError): BOOL = extern 39 | @inline def validateForInsert_(error: NSError): BOOL = extern 40 | @inline def validateForUpdate_(error: NSError): BOOL = extern 41 | @inline def setObservationInfo_(inObservationInfo: Ptr[Byte]): Unit = extern 42 | @inline def observationInfo(): Ptr[Byte] = extern 43 | @inline def managedObjectContext(): NSManagedObjectContext = extern 44 | // @inline def entity(): NSEntityDescription = extern 45 | @inline def objectID(): NSManagedObjectID = extern 46 | @inline def isInserted(): BOOL = extern 47 | @inline def isUpdated(): BOOL = extern 48 | @inline def isDeleted(): BOOL = extern 49 | @inline def hasChanges(): BOOL = extern 50 | @inline def hasPersistentChangedValues(): BOOL = extern 51 | @inline def isFault(): BOOL = extern 52 | @inline def faultingState(): NSUInteger = extern 53 | } 54 | 55 | 56 | @ObjCClass 57 | abstract class NSManagedObjectClass extends NSObjectClass { 58 | // @inline def entity(): NSEntityDescription = extern 59 | // @inline def fetchRequest(): NSFetchRequest = extern 60 | @inline def contextShouldIgnoreUnmodeledPropertyChanges(): BOOL = extern 61 | } 62 | 63 | object NSManagedObject extends NSManagedObjectClass { 64 | override type InstanceType = NSManagedObject 65 | } -------------------------------------------------------------------------------- /coredata/src/main/scala/cocoa/coredata/NSManagedObjectID.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.coredata 3 | 4 | import cocoa.foundation.{BOOL, NSCopying, NSObject, NSURL} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | @ObjC 11 | class NSManagedObjectID extends NSObject with NSCopying { 12 | @inline def URIRepresentation(): NSURL = extern 13 | // @inline def entity(): NSEntityDescription = extern 14 | // @inline def persistentStore(): NSPersistentStore = extern 15 | @inline def isTemporaryID(): BOOL = extern 16 | } 17 | -------------------------------------------------------------------------------- /coredata/src/main/scala/cocoa/coredata/NSManagedObjectModel.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.coredata 3 | 4 | import cocoa.foundation.{BOOL, NSArray, NSCoding, NSCopying, NSDictionary, NSFastEnumeration, NSObject, NSObjectClass, NSString, NSURL, id} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | 11 | @ObjC 12 | class NSManagedObjectModel extends NSObject with NSCoding with NSCopying with NSFastEnumeration { 13 | @inline def initWithContentsOfURL_(url: NSURL): NSManagedObjectModel = extern 14 | // @inline def entitiesForConfiguration_(configuration: NSString): NSArray[NSEntityDescription] = extern 15 | // @inline def setEntities_configuration_(entities: NSEntityDescription, configuration: NSString): Unit = extern 16 | // @inline def setFetchRequestTemplate_name_(fetchRequestTemplate: NSFetchRequest, name: NSString): Unit = extern 17 | // @inline def fetchRequestTemplateForName_(name: NSString): NSFetchRequest = extern 18 | // @inline def fetchRequestFromTemplateWithName_variables_(name: NSString, variables: id): NSFetchRequest = extern 19 | @inline def isConfiguration_metadata_(configuration: NSString, metadata: id): BOOL = extern 20 | // @inline def entitiesByName(): NSDictionary[NSString, NSEntityDescription] = extern 21 | // @inline def entities(): NSArray[NSEntityDescription] = extern 22 | // @inline def setEntities_(entities: NSArray[NSEntityDescription]): Unit = extern 23 | @inline def configurations(): NSArray[NSString] = extern 24 | @inline def localizationDictionary(): NSDictionary[NSString, NSString] = extern 25 | @inline def setLocalizationDictionary_(localizationDictionary: NSDictionary[NSString, NSString]): Unit = extern 26 | // @inline def fetchRequestTemplatesByName(): NSDictionary[NSString, NSFetchRequest] = extern 27 | // @inline def versionIdentifiers(): NSSet = extern 28 | // @inline def setVersionIdentifiers_(versionIdentifiers: NSSet): Unit = extern 29 | // @inline def entityVersionHashesByName(): NSDictionary[NSString, NSData] = extern 30 | } 31 | 32 | @ObjCClass 33 | abstract class NSManagedObjectModelClass extends NSObjectClass { 34 | // @inline def mergedModelFromBundles_(bundles: NSBundle): NSManagedObjectModel = extern 35 | @inline def modelByMergingModels_(models: NSManagedObjectModel): NSManagedObjectModel = extern 36 | // @inline def mergedModelFromBundles_metadata_(bundles: NSBundle, metadata: id): NSManagedObjectModel = extern 37 | @inline def modelByMergingModels_metadata_(models: NSManagedObjectModel, metadata: id): NSManagedObjectModel = extern 38 | } 39 | 40 | object NSManagedObjectModel extends NSManagedObjectModelClass { 41 | override type InstanceType = NSManagedObjectModel 42 | } -------------------------------------------------------------------------------- /coredata/src/main/scala/cocoa/coredata/NSPersistentContainer.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa.coredata 3 | 4 | import cocoa.foundation.{NSArray, NSError, NSObject, NSObjectClass, NSString, NSURL} 5 | 6 | import scala.language.experimental.macros 7 | import scalanative.native._ 8 | import objc._ 9 | 10 | 11 | @ObjC 12 | class NSPersistentContainer extends NSObject { 13 | @inline def initWithName_(name: NSString): NSPersistentContainer = extern 14 | @inline def initWithName_model_(name: NSString, model: NSManagedObjectModel): NSPersistentContainer = extern 15 | @inline def loadPersistentStoresWithCompletionHandler_(block: Block2[NSPersistentStoreDescription,NSError,_]): Unit = extern 16 | @inline def newBackgroundContext(): NSManagedObjectContext = extern 17 | @inline def performBackgroundTask_(block: Ptr[Byte]): Unit = extern 18 | @inline def name(): NSString = extern 19 | @inline def viewContext(): NSManagedObjectContext = extern 20 | @inline def managedObjectModel(): NSManagedObjectModel = extern 21 | // @inline def persistentStoreCoordinator(): NSPersistentStoreCoordinator = extern 22 | // @inline def persistentStoreDescriptions(): NSArray[NSPersistentStoreDescription] = extern 23 | // @inline def setPersistentStoreDescriptions_(persistentStoreDescriptions: NSArray[NSPersistentStoreDescription]): Unit = extern 24 | } 25 | 26 | @ObjCClass 27 | abstract class NSPersistentContainerClass extends NSObjectClass { 28 | @inline def persistentContainerWithName_(name: NSString): NSPersistentContainer = extern 29 | @inline def persistentContainerWithName_model_(name: NSString, model: NSManagedObjectModel): NSPersistentContainer = extern 30 | @inline def defaultDirectoryURL(): NSURL = extern 31 | } 32 | 33 | object NSPersistentContainer extends NSPersistentContainerClass { 34 | override type InstanceType = NSPersistentContainer 35 | 36 | /** 37 | * Creates a persistent container with the given name. 38 | * 39 | * @param name The name of the container. 40 | */ 41 | def apply(name: String): NSPersistentContainer = 42 | NSPersistentContainer.alloc().initWithName_(NSString(name)) 43 | 44 | /** 45 | * Creates a persistent container with the given name and model. 46 | * 47 | * @param name The name used by the persistent container 48 | * @param model The managed object model used by the persistent container. 49 | */ 50 | def apply(name: String, model: NSManagedObjectModel): NSPersistentContainer = 51 | NSPersistentContainer.alloc().initWithName_model_(NSString(name),model) 52 | 53 | // implicit final class Wrapper(val c: NSPersistentContainer) extends AnyVal { 54 | // @inline def loadStores(onComplete: CFunctionPtr2[Unit]): Unit = { 55 | // c.loadPersistentStoresWithCompletionHandler_(onComplete) 56 | // } 57 | // } 58 | } -------------------------------------------------------------------------------- /coredata/src/main/scala/cocoa/coredata/package.scala: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018. Distributed under the MIT License (see included LICENSE file). 2 | package cocoa 3 | 4 | import scalanative.native._ 5 | import cocoa.foundation.NSUInteger 6 | 7 | package object coredata { 8 | 9 | type NSManagedObjectContextConcurrencyType = NSUInteger 10 | object NSManagedObjectContextConcurrencyType { 11 | val NSPrivateQueueConcurrencyType :NSManagedObjectContextConcurrencyType = 1.toULong 12 | val NSMainQueueConcurrencyType :NSManagedObjectContextConcurrencyType = 2.toULong 13 | } 14 | 15 | type NSSnapshotEventType = NSUInteger 16 | object NSSnapshotEventType { 17 | val NSSnapshotEventUndoInsertion :NSSnapshotEventType = 1.toULong << 1 18 | val NSSnapshotEventUndoDeletion :NSSnapshotEventType = 1.toULong << 2 19 | val NSSnapshotEventUndoUpdate :NSSnapshotEventType = 1.toULong << 3 20 | val NSSnapshotEventRollback :NSSnapshotEventType = 1.toULong << 4 21 | val NSSnapshotEventRefresh :NSSnapshotEventType = 1.toULong << 5 22 | val NSSnapshotEventMergePolicy :NSSnapshotEventType = 1.toULong << 6 23 | } 24 | 25 | type NSPersistentStoreDescription = foundation.NSObject 26 | } 27 | -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem 'github-pages', group: :jekyll_plugins 4 | gem 'wdm', '>= 0.1.0' if Gem.win_platform? 5 | -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | repository: jokade/scalanative-cocoa 2 | 3 | output: web 4 | # this property is useful for conditional filtering of content that is separate from the PDF. 5 | 6 | topnav_title: SNCocoa 7 | # this appears on the top navigation bar next to the home button 8 | 9 | site_title: scalanative-cocoa documantetion 10 | # this appears in the html browser tab for the site title (seen mostly by search engines, not users) 11 | 12 | company_name: 13 | # this appears in the footer 14 | 15 | #github_editme_path: jokade/scalanative-cocoa/blob/master/docs/ 16 | # if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank. 17 | 18 | disqus_shortname: 19 | # if you're using disqus for comments, add the shortname here. if not, leave this value blank. 20 | 21 | google_analytics: 22 | # if you have google-analytics ID, put it in. if not, edit this value to blank. 23 | 24 | host: 127.0.0.1 25 | # the preview server used. Leave as is. 26 | 27 | port: 4000 28 | # the port where the preview is rendered. You can leave this as is unless you have other Jekyll builds using this same port that might cause conflicts. in that case, use another port such as 4006. 29 | 30 | exclude: 31 | - .idea/ 32 | - .gitignore 33 | # these are the files and directories that jekyll will exclude from the build 34 | 35 | feedback_subject_line: SNCocoa documentation 36 | 37 | feedback_email: jokade@karchedon.de 38 | # used as a contact email for the Feedback link in the top navigation bar 39 | 40 | feedback_disable: true 41 | # if you uncomment the previous line, the Feedback link gets removed 42 | 43 | # feedback_text: "Need help?" 44 | # if you uncomment the previous line, it changes the Feedback text 45 | 46 | # feedback_link: "http://helpy.io/" 47 | # if you uncomment the previous line, it changes where the feedback link points to 48 | 49 | highlighter: rouge 50 | # library used for syntax highlighting 51 | 52 | markdown: kramdown 53 | kramdown: 54 | input: GFM 55 | auto_ids: true 56 | hard_wrap: false 57 | syntax_highlighter: rouge 58 | 59 | # filter used to process markdown. note that kramdown differs from github-flavored markdown in some subtle ways 60 | 61 | collections: 62 | tooltips: 63 | output: false 64 | # collections are declared here. this renders the content in _tooltips and processes it, but doesn't output it as actual files in the output unless you change output to true 65 | 66 | defaults: 67 | - 68 | scope: 69 | path: "" 70 | type: "pages" 71 | values: 72 | layout: "page" 73 | comments: true 74 | search: true 75 | sidebar: home_sidebar 76 | topnav: topnav 77 | - 78 | scope: 79 | path: "" 80 | type: "tooltips" 81 | values: 82 | layout: "page" 83 | comments: true 84 | search: true 85 | tooltip: true 86 | 87 | - 88 | scope: 89 | path: "" 90 | type: "posts" 91 | values: 92 | layout: "post" 93 | comments: true 94 | search: true 95 | sidebar: home_sidebar 96 | topnav: topnav 97 | 98 | # these are defaults used for the frontmatter for these file types 99 | 100 | sidebars: 101 | - home_sidebar 102 | 103 | #- mydoc_sidebar 104 | #- product1_sidebar 105 | #- product2_sidebar 106 | #- other 107 | 108 | description: "Intended as a documentation theme based on Jekyll for technical writers documenting software and other technical products, this theme has all the elements you would need to handle multiple products with both multi-level sidebar navigation, tags, and other documentation features." 109 | # the description is used in the feed.xml file 110 | 111 | # needed for sitemap.xml file only 112 | url: jokade.github.io 113 | baseurl: /scalanative-cocoa 114 | -------------------------------------------------------------------------------- /docs/_data/alerts.yml: -------------------------------------------------------------------------------- 1 | tip: '