aboutsummaryrefslogtreecommitdiff
path: root/core/sys/darwin
diff options
context:
space:
mode:
authorColin Davidson <colrdavidson@gmail.com>2025-06-08 16:17:32 -0700
committerColin Davidson <colrdavidson@gmail.com>2025-06-08 16:17:32 -0700
commit04481e0fd289f854e35a84da909184140940bbf7 (patch)
tree97224c25709866edbf16a486fdbd30a4d736701a /core/sys/darwin
parentb1ed22d84f2aae617c90c60701e9f25345cab980 (diff)
parent7813e9fb378753bf110f0ad4b5cc85e7f16336d4 (diff)
Merge branch 'master' into macharena
Diffstat (limited to 'core/sys/darwin')
-rw-r--r--core/sys/darwin/Foundation/NSApplication.odin93
-rw-r--r--core/sys/darwin/Foundation/NSArray.odin46
-rw-r--r--core/sys/darwin/Foundation/NSMenu.odin621
-rw-r--r--core/sys/darwin/Foundation/NSMenuItem.odin460
-rw-r--r--core/sys/darwin/Foundation/NSWindow.odin104
-rw-r--r--core/sys/darwin/Foundation/objc_helper.odin136
-rw-r--r--core/sys/darwin/copyfile.odin67
-rw-r--r--core/sys/darwin/darwin.odin1
-rw-r--r--core/sys/darwin/sync.odin2
-rw-r--r--core/sys/darwin/xnu_system_call_wrappers.odin10
10 files changed, 1336 insertions, 204 deletions
diff --git a/core/sys/darwin/Foundation/NSApplication.odin b/core/sys/darwin/Foundation/NSApplication.odin
index 254da75ad..a5e9f2e24 100644
--- a/core/sys/darwin/Foundation/NSApplication.odin
+++ b/core/sys/darwin/Foundation/NSApplication.odin
@@ -82,7 +82,6 @@ Application_setActivationPolicy :: proc "c" (self: ^Application, activationPolic
// NOTE: this is technically deprecated but still actively used (Sokol, glfw, SDL, etc.)
// and has no clear alternative although `activate` is what Apple tells you to use,
// that does not work the same way.
-// @(deprecated="Use NSApplication method activate instead.")
@(objc_type=Application, objc_name="activateIgnoringOtherApps")
Application_activateIgnoringOtherApps :: proc "c" (self: ^Application, ignoreOtherApps: BOOL) {
msgSend(nil, self, "activateIgnoringOtherApps:", ignoreOtherApps)
@@ -99,7 +98,7 @@ Application_setTitle :: proc "c" (self: ^Application, title: ^String) {
}
@(objc_type=Application, objc_name="mainMenu")
-Window_mainMenu :: proc "c" (self: ^Application) -> ^Menu {
+Application_mainMenu :: proc "c" (self: ^Application) -> ^Menu {
return msgSend(^Menu, self, "mainMenu")
}
@@ -256,7 +255,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
return nil
}
if template.applicationWillFinishLaunching != nil {
- applicationWillFinishLaunching :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillFinishLaunching :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillFinishLaunching(notification)
@@ -264,7 +263,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillFinishLaunching:"), auto_cast applicationWillFinishLaunching, "v@:@")
}
if template.applicationDidFinishLaunching != nil {
- applicationDidFinishLaunching :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidFinishLaunching :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidFinishLaunching(notification)
@@ -272,7 +271,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidFinishLaunching:"), auto_cast applicationDidFinishLaunching, "v@:@")
}
if template.applicationWillBecomeActive != nil {
- applicationWillBecomeActive :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillBecomeActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillBecomeActive(notification)
@@ -280,7 +279,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillBecomeActive:"), auto_cast applicationWillBecomeActive, "v@:@")
}
if template.applicationDidBecomeActive != nil {
- applicationDidBecomeActive :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidBecomeActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidBecomeActive(notification)
@@ -288,7 +287,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidBecomeActive:"), auto_cast applicationDidBecomeActive, "v@:@")
}
if template.applicationWillResignActive != nil {
- applicationWillResignActive :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillResignActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillResignActive(notification)
@@ -296,7 +295,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillResignActive:"), auto_cast applicationWillResignActive, "v@:@")
}
if template.applicationDidResignActive != nil {
- applicationDidResignActive :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidResignActive :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidResignActive(notification)
@@ -304,7 +303,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidResignActive:"), auto_cast applicationDidResignActive, "v@:@")
}
if template.applicationShouldTerminate != nil {
- applicationShouldTerminate :: proc "c" (self: id, sender: ^Application) -> ApplicationTerminateReply {
+ applicationShouldTerminate :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> ApplicationTerminateReply {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldTerminate(sender)
@@ -312,7 +311,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldTerminate:"), auto_cast applicationShouldTerminate, _UINTEGER_ENCODING+"@:@")
}
if template.applicationShouldTerminateAfterLastWindowClosed != nil {
- applicationShouldTerminateAfterLastWindowClosed :: proc "c" (self: id, sender: ^Application) -> BOOL {
+ applicationShouldTerminateAfterLastWindowClosed :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldTerminateAfterLastWindowClosed(sender)
@@ -320,7 +319,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldTerminateAfterLastWindowClosed:"), auto_cast applicationShouldTerminateAfterLastWindowClosed, "B@:@")
}
if template.applicationWillTerminate != nil {
- applicationWillTerminate :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillTerminate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillTerminate(notification)
@@ -328,7 +327,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillTerminate:"), auto_cast applicationWillTerminate, "v@:@")
}
if template.applicationWillHide != nil {
- applicationWillHide :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillHide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillHide(notification)
@@ -336,7 +335,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillHide:"), auto_cast applicationWillHide, "v@:@")
}
if template.applicationDidHide != nil {
- applicationDidHide :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidHide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidHide(notification)
@@ -344,7 +343,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidHide:"), auto_cast applicationDidHide, "v@:@")
}
if template.applicationWillUnhide != nil {
- applicationWillUnhide :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillUnhide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillUnhide(notification)
@@ -352,7 +351,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillUnhide:"), auto_cast applicationWillUnhide, "v@:@")
}
if template.applicationDidUnhide != nil {
- applicationDidUnhide :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidUnhide :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidUnhide(notification)
@@ -360,7 +359,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidUnhide:"), auto_cast applicationDidUnhide, "v@:@")
}
if template.applicationWillUpdate != nil {
- applicationWillUpdate :: proc "c" (self: id, notification: ^Notification) {
+ applicationWillUpdate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillUpdate(notification)
@@ -368,7 +367,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationWillUpdate:"), auto_cast applicationWillUpdate, "v@:@")
}
if template.applicationDidUpdate != nil {
- applicationDidUpdate :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidUpdate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidUpdate(notification)
@@ -376,7 +375,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidUpdate:"), auto_cast applicationDidUpdate, "v@:@")
}
if template.applicationShouldHandleReopenHasVisibleWindows != nil {
- applicationShouldHandleReopenHasVisibleWindows :: proc "c" (self: id, sender: ^Application, flag: BOOL) -> BOOL {
+ applicationShouldHandleReopenHasVisibleWindows :: proc "c" (self: id, cmd: SEL, sender: ^Application, flag: BOOL) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldHandleReopenHasVisibleWindows(sender, flag)
@@ -384,7 +383,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldHandleReopen:hasVisibleWindows:"), auto_cast applicationShouldHandleReopenHasVisibleWindows, "B@:@B")
}
if template.applicationDockMenu != nil {
- applicationDockMenu :: proc "c" (self: id, sender: ^Application) -> ^Menu {
+ applicationDockMenu :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> ^Menu {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationDockMenu(sender)
@@ -392,7 +391,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDockMenu:"), auto_cast applicationDockMenu, "@@:@")
}
if template.applicationShouldAutomaticallyLocalizeKeyEquivalents != nil {
- applicationShouldAutomaticallyLocalizeKeyEquivalents :: proc "c" (self: id, application: ^Application) -> BOOL {
+ applicationShouldAutomaticallyLocalizeKeyEquivalents :: proc "c" (self: id, cmd: SEL, application: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldAutomaticallyLocalizeKeyEquivalents(application)
@@ -400,7 +399,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldAutomaticallyLocalizeKeyEquivalents:"), auto_cast applicationShouldAutomaticallyLocalizeKeyEquivalents, "B@:@")
}
if template.applicationWillPresentError != nil {
- applicationWillPresentError :: proc "c" (self: id, application: ^Application, error: ^Error) -> ^Error {
+ applicationWillPresentError :: proc "c" (self: id, cmd: SEL, application: ^Application, error: ^Error) -> ^Error {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationWillPresentError(application, error)
@@ -408,7 +407,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:willPresentError:"), auto_cast applicationWillPresentError, "@@:@@")
}
if template.applicationDidChangeScreenParameters != nil {
- applicationDidChangeScreenParameters :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidChangeScreenParameters :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidChangeScreenParameters(notification)
@@ -416,7 +415,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidChangeScreenParameters:"), auto_cast applicationDidChangeScreenParameters, "v@:@")
}
if template.applicationWillContinueUserActivityWithType != nil {
- applicationWillContinueUserActivityWithType :: proc "c" (self: id, application: ^Application, userActivityType: ^String) -> BOOL {
+ applicationWillContinueUserActivityWithType :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivityType: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationWillContinueUserActivityWithType(application, userActivityType)
@@ -424,7 +423,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:willContinueUserActivityWithType:"), auto_cast applicationWillContinueUserActivityWithType, "B@:@@")
}
if template.applicationContinueUserActivityRestorationHandler != nil {
- applicationContinueUserActivityRestorationHandler :: proc "c" (self: id, application: ^Application, userActivity: ^UserActivity, restorationHandler: ^Block) -> BOOL {
+ applicationContinueUserActivityRestorationHandler :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivity: ^UserActivity, restorationHandler: ^Block) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationContinueUserActivityRestorationHandler(application, userActivity, restorationHandler)
@@ -432,7 +431,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:continueUserActivity:restorationHandler:"), auto_cast applicationContinueUserActivityRestorationHandler, "B@:@@?")
}
if template.applicationDidFailToContinueUserActivityWithTypeError != nil {
- applicationDidFailToContinueUserActivityWithTypeError :: proc "c" (self: id, application: ^Application, userActivityType: ^String, error: ^Error) {
+ applicationDidFailToContinueUserActivityWithTypeError :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivityType: ^String, error: ^Error) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidFailToContinueUserActivityWithTypeError(application, userActivityType, error)
@@ -440,7 +439,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didFailToContinueUserActivityWithType:error:"), auto_cast applicationDidFailToContinueUserActivityWithTypeError, "v@:@@@")
}
if template.applicationDidUpdateUserActivity != nil {
- applicationDidUpdateUserActivity :: proc "c" (self: id, application: ^Application, userActivity: ^UserActivity) {
+ applicationDidUpdateUserActivity :: proc "c" (self: id, cmd: SEL, application: ^Application, userActivity: ^UserActivity) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidUpdateUserActivity(application, userActivity)
@@ -448,7 +447,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didUpdateUserActivity:"), auto_cast applicationDidUpdateUserActivity, "v@:@@")
}
if template.applicationDidRegisterForRemoteNotificationsWithDeviceToken != nil {
- applicationDidRegisterForRemoteNotificationsWithDeviceToken :: proc "c" (self: id, application: ^Application, deviceToken: ^Data) {
+ applicationDidRegisterForRemoteNotificationsWithDeviceToken :: proc "c" (self: id, cmd: SEL, application: ^Application, deviceToken: ^Data) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidRegisterForRemoteNotificationsWithDeviceToken(application, deviceToken)
@@ -456,7 +455,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didRegisterForRemoteNotificationsWithDeviceToken:"), auto_cast applicationDidRegisterForRemoteNotificationsWithDeviceToken, "v@:@@")
}
if template.applicationDidFailToRegisterForRemoteNotificationsWithError != nil {
- applicationDidFailToRegisterForRemoteNotificationsWithError :: proc "c" (self: id, application: ^Application, error: ^Error) {
+ applicationDidFailToRegisterForRemoteNotificationsWithError :: proc "c" (self: id, cmd: SEL, application: ^Application, error: ^Error) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidFailToRegisterForRemoteNotificationsWithError(application, error)
@@ -464,7 +463,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didFailToRegisterForRemoteNotificationsWithError:"), auto_cast applicationDidFailToRegisterForRemoteNotificationsWithError, "v@:@@")
}
if template.applicationDidReceiveRemoteNotification != nil {
- applicationDidReceiveRemoteNotification :: proc "c" (self: id, application: ^Application, userInfo: ^Dictionary) {
+ applicationDidReceiveRemoteNotification :: proc "c" (self: id, cmd: SEL, application: ^Application, userInfo: ^Dictionary) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidReceiveRemoteNotification(application, userInfo)
@@ -472,7 +471,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didReceiveRemoteNotification:"), auto_cast applicationDidReceiveRemoteNotification, "v@:@@")
}
// if template.applicationUserDidAcceptCloudKitShareWithMetadata != nil {
- // applicationUserDidAcceptCloudKitShareWithMetadata :: proc "c" (self: id, application: ^Application, metadata: ^CKShareMetadata) {
+ // applicationUserDidAcceptCloudKitShareWithMetadata :: proc "c" (self: id, cmd: SEL, application: ^Application, metadata: ^CKShareMetadata) {
// del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
// context = del._context
// del.applicationUserDidAcceptCloudKitShareWithMetadata(application, metadata)
@@ -480,7 +479,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
// class_addMethod(class, intrinsics.objc_find_selector("application:userDidAcceptCloudKitShareWithMetadata:"), auto_cast applicationUserDidAcceptCloudKitShareWithMetadata, "v@:@@")
// }
// if template.applicationHandlerForIntent != nil {
- // applicationHandlerForIntent :: proc "c" (self: id, application: ^Application, intent: ^INIntent) -> id {
+ // applicationHandlerForIntent :: proc "c" (self: id, cmd: SEL, application: ^Application, intent: ^INIntent) -> id {
// del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
// context = del._context
// return del.applicationHandlerForIntent(application, intent)
@@ -488,7 +487,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
// class_addMethod(class, intrinsics.objc_find_selector("application:handlerForIntent:"), auto_cast applicationHandlerForIntent, "@@:@@")
// }
if template.applicationOpenURLs != nil {
- applicationOpenURLs :: proc "c" (self: id, application: ^Application, urls: ^Array) {
+ applicationOpenURLs :: proc "c" (self: id, cmd: SEL, application: ^Application, urls: ^Array) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationOpenURLs(application, urls)
@@ -496,7 +495,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openURLs:"), auto_cast applicationOpenURLs, "v@:@@")
}
if template.applicationOpenFile != nil {
- applicationOpenFile :: proc "c" (self: id, sender: ^Application, filename: ^String) -> BOOL {
+ applicationOpenFile :: proc "c" (self: id, cmd: SEL, sender: ^Application, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenFile(sender, filename)
@@ -504,7 +503,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openFile:"), auto_cast applicationOpenFile, "B@:@@")
}
if template.applicationOpenFileWithoutUI != nil {
- applicationOpenFileWithoutUI :: proc "c" (self: id, sender: id, filename: ^String) -> BOOL {
+ applicationOpenFileWithoutUI :: proc "c" (self: id, cmd: SEL, sender: id, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenFileWithoutUI(sender, filename)
@@ -512,7 +511,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openFileWithoutUI:"), auto_cast applicationOpenFileWithoutUI, "B@:@@")
}
if template.applicationOpenTempFile != nil {
- applicationOpenTempFile :: proc "c" (self: id, sender: ^Application, filename: ^String) -> BOOL {
+ applicationOpenTempFile :: proc "c" (self: id, cmd: SEL, sender: ^Application, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenTempFile(sender, filename)
@@ -520,7 +519,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openTempFile:"), auto_cast applicationOpenTempFile, "B@:@@")
}
if template.applicationOpenFiles != nil {
- applicationOpenFiles :: proc "c" (self: id, sender: ^Application, filenames: ^Array) {
+ applicationOpenFiles :: proc "c" (self: id, cmd: SEL, sender: ^Application, filenames: ^Array) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationOpenFiles(sender, filenames)
@@ -528,7 +527,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:openFiles:"), auto_cast applicationOpenFiles, "v@:@@")
}
if template.applicationShouldOpenUntitledFile != nil {
- applicationShouldOpenUntitledFile :: proc "c" (self: id, sender: ^Application) -> BOOL {
+ applicationShouldOpenUntitledFile :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationShouldOpenUntitledFile(sender)
@@ -536,7 +535,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationShouldOpenUntitledFile:"), auto_cast applicationShouldOpenUntitledFile, "B@:@")
}
if template.applicationOpenUntitledFile != nil {
- applicationOpenUntitledFile :: proc "c" (self: id, sender: ^Application) -> BOOL {
+ applicationOpenUntitledFile :: proc "c" (self: id, cmd: SEL, sender: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationOpenUntitledFile(sender)
@@ -544,7 +543,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationOpenUntitledFile:"), auto_cast applicationOpenUntitledFile, "B@:@")
}
if template.applicationPrintFile != nil {
- applicationPrintFile :: proc "c" (self: id, sender: ^Application, filename: ^String) -> BOOL {
+ applicationPrintFile :: proc "c" (self: id, cmd: SEL, sender: ^Application, filename: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationPrintFile(sender, filename)
@@ -552,7 +551,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:printFile:"), auto_cast applicationPrintFile, "B@:@@")
}
if template.applicationPrintFilesWithSettingsShowPrintPanels != nil {
- applicationPrintFilesWithSettingsShowPrintPanels :: proc "c" (self: id, application: ^Application, fileNames: ^Array, printSettings: ^Dictionary, showPrintPanels: BOOL) -> ApplicationPrintReply {
+ applicationPrintFilesWithSettingsShowPrintPanels :: proc "c" (self: id, cmd: SEL, application: ^Application, fileNames: ^Array, printSettings: ^Dictionary, showPrintPanels: BOOL) -> ApplicationPrintReply {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationPrintFilesWithSettingsShowPrintPanels(application, fileNames, printSettings, showPrintPanels)
@@ -560,7 +559,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:printFiles:withSettings:showPrintPanels:"), auto_cast applicationPrintFilesWithSettingsShowPrintPanels, _UINTEGER_ENCODING+"@:@@@B")
}
if template.applicationSupportsSecureRestorableState != nil {
- applicationSupportsSecureRestorableState :: proc "c" (self: id, app: ^Application) -> BOOL {
+ applicationSupportsSecureRestorableState :: proc "c" (self: id, cmd: SEL, app: ^Application) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationSupportsSecureRestorableState(app)
@@ -568,7 +567,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationSupportsSecureRestorableState:"), auto_cast applicationSupportsSecureRestorableState, "B@:@")
}
if template.applicationProtectedDataDidBecomeAvailable != nil {
- applicationProtectedDataDidBecomeAvailable :: proc "c" (self: id, notification: ^Notification) {
+ applicationProtectedDataDidBecomeAvailable :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationProtectedDataDidBecomeAvailable(notification)
@@ -576,7 +575,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationProtectedDataDidBecomeAvailable:"), auto_cast applicationProtectedDataDidBecomeAvailable, "v@:@")
}
if template.applicationProtectedDataWillBecomeUnavailable != nil {
- applicationProtectedDataWillBecomeUnavailable :: proc "c" (self: id, notification: ^Notification) {
+ applicationProtectedDataWillBecomeUnavailable :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationProtectedDataWillBecomeUnavailable(notification)
@@ -584,7 +583,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationProtectedDataWillBecomeUnavailable:"), auto_cast applicationProtectedDataWillBecomeUnavailable, "v@:@")
}
if template.applicationWillEncodeRestorableState != nil {
- applicationWillEncodeRestorableState :: proc "c" (self: id, app: ^Application, coder: ^Coder) {
+ applicationWillEncodeRestorableState :: proc "c" (self: id, cmd: SEL, app: ^Application, coder: ^Coder) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationWillEncodeRestorableState(app, coder)
@@ -592,7 +591,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:willEncodeRestorableState:"), auto_cast applicationWillEncodeRestorableState, "v@:@@")
}
if template.applicationDidDecodeRestorableState != nil {
- applicationDidDecodeRestorableState :: proc "c" (self: id, app: ^Application, coder: ^Coder) {
+ applicationDidDecodeRestorableState :: proc "c" (self: id, cmd: SEL, app: ^Application, coder: ^Coder) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidDecodeRestorableState(app, coder)
@@ -600,7 +599,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("application:didDecodeRestorableState:"), auto_cast applicationDidDecodeRestorableState, "v@:@@")
}
if template.applicationDidChangeOcclusionState != nil {
- applicationDidChangeOcclusionState :: proc "c" (self: id, notification: ^Notification) {
+ applicationDidChangeOcclusionState :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.applicationDidChangeOcclusionState(notification)
@@ -608,7 +607,7 @@ application_delegate_register_and_alloc :: proc(template: ApplicationDelegateTem
class_addMethod(class, intrinsics.objc_find_selector("applicationDidChangeOcclusionState:"), auto_cast applicationDidChangeOcclusionState, "v@:@")
}
if template.applicationDelegateHandlesKey != nil {
- applicationDelegateHandlesKey :: proc "c" (self: id, sender: ^Application, key: ^String) -> BOOL {
+ applicationDelegateHandlesKey :: proc "c" (self: id, cmd: SEL, sender: ^Application, key: ^String) -> BOOL {
del := cast(^_ApplicationDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.applicationDelegateHandlesKey(sender, key)
diff --git a/core/sys/darwin/Foundation/NSArray.odin b/core/sys/darwin/Foundation/NSArray.odin
index b238f63f8..0977c6469 100644
--- a/core/sys/darwin/Foundation/NSArray.odin
+++ b/core/sys/darwin/Foundation/NSArray.odin
@@ -40,3 +40,49 @@ Array_objectAs :: proc "c" (self: ^Array, index: UInteger, $T: typeid) -> T wher
Array_count :: proc "c" (self: ^Array) -> UInteger {
return msgSend(UInteger, self, "count")
}
+
+
+@(objc_class="NSMutableArray")
+MutableArray :: struct {
+ using _: Copying(MutableArray),
+}
+
+@(objc_type=MutableArray, objc_name="alloc", objc_is_class_method=true)
+MutableArray_alloc :: proc "c" () -> ^MutableArray {
+ return msgSend(^MutableArray, MutableArray, "alloc")
+}
+
+@(objc_type=MutableArray, objc_name="init")
+MutableArray_init :: proc "c" (self: ^MutableArray) -> ^MutableArray {
+ return msgSend(^MutableArray, self, "init")
+}
+
+@(objc_type=MutableArray, objc_name="initWithObjects")
+MutableArray_initWithObjects :: proc "c" (self: ^MutableArray, objects: [^]^Object, count: UInteger) -> ^MutableArray {
+ return msgSend(^MutableArray, self, "initWithObjects:count:", objects, count)
+}
+
+@(objc_type=MutableArray, objc_name="initWithCoder")
+MutableArray_initWithCoder :: proc "c" (self: ^MutableArray, coder: ^Coder) -> ^MutableArray {
+ return msgSend(^MutableArray, self, "initWithCoder:", coder)
+}
+
+@(objc_type=MutableArray, objc_name="object")
+MutableArray_object :: proc "c" (self: ^MutableArray, index: UInteger) -> ^Object {
+ return msgSend(^Object, self, "objectAtIndex:", index)
+}
+@(objc_type=MutableArray, objc_name="objectAs")
+MutableArray_objectAs :: proc "c" (self: ^MutableArray, index: UInteger, $T: typeid) -> T where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
+ return (T)(MutableArray_object(self, index))
+}
+
+@(objc_type=MutableArray, objc_name="count")
+MutableArray_count :: proc "c" (self: ^MutableArray) -> UInteger {
+ return msgSend(UInteger, self, "count")
+}
+
+
+@(objc_type=MutableArray, objc_name="exchangeObjectAtIndex")
+MutableArray_exchangeObjectAtIndex :: proc "c" (self: ^MutableArray, idx1, idx2: UInteger) {
+ msgSend(nil, self, "exchangeObjectAtIndex:withObjectAtIndex:", idx1, idx2)
+}
diff --git a/core/sys/darwin/Foundation/NSMenu.odin b/core/sys/darwin/Foundation/NSMenu.odin
index 9a74151b0..747920ab7 100644
--- a/core/sys/darwin/Foundation/NSMenu.odin
+++ b/core/sys/darwin/Foundation/NSMenu.odin
@@ -2,127 +2,562 @@ package objc_Foundation
import "base:builtin"
import "base:intrinsics"
+import "core:c"
-KeyEquivalentModifierFlag :: enum UInteger {
- CapsLock = 16, // Set if Caps Lock key is pressed.
- Shift = 17, // Set if Shift key is pressed.
- Control = 18, // Set if Control key is pressed.
- Option = 19, // Set if Option or Alternate key is pressed.
- Command = 20, // Set if Command key is pressed.
- NumericPad = 21, // Set if any key in the numeric keypad is pressed.
- Help = 22, // Set if the Help key is pressed.
- Function = 23, // Set if any function key is pressed.
+
+MenuSelectionMode :: enum c.long {
+ Automatic = 0,
+ SelectOne = 1,
+ SelectAny = 2,
}
-KeyEquivalentModifierMask :: distinct bit_set[KeyEquivalentModifierFlag; UInteger]
-// Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
-KeyEventModifierFlagDeviceIndependentFlagsMask := transmute(KeyEquivalentModifierMask)_KeyEventModifierFlagDeviceIndependentFlagsMask
-@(private) _KeyEventModifierFlagDeviceIndependentFlagsMask := UInteger(0xffff0000)
+MenuPresentationStyle :: enum c.long {
+ Regular = 0,
+ Palette = 1,
+}
+UserInterfaceLayoutDirection :: enum c.long {
+ LeftToRight = 0,
+ RightToLeft = 1,
+}
-MenuItemCallback :: proc "c" (unused: rawptr, name: SEL, sender: ^Object)
+MenuPropertyItem :: enum c.ulong {
+ Title = 0,
+ AttributedTitle = 1,
+ KeyEquivalent = 2,
+ Image = 3,
+ Enabled = 4,
+ AccessibilityDescription = 5,
+}
+MenuProperties :: distinct bit_set[MenuPropertyItem; c.ulong]
-@(objc_class="NSMenuItem")
-MenuItem :: struct {using _: Object}
+@(objc_class="NSMenu")
+Menu :: struct {using _: Object}
-@(objc_type=MenuItem, objc_name="alloc", objc_is_class_method=true)
-MenuItem_alloc :: proc "c" () -> ^MenuItem {
- return msgSend(^MenuItem, MenuItem, "alloc")
+@(objc_type=Menu, objc_name="init")
+Menu_init :: proc "c" (self: ^Menu) -> ^Menu {
+ return msgSend(^Menu, self, "init")
}
-@(objc_type=MenuItem, objc_name="registerActionCallback", objc_is_class_method=true)
-MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCallback) -> SEL {
- s := string(name)
- n := len(s)
- sel: SEL
- if n > 0 && s[n-1] != ':' {
- col_name := intrinsics.alloca(n+2, 1)
- builtin.copy(col_name[:n], s)
- col_name[n] = ':'
- col_name[n+1] = 0
- sel = sel_registerName(cstring(col_name))
- } else {
- sel = sel_registerName(name)
- }
- if callback != nil {
- class_addMethod(intrinsics.objc_find_class("NSObject"), sel, auto_cast callback, "v@:@")
- }
- return sel
-}
-@(objc_type=MenuItem, objc_name="separatorItem", objc_is_class_method=true)
-MenuItem_separatorItem :: proc "c" () -> ^MenuItem {
- return msgSend(^MenuItem, MenuItem, "separatorItem")
+@(objc_type=Menu, objc_name="initWithTitle")
+Menu_initWithTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) -> ^Menu {
+ return msgSend(^Menu, self, "initWithTitle:", title)
}
-
-@(objc_type=MenuItem, objc_name="init")
-MenuItem_init :: proc "c" (self: ^MenuItem) -> ^MenuItem {
- return msgSend(^MenuItem, self, "init")
+@(objc_type=Menu, objc_name="initWithCoder")
+Menu_initWithCoder :: #force_inline proc "c" (self: ^Menu, coder: ^Coder) -> ^Menu {
+ return msgSend(^Menu, self, "initWithCoder:", coder)
}
-
-@(objc_type=MenuItem, objc_name="initWithTitle")
-MenuItem_initWithTitle :: proc "c" (self: ^MenuItem, title: ^String, action: SEL, keyEquivalent: ^String) -> ^MenuItem {
- return msgSend(^MenuItem, self, "initWithTitle:action:keyEquivalent:", title, action, keyEquivalent)
+@(objc_type=Menu, objc_name="popUpContextMenu_withEvent_forView", objc_is_class_method=true)
+Menu_popUpContextMenu_withEvent_forView :: #force_inline proc "c" (menu: ^Menu, event: ^Event, view: ^View) {
+ msgSend(nil, Menu, "popUpContextMenu:withEvent:forView:", menu, event, view)
}
-
-@(objc_type=MenuItem, objc_name="setKeyEquivalentModifierMask")
-MenuItem_setKeyEquivalentModifierMask :: proc "c" (self: ^MenuItem, modifierMask: KeyEquivalentModifierMask) {
- msgSend(nil, self, "setKeyEquivalentModifierMask:", modifierMask)
+// @(objc_type=Menu, objc_name="popUpContextMenu_withEvent_forView_withFont", objc_is_class_method=true)
+// Menu_popUpContextMenu_withEvent_forView_withFont :: #force_inline proc "c" (menu: ^Menu, event: ^Event, view: ^View, font: ^Font) {
+// msgSend(nil, Menu, "popUpContextMenu:withEvent:forView:withFont:", menu, event, view, font)
+// }
+@(objc_type=Menu, objc_name="popUpMenuPositioningItem")
+Menu_popUpMenuPositioningItem :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem, location: Point, view: ^View) -> bool {
+ return msgSend(bool, self, "popUpMenuPositioningItem:atLocation:inView:", item, location, view)
}
-
-@(objc_type=MenuItem, objc_name="keyEquivalentModifierMask")
-MenuItem_keyEquivalentModifierMask :: proc "c" (self: ^MenuItem) -> KeyEquivalentModifierMask {
- return msgSend(KeyEquivalentModifierMask, self, "keyEquivalentModifierMask")
+@(objc_type=Menu, objc_name="setMenuBarVisible", objc_is_class_method=true)
+Menu_setMenuBarVisible :: #force_inline proc "c" (visible: bool) {
+ msgSend(nil, Menu, "setMenuBarVisible:", visible)
}
-
-@(objc_type=MenuItem, objc_name="setSubmenu")
-MenuItem_setSubmenu :: proc "c" (self: ^MenuItem, submenu: ^Menu) {
- msgSend(nil, self, "setSubmenu:", submenu)
+@(objc_type=Menu, objc_name="menuBarVisible", objc_is_class_method=true)
+Menu_menuBarVisible :: #force_inline proc "c" () -> bool {
+ return msgSend(bool, Menu, "menuBarVisible")
}
-
-@(objc_type=MenuItem, objc_name="title")
-MenuItem_title :: proc "c" (self: ^MenuItem) -> ^String {
+@(objc_type=Menu, objc_name="insertItem")
+Menu_insertItem :: #force_inline proc "c" (self: ^Menu, newItem: ^MenuItem, index: Integer) {
+ msgSend(nil, self, "insertItem:atIndex:", newItem, index)
+}
+@(objc_type=Menu, objc_name="addItem")
+Menu_addItem :: #force_inline proc "c" (self: ^Menu, newItem: ^MenuItem) {
+ msgSend(nil, self, "addItem:", newItem)
+}
+@(objc_type=Menu, objc_name="insertItemWithTitle")
+Menu_insertItemWithTitle :: #force_inline proc "c" (self: ^Menu, string: ^String, selector: SEL, charCode: ^String, index: Integer) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "insertItemWithTitle:action:keyEquivalent:atIndex:", string, selector, charCode, index)
+}
+@(objc_type=Menu, objc_name="addItemWithTitle")
+Menu_addItemWithTitle :: #force_inline proc "c" (self: ^Menu, string: ^String, selector: SEL, charCode: ^String) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "addItemWithTitle:action:keyEquivalent:", string, selector, charCode)
+}
+@(objc_type=Menu, objc_name="removeItemAtIndex")
+Menu_removeItemAtIndex :: #force_inline proc "c" (self: ^Menu, index: Integer) {
+ msgSend(nil, self, "removeItemAtIndex:", index)
+}
+@(objc_type=Menu, objc_name="removeItem")
+Menu_removeItem :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem) {
+ msgSend(nil, self, "removeItem:", item)
+}
+@(objc_type=Menu, objc_name="setSubmenu")
+Menu_setSubmenu :: #force_inline proc "c" (self: ^Menu, menu: ^Menu, item: ^MenuItem) {
+ msgSend(nil, self, "setSubmenu:forItem:", menu, item)
+}
+@(objc_type=Menu, objc_name="removeAllItems")
+Menu_removeAllItems :: #force_inline proc "c" (self: ^Menu) {
+ msgSend(nil, self, "removeAllItems")
+}
+@(objc_type=Menu, objc_name="itemAtIndex")
+Menu_itemAtIndex :: #force_inline proc "c" (self: ^Menu, index: Integer) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "itemAtIndex:", index)
+}
+@(objc_type=Menu, objc_name="indexOfItem")
+Menu_indexOfItem :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem) -> Integer {
+ return msgSend(Integer, self, "indexOfItem:", item)
+}
+@(objc_type=Menu, objc_name="indexOfItemWithTitle")
+Menu_indexOfItemWithTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) -> Integer {
+ return msgSend(Integer, self, "indexOfItemWithTitle:", title)
+}
+@(objc_type=Menu, objc_name="indexOfItemWithTag")
+Menu_indexOfItemWithTag :: #force_inline proc "c" (self: ^Menu, tag: Integer) -> Integer {
+ return msgSend(Integer, self, "indexOfItemWithTag:", tag)
+}
+@(objc_type=Menu, objc_name="indexOfItemWithRepresentedObject")
+Menu_indexOfItemWithRepresentedObject :: #force_inline proc "c" (self: ^Menu, object: id) -> Integer {
+ return msgSend(Integer, self, "indexOfItemWithRepresentedObject:", object)
+}
+@(objc_type=Menu, objc_name="indexOfItemWithSubmenu")
+Menu_indexOfItemWithSubmenu :: #force_inline proc "c" (self: ^Menu, submenu: ^Menu) -> Integer {
+ return msgSend(Integer, self, "indexOfItemWithSubmenu:", submenu)
+}
+@(objc_type=Menu, objc_name="indexOfItemWithTarget")
+Menu_indexOfItemWithTarget :: #force_inline proc "c" (self: ^Menu, target: id, actionSelector: SEL) -> Integer {
+ return msgSend(Integer, self, "indexOfItemWithTarget:andAction:", target, actionSelector)
+}
+@(objc_type=Menu, objc_name="itemWithTitle")
+Menu_itemWithTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "itemWithTitle:", title)
+}
+@(objc_type=Menu, objc_name="itemWithTag")
+Menu_itemWithTag :: #force_inline proc "c" (self: ^Menu, tag: Integer) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "itemWithTag:", tag)
+}
+@(objc_type=Menu, objc_name="update")
+Menu_update :: #force_inline proc "c" (self: ^Menu) {
+ msgSend(nil, self, "update")
+}
+@(objc_type=Menu, objc_name="performKeyEquivalent")
+Menu_performKeyEquivalent :: #force_inline proc "c" (self: ^Menu, event: ^Event) -> bool {
+ return msgSend(bool, self, "performKeyEquivalent:", event)
+}
+@(objc_type=Menu, objc_name="itemChanged")
+Menu_itemChanged :: #force_inline proc "c" (self: ^Menu, item: ^MenuItem) {
+ msgSend(nil, self, "itemChanged:", item)
+}
+@(objc_type=Menu, objc_name="performActionForItemAtIndex")
+Menu_performActionForItemAtIndex :: #force_inline proc "c" (self: ^Menu, index: Integer) {
+ msgSend(nil, self, "performActionForItemAtIndex:", index)
+}
+@(objc_type=Menu, objc_name="cancelTracking")
+Menu_cancelTracking :: #force_inline proc "c" (self: ^Menu) {
+ msgSend(nil, self, "cancelTracking")
+}
+@(objc_type=Menu, objc_name="cancelTrackingWithoutAnimation")
+Menu_cancelTrackingWithoutAnimation :: #force_inline proc "c" (self: ^Menu) {
+ msgSend(nil, self, "cancelTrackingWithoutAnimation")
+}
+@(objc_type=Menu, objc_name="title")
+Menu_title :: #force_inline proc "c" (self: ^Menu) -> ^String {
return msgSend(^String, self, "title")
}
-
-@(objc_type=MenuItem, objc_name="setTitle")
-MenuItem_setTitle :: proc "c" (self: ^MenuItem, title: ^String) -> ^String {
- return msgSend(^String, self, "title:", title)
+@(objc_type=Menu, objc_name="setTitle")
+Menu_setTitle :: #force_inline proc "c" (self: ^Menu, title: ^String) {
+ msgSend(nil, self, "setTitle:", title)
+}
+@(objc_type=Menu, objc_name="supermenu")
+Menu_supermenu :: #force_inline proc "c" (self: ^Menu) -> ^Menu {
+ return msgSend(^Menu, self, "supermenu")
+}
+@(objc_type=Menu, objc_name="setSupermenu")
+Menu_setSupermenu :: #force_inline proc "c" (self: ^Menu, supermenu: ^Menu) {
+ msgSend(nil, self, "setSupermenu:", supermenu)
+}
+@(objc_type=Menu, objc_name="itemArray")
+Menu_itemArray :: #force_inline proc "c" (self: ^Menu) -> ^Array {
+ return msgSend(^Array, self, "itemArray")
+}
+@(objc_type=Menu, objc_name="setItemArray")
+Menu_setItemArray :: #force_inline proc "c" (self: ^Menu, itemArray: ^Array) {
+ msgSend(nil, self, "setItemArray:", itemArray)
+}
+@(objc_type=Menu, objc_name="numberOfItems")
+Menu_numberOfItems :: #force_inline proc "c" (self: ^Menu) -> Integer {
+ return msgSend(Integer, self, "numberOfItems")
+}
+@(objc_type=Menu, objc_name="autoenablesItems")
+Menu_autoenablesItems :: #force_inline proc "c" (self: ^Menu) -> bool {
+ return msgSend(bool, self, "autoenablesItems")
+}
+@(objc_type=Menu, objc_name="setAutoenablesItems")
+Menu_setAutoenablesItems :: #force_inline proc "c" (self: ^Menu, autoenablesItems: bool) {
+ msgSend(nil, self, "setAutoenablesItems:", autoenablesItems)
+}
+@(objc_type=Menu, objc_name="delegate")
+Menu_delegate :: #force_inline proc "c" (self: ^Menu) -> ^MenuDelegate {
+ return msgSend(^MenuDelegate, self, "delegate")
+}
+@(objc_type=Menu, objc_name="setDelegate")
+Menu_setDelegate :: #force_inline proc "c" (self: ^Menu, delegate: ^MenuDelegate) {
+ msgSend(nil, self, "setDelegate:", delegate)
+}
+@(objc_type=Menu, objc_name="menuBarHeight")
+Menu_menuBarHeight :: #force_inline proc "c" (self: ^Menu) -> Float {
+ return msgSend(Float, self, "menuBarHeight")
+}
+@(objc_type=Menu, objc_name="highlightedItem")
+Menu_highlightedItem :: #force_inline proc "c" (self: ^Menu) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "highlightedItem")
+}
+@(objc_type=Menu, objc_name="minimumWidth")
+Menu_minimumWidth :: #force_inline proc "c" (self: ^Menu) -> Float {
+ return msgSend(Float, self, "minimumWidth")
+}
+@(objc_type=Menu, objc_name="setMinimumWidth")
+Menu_setMinimumWidth :: #force_inline proc "c" (self: ^Menu, minimumWidth: Float) {
+ msgSend(nil, self, "setMinimumWidth:", minimumWidth)
+}
+@(objc_type=Menu, objc_name="size")
+Menu_size :: #force_inline proc "c" (self: ^Menu) -> Size {
+ return msgSend(Size, self, "size")
+}
+// @(objc_type=Menu, objc_name="font")
+// Menu_font :: #force_inline proc "c" (self: ^Menu) -> ^Font {
+// return msgSend(^Font, self, "font")
+// }
+// @(objc_type=Menu, objc_name="setFont")
+// Menu_setFont :: #force_inline proc "c" (self: ^Menu, font: ^Font) {
+// msgSend(nil, self, "setFont:", font)
+// }
+@(objc_type=Menu, objc_name="allowsContextMenuPlugIns")
+Menu_allowsContextMenuPlugIns :: #force_inline proc "c" (self: ^Menu) -> bool {
+ return msgSend(bool, self, "allowsContextMenuPlugIns")
+}
+@(objc_type=Menu, objc_name="setAllowsContextMenuPlugIns")
+Menu_setAllowsContextMenuPlugIns :: #force_inline proc "c" (self: ^Menu, allowsContextMenuPlugIns: bool) {
+ msgSend(nil, self, "setAllowsContextMenuPlugIns:", allowsContextMenuPlugIns)
+}
+@(objc_type=Menu, objc_name="showsStateColumn")
+Menu_showsStateColumn :: #force_inline proc "c" (self: ^Menu) -> bool {
+ return msgSend(bool, self, "showsStateColumn")
+}
+@(objc_type=Menu, objc_name="setShowsStateColumn")
+Menu_setShowsStateColumn :: #force_inline proc "c" (self: ^Menu, showsStateColumn: bool) {
+ msgSend(nil, self, "setShowsStateColumn:", showsStateColumn)
+}
+@(objc_type=Menu, objc_name="userInterfaceLayoutDirection")
+Menu_userInterfaceLayoutDirection :: #force_inline proc "c" (self: ^Menu) -> UserInterfaceLayoutDirection {
+ return msgSend(UserInterfaceLayoutDirection, self, "userInterfaceLayoutDirection")
+}
+@(objc_type=Menu, objc_name="setUserInterfaceLayoutDirection")
+Menu_setUserInterfaceLayoutDirection :: #force_inline proc "c" (self: ^Menu, userInterfaceLayoutDirection: UserInterfaceLayoutDirection) {
+ msgSend(nil, self, "setUserInterfaceLayoutDirection:", userInterfaceLayoutDirection)
+}
+@(objc_type=Menu, objc_name="paletteMenuWithColors_titles_selectionHandler", objc_is_class_method=true)
+Menu_paletteMenuWithColors_titles_selectionHandler :: #force_inline proc "c" (colors: ^Array, itemTitles: ^Array, onSelectionChange: proc "c" (_arg_0: ^Menu)) -> ^Menu {
+ return msgSend(^Menu, Menu, "paletteMenuWithColors:titles:selectionHandler:", colors, itemTitles, onSelectionChange)
+}
+// @(objc_type=Menu, objc_name="paletteMenuWithColors_titles_templateImage_selectionHandler", objc_is_class_method=true)
+// Menu_paletteMenuWithColors_titles_templateImage_selectionHandler :: #force_inline proc "c" (colors: ^Array, itemTitles: ^Array, image: ^Image, onSelectionChange: proc "c" (_arg_0: ^Menu)) -> ^Menu {
+// return msgSend(^Menu, Menu, "paletteMenuWithColors:titles:templateImage:selectionHandler:", colors, itemTitles, image, onSelectionChange)
+// }
+@(objc_type=Menu, objc_name="presentationStyle")
+Menu_presentationStyle :: #force_inline proc "c" (self: ^Menu) -> MenuPresentationStyle {
+ return msgSend(MenuPresentationStyle, self, "presentationStyle")
+}
+@(objc_type=Menu, objc_name="setPresentationStyle")
+Menu_setPresentationStyle :: #force_inline proc "c" (self: ^Menu, presentationStyle: MenuPresentationStyle) {
+ msgSend(nil, self, "setPresentationStyle:", presentationStyle)
+}
+@(objc_type=Menu, objc_name="selectionMode")
+Menu_selectionMode :: #force_inline proc "c" (self: ^Menu) -> MenuSelectionMode {
+ return msgSend(MenuSelectionMode, self, "selectionMode")
+}
+@(objc_type=Menu, objc_name="setSelectionMode")
+Menu_setSelectionMode :: #force_inline proc "c" (self: ^Menu, selectionMode: MenuSelectionMode) {
+ msgSend(nil, self, "setSelectionMode:", selectionMode)
+}
+@(objc_type=Menu, objc_name="selectedItems")
+Menu_selectedItems :: #force_inline proc "c" (self: ^Menu) -> ^Array {
+ return msgSend(^Array, self, "selectedItems")
+}
+@(objc_type=Menu, objc_name="setSelectedItems")
+Menu_setSelectedItems :: #force_inline proc "c" (self: ^Menu, selectedItems: ^Array) {
+ msgSend(nil, self, "setSelectedItems:", selectedItems)
+}
+@(objc_type=Menu, objc_name="submenuAction")
+Menu_submenuAction :: #force_inline proc "c" (self: ^Menu, sender: id) {
+ msgSend(nil, self, "submenuAction:", sender)
+}
+@(objc_type=Menu, objc_name="propertiesToUpdate")
+Menu_propertiesToUpdate :: #force_inline proc "c" (self: ^Menu) -> MenuProperties {
+ return msgSend(MenuProperties, self, "propertiesToUpdate")
+}
+@(objc_type=Menu, objc_name="setMenuRepresentation")
+Menu_setMenuRepresentation :: #force_inline proc "c" (self: ^Menu, menuRep: id) {
+ msgSend(nil, self, "setMenuRepresentation:", menuRep)
+}
+@(objc_type=Menu, objc_name="menuRepresentation")
+Menu_menuRepresentation :: #force_inline proc "c" (self: ^Menu) -> id {
+ return msgSend(id, self, "menuRepresentation")
+}
+@(objc_type=Menu, objc_name="setContextMenuRepresentation")
+Menu_setContextMenuRepresentation :: #force_inline proc "c" (self: ^Menu, menuRep: id) {
+ msgSend(nil, self, "setContextMenuRepresentation:", menuRep)
+}
+@(objc_type=Menu, objc_name="contextMenuRepresentation")
+Menu_contextMenuRepresentation :: #force_inline proc "c" (self: ^Menu) -> id {
+ return msgSend(id, self, "contextMenuRepresentation")
+}
+@(objc_type=Menu, objc_name="setTearOffMenuRepresentation")
+Menu_setTearOffMenuRepresentation :: #force_inline proc "c" (self: ^Menu, menuRep: id) {
+ msgSend(nil, self, "setTearOffMenuRepresentation:", menuRep)
+}
+@(objc_type=Menu, objc_name="tearOffMenuRepresentation")
+Menu_tearOffMenuRepresentation :: #force_inline proc "c" (self: ^Menu) -> id {
+ return msgSend(id, self, "tearOffMenuRepresentation")
+}
+@(objc_type=Menu, objc_name="menuZone", objc_is_class_method=true)
+Menu_menuZone :: #force_inline proc "c" () -> ^Zone {
+ return msgSend(^Zone, Menu, "menuZone")
+}
+@(objc_type=Menu, objc_name="setMenuZone", objc_is_class_method=true)
+Menu_setMenuZone :: #force_inline proc "c" (zone: ^Zone) {
+ msgSend(nil, Menu, "setMenuZone:", zone)
+}
+@(objc_type=Menu, objc_name="attachedMenu")
+Menu_attachedMenu :: #force_inline proc "c" (self: ^Menu) -> ^Menu {
+ return msgSend(^Menu, self, "attachedMenu")
+}
+@(objc_type=Menu, objc_name="isAttached")
+Menu_isAttached :: #force_inline proc "c" (self: ^Menu) -> bool {
+ return msgSend(bool, self, "isAttached")
+}
+@(objc_type=Menu, objc_name="sizeToFit")
+Menu_sizeToFit :: #force_inline proc "c" (self: ^Menu) {
+ msgSend(nil, self, "sizeToFit")
+}
+@(objc_type=Menu, objc_name="locationForSubmenu")
+Menu_locationForSubmenu :: #force_inline proc "c" (self: ^Menu, submenu: ^Menu) -> Point {
+ return msgSend(Point, self, "locationForSubmenu:", submenu)
+}
+@(objc_type=Menu, objc_name="helpRequested")
+Menu_helpRequested :: #force_inline proc "c" (self: ^Menu, eventPtr: ^Event) {
+ msgSend(nil, self, "helpRequested:", eventPtr)
+}
+@(objc_type=Menu, objc_name="menuChangedMessagesEnabled")
+Menu_menuChangedMessagesEnabled :: #force_inline proc "c" (self: ^Menu) -> bool {
+ return msgSend(bool, self, "menuChangedMessagesEnabled")
+}
+@(objc_type=Menu, objc_name="setMenuChangedMessagesEnabled")
+Menu_setMenuChangedMessagesEnabled :: #force_inline proc "c" (self: ^Menu, menuChangedMessagesEnabled: bool) {
+ msgSend(nil, self, "setMenuChangedMessagesEnabled:", menuChangedMessagesEnabled)
+}
+@(objc_type=Menu, objc_name="isTornOff")
+Menu_isTornOff :: #force_inline proc "c" (self: ^Menu) -> bool {
+ return msgSend(bool, self, "isTornOff")
+}
+@(objc_type=Menu, objc_name="load", objc_is_class_method=true)
+Menu_load :: #force_inline proc "c" () {
+ msgSend(nil, Menu, "load")
+}
+@(objc_type=Menu, objc_name="initialize", objc_is_class_method=true)
+Menu_initialize :: #force_inline proc "c" () {
+ msgSend(nil, Menu, "initialize")
+}
+@(objc_type=Menu, objc_name="new", objc_is_class_method=true)
+Menu_new :: #force_inline proc "c" () -> ^Menu {
+ return msgSend(^Menu, Menu, "new")
+}
+@(objc_type=Menu, objc_name="allocWithZone", objc_is_class_method=true)
+Menu_allocWithZone :: #force_inline proc "c" (zone: ^Zone) -> ^Menu {
+ return msgSend(^Menu, Menu, "allocWithZone:", zone)
}
-
-
-
-@(objc_class="NSMenu")
-Menu :: struct {using _: Object}
-
@(objc_type=Menu, objc_name="alloc", objc_is_class_method=true)
-Menu_alloc :: proc "c" () -> ^Menu {
+Menu_alloc :: #force_inline proc "c" () -> ^Menu {
return msgSend(^Menu, Menu, "alloc")
}
+@(objc_type=Menu, objc_name="copyWithZone", objc_is_class_method=true)
+Menu_copyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
+ return msgSend(id, Menu, "copyWithZone:", zone)
+}
+@(objc_type=Menu, objc_name="mutableCopyWithZone", objc_is_class_method=true)
+Menu_mutableCopyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
+ return msgSend(id, Menu, "mutableCopyWithZone:", zone)
+}
+@(objc_type=Menu, objc_name="instancesRespondToSelector", objc_is_class_method=true)
+Menu_instancesRespondToSelector :: #force_inline proc "c" (aSelector: SEL) -> bool {
+ return msgSend(bool, Menu, "instancesRespondToSelector:", aSelector)
+}
+@(objc_type=Menu, objc_name="conformsToProtocol", objc_is_class_method=true)
+Menu_conformsToProtocol :: #force_inline proc "c" (protocol: ^Protocol) -> bool {
+ return msgSend(bool, Menu, "conformsToProtocol:", protocol)
+}
+@(objc_type=Menu, objc_name="instanceMethodForSelector", objc_is_class_method=true)
+Menu_instanceMethodForSelector :: #force_inline proc "c" (aSelector: SEL) -> IMP {
+ return msgSend(IMP, Menu, "instanceMethodForSelector:", aSelector)
+}
+// @(objc_type=Menu, objc_name="instanceMethodSignatureForSelector", objc_is_class_method=true)
+// Menu_instanceMethodSignatureForSelector :: #force_inline proc "c" (aSelector: SEL) -> ^MethodSignature {
+// return msgSend(^MethodSignature, Menu, "instanceMethodSignatureForSelector:", aSelector)
+// }
+@(objc_type=Menu, objc_name="isSubclassOfClass", objc_is_class_method=true)
+Menu_isSubclassOfClass :: #force_inline proc "c" (aClass: Class) -> bool {
+ return msgSend(bool, Menu, "isSubclassOfClass:", aClass)
+}
+@(objc_type=Menu, objc_name="resolveClassMethod", objc_is_class_method=true)
+Menu_resolveClassMethod :: #force_inline proc "c" (sel: SEL) -> bool {
+ return msgSend(bool, Menu, "resolveClassMethod:", sel)
+}
+@(objc_type=Menu, objc_name="resolveInstanceMethod", objc_is_class_method=true)
+Menu_resolveInstanceMethod :: #force_inline proc "c" (sel: SEL) -> bool {
+ return msgSend(bool, Menu, "resolveInstanceMethod:", sel)
+}
+@(objc_type=Menu, objc_name="hash", objc_is_class_method=true)
+Menu_hash :: #force_inline proc "c" () -> UInteger {
+ return msgSend(UInteger, Menu, "hash")
+}
+@(objc_type=Menu, objc_name="superclass", objc_is_class_method=true)
+Menu_superclass :: #force_inline proc "c" () -> Class {
+ return msgSend(Class, Menu, "superclass")
+}
+@(objc_type=Menu, objc_name="class", objc_is_class_method=true)
+Menu_class :: #force_inline proc "c" () -> Class {
+ return msgSend(Class, Menu, "class")
+}
+@(objc_type=Menu, objc_name="description", objc_is_class_method=true)
+Menu_description :: #force_inline proc "c" () -> ^String {
+ return msgSend(^String, Menu, "description")
+}
+@(objc_type=Menu, objc_name="debugDescription", objc_is_class_method=true)
+Menu_debugDescription :: #force_inline proc "c" () -> ^String {
+ return msgSend(^String, Menu, "debugDescription")
+}
+@(objc_type=Menu, objc_name="version", objc_is_class_method=true)
+Menu_version :: #force_inline proc "c" () -> Integer {
+ return msgSend(Integer, Menu, "version")
+}
+@(objc_type=Menu, objc_name="setVersion", objc_is_class_method=true)
+Menu_setVersion :: #force_inline proc "c" (aVersion: Integer) {
+ msgSend(nil, Menu, "setVersion:", aVersion)
+}
+@(objc_type=Menu, objc_name="poseAsClass", objc_is_class_method=true)
+Menu_poseAsClass :: #force_inline proc "c" (aClass: Class) {
+ msgSend(nil, Menu, "poseAsClass:", aClass)
+}
+@(objc_type=Menu, objc_name="cancelPreviousPerformRequestsWithTarget_selector_object", objc_is_class_method=true)
+Menu_cancelPreviousPerformRequestsWithTarget_selector_object :: #force_inline proc "c" (aTarget: id, aSelector: SEL, anArgument: id) {
+ msgSend(nil, Menu, "cancelPreviousPerformRequestsWithTarget:selector:object:", aTarget, aSelector, anArgument)
+}
+@(objc_type=Menu, objc_name="cancelPreviousPerformRequestsWithTarget_", objc_is_class_method=true)
+Menu_cancelPreviousPerformRequestsWithTarget_ :: #force_inline proc "c" (aTarget: id) {
+ msgSend(nil, Menu, "cancelPreviousPerformRequestsWithTarget:", aTarget)
+}
+@(objc_type=Menu, objc_name="accessInstanceVariablesDirectly", objc_is_class_method=true)
+Menu_accessInstanceVariablesDirectly :: #force_inline proc "c" () -> bool {
+ return msgSend(bool, Menu, "accessInstanceVariablesDirectly")
+}
+@(objc_type=Menu, objc_name="useStoredAccessor", objc_is_class_method=true)
+Menu_useStoredAccessor :: #force_inline proc "c" () -> bool {
+ return msgSend(bool, Menu, "useStoredAccessor")
+}
+@(objc_type=Menu, objc_name="keyPathsForValuesAffectingValueForKey", objc_is_class_method=true)
+Menu_keyPathsForValuesAffectingValueForKey :: #force_inline proc "c" (key: ^String) -> ^Set {
+ return msgSend(^Set, Menu, "keyPathsForValuesAffectingValueForKey:", key)
+}
+@(objc_type=Menu, objc_name="automaticallyNotifiesObserversForKey", objc_is_class_method=true)
+Menu_automaticallyNotifiesObserversForKey :: #force_inline proc "c" (key: ^String) -> bool {
+ return msgSend(bool, Menu, "automaticallyNotifiesObserversForKey:", key)
+}
+@(objc_type=Menu, objc_name="setKeys", objc_is_class_method=true)
+Menu_setKeys :: #force_inline proc "c" (keys: ^Array, dependentKey: ^String) {
+ msgSend(nil, Menu, "setKeys:triggerChangeNotificationsForDependentKey:", keys, dependentKey)
+}
+@(objc_type=Menu, objc_name="classFallbacksForKeyedArchiver", objc_is_class_method=true)
+Menu_classFallbacksForKeyedArchiver :: #force_inline proc "c" () -> ^Array {
+ return msgSend(^Array, Menu, "classFallbacksForKeyedArchiver")
+}
+@(objc_type=Menu, objc_name="classForKeyedUnarchiver", objc_is_class_method=true)
+Menu_classForKeyedUnarchiver :: #force_inline proc "c" () -> Class {
+ return msgSend(Class, Menu, "classForKeyedUnarchiver")
+}
+@(objc_type=Menu, objc_name="exposeBinding", objc_is_class_method=true)
+Menu_exposeBinding :: #force_inline proc "c" (binding: ^String) {
+ msgSend(nil, Menu, "exposeBinding:", binding)
+}
+@(objc_type=Menu, objc_name="setDefaultPlaceholder", objc_is_class_method=true)
+Menu_setDefaultPlaceholder :: #force_inline proc "c" (placeholder: id, marker: id, binding: ^String) {
+ msgSend(nil, Menu, "setDefaultPlaceholder:forMarker:withBinding:", placeholder, marker, binding)
+}
+@(objc_type=Menu, objc_name="defaultPlaceholderForMarker", objc_is_class_method=true)
+Menu_defaultPlaceholderForMarker :: #force_inline proc "c" (marker: id, binding: ^String) -> id {
+ return msgSend(id, Menu, "defaultPlaceholderForMarker:withBinding:", marker, binding)
+}
+@(objc_type=Menu, objc_name="popUpContextMenu")
+Menu_popUpContextMenu :: proc {
+ Menu_popUpContextMenu_withEvent_forView,
+ // Menu_popUpContextMenu_withEvent_forView_withFont,
+}
-@(objc_type=Menu, objc_name="init")
-Menu_init :: proc "c" (self: ^Menu) -> ^Menu {
- return msgSend(^Menu, self, "init")
+@(objc_type=Menu, objc_name="paletteMenuWithColors")
+Menu_paletteMenuWithColors :: proc {
+ Menu_paletteMenuWithColors_titles_selectionHandler,
+ // Menu_paletteMenuWithColors_titles_templateImage_selectionHandler,
}
-@(objc_type=Menu, objc_name="initWithTitle")
-Menu_initWithTitle :: proc "c" (self: ^Menu, title: ^String) -> ^Menu {
- return msgSend(^Menu, self, "initWithTitle:", title)
+@(objc_type=Menu, objc_name="cancelPreviousPerformRequestsWithTarget")
+Menu_cancelPreviousPerformRequestsWithTarget :: proc {
+ Menu_cancelPreviousPerformRequestsWithTarget_selector_object,
+ Menu_cancelPreviousPerformRequestsWithTarget_,
}
-@(objc_type=Menu, objc_name="addItem")
-Menu_addItem :: proc "c" (self: ^Menu, item: ^MenuItem) {
- msgSend(nil, self, "addItem:", item)
-}
-@(objc_type=Menu, objc_name="addItemWithTitle")
-Menu_addItemWithTitle :: proc "c" (self: ^Menu, title: ^String, selector: SEL, keyEquivalent: ^String) -> ^MenuItem {
- return msgSend(^MenuItem, self, "addItemWithTitle:action:keyEquivalent:", title, selector, keyEquivalent)
-}
-@(objc_type=Menu, objc_name="itemArray")
-Menu_itemArray :: proc "c" (self: ^Menu) -> ^Array {
- return msgSend(^Array, self, "itemArray")
-} \ No newline at end of file
+
+
+
+@(objc_class="NSMenuDelegate")
+MenuDelegate :: struct {using _: Object, using _: ObjectProtocol}
+
+@(objc_type=MenuDelegate, objc_name="menuNeedsUpdate")
+MenuDelegate_menuNeedsUpdate :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) {
+ msgSend(nil, self, "menuNeedsUpdate:", menu)
+}
+@(objc_type=MenuDelegate, objc_name="numberOfItemsInMenu")
+MenuDelegate_numberOfItemsInMenu :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) -> Integer {
+ return msgSend(Integer, self, "numberOfItemsInMenu:", menu)
+}
+@(objc_type=MenuDelegate, objc_name="menu_updateItem_atIndex_shouldCancel")
+MenuDelegate_menu_updateItem_atIndex_shouldCancel :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, item: ^MenuItem, index: Integer, shouldCancel: bool) -> bool {
+ return msgSend(bool, self, "menu:updateItem:atIndex:shouldCancel:", menu, item, index, shouldCancel)
+}
+@(objc_type=MenuDelegate, objc_name="menuHasKeyEquivalent")
+MenuDelegate_menuHasKeyEquivalent :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, event: ^Event, target: ^id, action: ^SEL) -> bool {
+ return msgSend(bool, self, "menuHasKeyEquivalent:forEvent:target:action:", menu, event, target, action)
+}
+@(objc_type=MenuDelegate, objc_name="menuWillOpen")
+MenuDelegate_menuWillOpen :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) {
+ msgSend(nil, self, "menuWillOpen:", menu)
+}
+@(objc_type=MenuDelegate, objc_name="menuDidClose")
+MenuDelegate_menuDidClose :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu) {
+ msgSend(nil, self, "menuDidClose:", menu)
+}
+@(objc_type=MenuDelegate, objc_name="menu_willHighlightItem")
+MenuDelegate_menu_willHighlightItem :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, item: ^MenuItem) {
+ msgSend(nil, self, "menu:willHighlightItem:", menu, item)
+}
+@(objc_type=MenuDelegate, objc_name="confinementRectForMenu")
+MenuDelegate_confinementRectForMenu :: #force_inline proc "c" (self: ^MenuDelegate, menu: ^Menu, screen: ^Screen) -> Rect {
+ return msgSend(Rect, self, "confinementRectForMenu:onScreen:", menu, screen)
+}
+@(objc_type=MenuDelegate, objc_name="menu")
+MenuDelegate_menu :: proc {
+ MenuDelegate_menu_updateItem_atIndex_shouldCancel,
+ MenuDelegate_menu_willHighlightItem,
+}
diff --git a/core/sys/darwin/Foundation/NSMenuItem.odin b/core/sys/darwin/Foundation/NSMenuItem.odin
new file mode 100644
index 000000000..248a0cf4f
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSMenuItem.odin
@@ -0,0 +1,460 @@
+package objc_Foundation
+
+import "base:builtin"
+import "base:intrinsics"
+
+KeyEquivalentModifierFlag :: EventModifierFlag
+KeyEquivalentModifierMask :: EventModifierFlags
+
+// Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information.
+KeyEventModifierFlagDeviceIndependentFlagsMask := transmute(KeyEquivalentModifierMask)_KeyEventModifierFlagDeviceIndependentFlagsMask
+@(private) _KeyEventModifierFlagDeviceIndependentFlagsMask := UInteger(0xffff0000)
+
+MenuItemCallback :: proc "c" (unused: rawptr, name: SEL, sender: ^Object)
+
+@(objc_class="NSMenuItem")
+MenuItem :: struct {using _: Object}
+
+@(objc_type=MenuItem, objc_name="registerActionCallback", objc_is_class_method=true)
+MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCallback) -> SEL {
+ s := string(name)
+ n := len(s)
+ sel: SEL
+ if n > 0 && s[n-1] != ':' {
+ col_name := intrinsics.alloca(n+2, 1)
+ builtin.copy(col_name[:n], s)
+ col_name[n] = ':'
+ col_name[n+1] = 0
+ sel = sel_registerName(cstring(col_name))
+ } else {
+ sel = sel_registerName(name)
+ }
+ if callback != nil {
+ class_addMethod(intrinsics.objc_find_class("NSObject"), sel, auto_cast callback, "v@:@")
+ }
+ return sel
+}
+
+@(objc_type=MenuItem, objc_name="init")
+MenuItem_init :: proc "c" (self: ^MenuItem) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "init")
+}
+
+
+@(objc_type=MenuItem, objc_name="separatorItem", objc_is_class_method=true)
+MenuItem_separatorItem :: #force_inline proc "c" () -> ^MenuItem {
+ return msgSend(^MenuItem, MenuItem, "separatorItem")
+}
+@(objc_type=MenuItem, objc_name="sectionHeaderWithTitle", objc_is_class_method=true)
+MenuItem_sectionHeaderWithTitle :: #force_inline proc "c" (title: ^String) -> ^MenuItem {
+ return msgSend(^MenuItem, MenuItem, "sectionHeaderWithTitle:", title)
+}
+@(objc_type=MenuItem, objc_name="initWithTitle")
+MenuItem_initWithTitle :: #force_inline proc "c" (self: ^MenuItem, string: ^String, selector: SEL, charCode: ^String) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "initWithTitle:action:keyEquivalent:", string, selector, charCode)
+}
+@(objc_type=MenuItem, objc_name="initWithCoder")
+MenuItem_initWithCoder :: #force_inline proc "c" (self: ^MenuItem, coder: ^Coder) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "initWithCoder:", coder)
+}
+@(objc_type=MenuItem, objc_name="usesUserKeyEquivalents", objc_is_class_method=true)
+MenuItem_usesUserKeyEquivalents :: #force_inline proc "c" () -> bool {
+ return msgSend(bool, MenuItem, "usesUserKeyEquivalents")
+}
+@(objc_type=MenuItem, objc_name="setUsesUserKeyEquivalents", objc_is_class_method=true)
+MenuItem_setUsesUserKeyEquivalents :: #force_inline proc "c" (usesUserKeyEquivalents: bool) {
+ msgSend(nil, MenuItem, "setUsesUserKeyEquivalents:", usesUserKeyEquivalents)
+}
+@(objc_type=MenuItem, objc_name="menu")
+MenuItem_menu :: #force_inline proc "c" (self: ^MenuItem) -> ^Menu {
+ return msgSend(^Menu, self, "menu")
+}
+@(objc_type=MenuItem, objc_name="setMenu")
+MenuItem_setMenu :: #force_inline proc "c" (self: ^MenuItem, menu: ^Menu) {
+ msgSend(nil, self, "setMenu:", menu)
+}
+@(objc_type=MenuItem, objc_name="hasSubmenu")
+MenuItem_hasSubmenu :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "hasSubmenu")
+}
+@(objc_type=MenuItem, objc_name="submenu")
+MenuItem_submenu :: #force_inline proc "c" (self: ^MenuItem) -> ^Menu {
+ return msgSend(^Menu, self, "submenu")
+}
+@(objc_type=MenuItem, objc_name="setSubmenu")
+MenuItem_setSubmenu :: #force_inline proc "c" (self: ^MenuItem, submenu: ^Menu) {
+ msgSend(nil, self, "setSubmenu:", submenu)
+}
+@(objc_type=MenuItem, objc_name="parentItem")
+MenuItem_parentItem :: #force_inline proc "c" (self: ^MenuItem) -> ^MenuItem {
+ return msgSend(^MenuItem, self, "parentItem")
+}
+@(objc_type=MenuItem, objc_name="title")
+MenuItem_title :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
+ return msgSend(^String, self, "title")
+}
+@(objc_type=MenuItem, objc_name="setTitle")
+MenuItem_setTitle :: #force_inline proc "c" (self: ^MenuItem, title: ^String) {
+ msgSend(nil, self, "setTitle:", title)
+}
+// @(objc_type=MenuItem, objc_name="attributedTitle")
+// MenuItem_attributedTitle :: #force_inline proc "c" (self: ^MenuItem) -> ^AttributedString {
+// return msgSend(^AttributedString, self, "attributedTitle")
+// }
+// @(objc_type=MenuItem, objc_name="setAttributedTitle")
+// MenuItem_setAttributedTitle :: #force_inline proc "c" (self: ^MenuItem, attributedTitle: ^AttributedString) {
+// msgSend(nil, self, "setAttributedTitle:", attributedTitle)
+// }
+@(objc_type=MenuItem, objc_name="subtitle")
+MenuItem_subtitle :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
+ return msgSend(^String, self, "subtitle")
+}
+@(objc_type=MenuItem, objc_name="setSubtitle")
+MenuItem_setSubtitle :: #force_inline proc "c" (self: ^MenuItem, subtitle: ^String) {
+ msgSend(nil, self, "setSubtitle:", subtitle)
+}
+@(objc_type=MenuItem, objc_name="isSeparatorItem")
+MenuItem_isSeparatorItem :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isSeparatorItem")
+}
+@(objc_type=MenuItem, objc_name="isSectionHeader")
+MenuItem_isSectionHeader :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isSectionHeader")
+}
+@(objc_type=MenuItem, objc_name="keyEquivalent")
+MenuItem_keyEquivalent :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
+ return msgSend(^String, self, "keyEquivalent")
+}
+@(objc_type=MenuItem, objc_name="setKeyEquivalent")
+MenuItem_setKeyEquivalent :: #force_inline proc "c" (self: ^MenuItem, keyEquivalent: ^String) {
+ msgSend(nil, self, "setKeyEquivalent:", keyEquivalent)
+}
+@(objc_type=MenuItem, objc_name="keyEquivalentModifierMask")
+MenuItem_keyEquivalentModifierMask :: #force_inline proc "c" (self: ^MenuItem) -> EventModifierFlags {
+ return msgSend(EventModifierFlags, self, "keyEquivalentModifierMask")
+}
+@(objc_type=MenuItem, objc_name="setKeyEquivalentModifierMask")
+MenuItem_setKeyEquivalentModifierMask :: #force_inline proc "c" (self: ^MenuItem, keyEquivalentModifierMask: EventModifierFlags) {
+ msgSend(nil, self, "setKeyEquivalentModifierMask:", keyEquivalentModifierMask)
+}
+@(objc_type=MenuItem, objc_name="userKeyEquivalent")
+MenuItem_userKeyEquivalent :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
+ return msgSend(^String, self, "userKeyEquivalent")
+}
+@(objc_type=MenuItem, objc_name="allowsKeyEquivalentWhenHidden")
+MenuItem_allowsKeyEquivalentWhenHidden :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "allowsKeyEquivalentWhenHidden")
+}
+@(objc_type=MenuItem, objc_name="setAllowsKeyEquivalentWhenHidden")
+MenuItem_setAllowsKeyEquivalentWhenHidden :: #force_inline proc "c" (self: ^MenuItem, allowsKeyEquivalentWhenHidden: bool) {
+ msgSend(nil, self, "setAllowsKeyEquivalentWhenHidden:", allowsKeyEquivalentWhenHidden)
+}
+@(objc_type=MenuItem, objc_name="allowsAutomaticKeyEquivalentLocalization")
+MenuItem_allowsAutomaticKeyEquivalentLocalization :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "allowsAutomaticKeyEquivalentLocalization")
+}
+@(objc_type=MenuItem, objc_name="setAllowsAutomaticKeyEquivalentLocalization")
+MenuItem_setAllowsAutomaticKeyEquivalentLocalization :: #force_inline proc "c" (self: ^MenuItem, allowsAutomaticKeyEquivalentLocalization: bool) {
+ msgSend(nil, self, "setAllowsAutomaticKeyEquivalentLocalization:", allowsAutomaticKeyEquivalentLocalization)
+}
+@(objc_type=MenuItem, objc_name="allowsAutomaticKeyEquivalentMirroring")
+MenuItem_allowsAutomaticKeyEquivalentMirroring :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "allowsAutomaticKeyEquivalentMirroring")
+}
+@(objc_type=MenuItem, objc_name="setAllowsAutomaticKeyEquivalentMirroring")
+MenuItem_setAllowsAutomaticKeyEquivalentMirroring :: #force_inline proc "c" (self: ^MenuItem, allowsAutomaticKeyEquivalentMirroring: bool) {
+ msgSend(nil, self, "setAllowsAutomaticKeyEquivalentMirroring:", allowsAutomaticKeyEquivalentMirroring)
+}
+// @(objc_type=MenuItem, objc_name="image")
+// MenuItem_image :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
+// return msgSend(^Image, self, "image")
+// }
+// @(objc_type=MenuItem, objc_name="setImage")
+// MenuItem_setImage :: #force_inline proc "c" (self: ^MenuItem, image: ^Image) {
+// msgSend(nil, self, "setImage:", image)
+// }
+// @(objc_type=MenuItem, objc_name="state")
+// MenuItem_state :: #force_inline proc "c" (self: ^MenuItem) -> ControlStateValue {
+// return msgSend(ControlStateValue, self, "state")
+// }
+// @(objc_type=MenuItem, objc_name="setState")
+// MenuItem_setState :: #force_inline proc "c" (self: ^MenuItem, state: ControlStateValue) {
+// msgSend(nil, self, "setState:", state)
+// }
+// @(objc_type=MenuItem, objc_name="onStateImage")
+// MenuItem_onStateImage :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
+// return msgSend(^Image, self, "onStateImage")
+// }
+// @(objc_type=MenuItem, objc_name="setOnStateImage")
+// MenuItem_setOnStateImage :: #force_inline proc "c" (self: ^MenuItem, onStateImage: ^Image) {
+// msgSend(nil, self, "setOnStateImage:", onStateImage)
+// }
+// @(objc_type=MenuItem, objc_name="offStateImage")
+// MenuItem_offStateImage :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
+// return msgSend(^Image, self, "offStateImage")
+// }
+// @(objc_type=MenuItem, objc_name="setOffStateImage")
+// MenuItem_setOffStateImage :: #force_inline proc "c" (self: ^MenuItem, offStateImage: ^Image) {
+// msgSend(nil, self, "setOffStateImage:", offStateImage)
+// }
+// @(objc_type=MenuItem, objc_name="mixedStateImage")
+// MenuItem_mixedStateImage :: #force_inline proc "c" (self: ^MenuItem) -> ^Image {
+// return msgSend(^Image, self, "mixedStateImage")
+// }
+// @(objc_type=MenuItem, objc_name="setMixedStateImage")
+// MenuItem_setMixedStateImage :: #force_inline proc "c" (self: ^MenuItem, mixedStateImage: ^Image) {
+// msgSend(nil, self, "setMixedStateImage:", mixedStateImage)
+// }
+@(objc_type=MenuItem, objc_name="isEnabled")
+MenuItem_isEnabled :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isEnabled")
+}
+@(objc_type=MenuItem, objc_name="setEnabled")
+MenuItem_setEnabled :: #force_inline proc "c" (self: ^MenuItem, enabled: bool) {
+ msgSend(nil, self, "setEnabled:", enabled)
+}
+@(objc_type=MenuItem, objc_name="isAlternate")
+MenuItem_isAlternate :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isAlternate")
+}
+@(objc_type=MenuItem, objc_name="setAlternate")
+MenuItem_setAlternate :: #force_inline proc "c" (self: ^MenuItem, alternate: bool) {
+ msgSend(nil, self, "setAlternate:", alternate)
+}
+@(objc_type=MenuItem, objc_name="indentationLevel")
+MenuItem_indentationLevel :: #force_inline proc "c" (self: ^MenuItem) -> Integer {
+ return msgSend(Integer, self, "indentationLevel")
+}
+@(objc_type=MenuItem, objc_name="setIndentationLevel")
+MenuItem_setIndentationLevel :: #force_inline proc "c" (self: ^MenuItem, indentationLevel: Integer) {
+ msgSend(nil, self, "setIndentationLevel:", indentationLevel)
+}
+@(objc_type=MenuItem, objc_name="target")
+MenuItem_target :: #force_inline proc "c" (self: ^MenuItem) -> id {
+ return msgSend(id, self, "target")
+}
+@(objc_type=MenuItem, objc_name="setTarget")
+MenuItem_setTarget :: #force_inline proc "c" (self: ^MenuItem, target: id) {
+ msgSend(nil, self, "setTarget:", target)
+}
+@(objc_type=MenuItem, objc_name="action")
+MenuItem_action :: #force_inline proc "c" (self: ^MenuItem) -> SEL {
+ return msgSend(SEL, self, "action")
+}
+@(objc_type=MenuItem, objc_name="setAction")
+MenuItem_setAction :: #force_inline proc "c" (self: ^MenuItem, action: SEL) {
+ msgSend(nil, self, "setAction:", action)
+}
+@(objc_type=MenuItem, objc_name="tag")
+MenuItem_tag :: #force_inline proc "c" (self: ^MenuItem) -> Integer {
+ return msgSend(Integer, self, "tag")
+}
+@(objc_type=MenuItem, objc_name="setTag")
+MenuItem_setTag :: #force_inline proc "c" (self: ^MenuItem, tag: Integer) {
+ msgSend(nil, self, "setTag:", tag)
+}
+@(objc_type=MenuItem, objc_name="representedObject")
+MenuItem_representedObject :: #force_inline proc "c" (self: ^MenuItem) -> id {
+ return msgSend(id, self, "representedObject")
+}
+@(objc_type=MenuItem, objc_name="setRepresentedObject")
+MenuItem_setRepresentedObject :: #force_inline proc "c" (self: ^MenuItem, representedObject: id) {
+ msgSend(nil, self, "setRepresentedObject:", representedObject)
+}
+@(objc_type=MenuItem, objc_name="view")
+MenuItem_view :: #force_inline proc "c" (self: ^MenuItem) -> ^View {
+ return msgSend(^View, self, "view")
+}
+@(objc_type=MenuItem, objc_name="setView")
+MenuItem_setView :: #force_inline proc "c" (self: ^MenuItem, view: ^View) {
+ msgSend(nil, self, "setView:", view)
+}
+@(objc_type=MenuItem, objc_name="isHighlighted")
+MenuItem_isHighlighted :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isHighlighted")
+}
+@(objc_type=MenuItem, objc_name="isHidden")
+MenuItem_isHidden :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isHidden")
+}
+@(objc_type=MenuItem, objc_name="setHidden")
+MenuItem_setHidden :: #force_inline proc "c" (self: ^MenuItem, hidden: bool) {
+ msgSend(nil, self, "setHidden:", hidden)
+}
+@(objc_type=MenuItem, objc_name="isHiddenOrHasHiddenAncestor")
+MenuItem_isHiddenOrHasHiddenAncestor :: #force_inline proc "c" (self: ^MenuItem) -> bool {
+ return msgSend(bool, self, "isHiddenOrHasHiddenAncestor")
+}
+@(objc_type=MenuItem, objc_name="toolTip")
+MenuItem_toolTip :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
+ return msgSend(^String, self, "toolTip")
+}
+@(objc_type=MenuItem, objc_name="setToolTip")
+MenuItem_setToolTip :: #force_inline proc "c" (self: ^MenuItem, toolTip: ^String) {
+ msgSend(nil, self, "setToolTip:", toolTip)
+}
+// @(objc_type=MenuItem, objc_name="badge")
+// MenuItem_badge :: #force_inline proc "c" (self: ^MenuItem) -> ^MenuItemBadge {
+// return msgSend(^MenuItemBadge, self, "badge")
+// }
+// @(objc_type=MenuItem, objc_name="setBadge")
+// MenuItem_setBadge :: #force_inline proc "c" (self: ^MenuItem, badge: ^MenuItemBadge) {
+// msgSend(nil, self, "setBadge:", badge)
+// }
+@(objc_type=MenuItem, objc_name="setMnemonicLocation")
+MenuItem_setMnemonicLocation :: #force_inline proc "c" (self: ^MenuItem, location: UInteger) {
+ msgSend(nil, self, "setMnemonicLocation:", location)
+}
+@(objc_type=MenuItem, objc_name="mnemonicLocation")
+MenuItem_mnemonicLocation :: #force_inline proc "c" (self: ^MenuItem) -> UInteger {
+ return msgSend(UInteger, self, "mnemonicLocation")
+}
+@(objc_type=MenuItem, objc_name="mnemonic")
+MenuItem_mnemonic :: #force_inline proc "c" (self: ^MenuItem) -> ^String {
+ return msgSend(^String, self, "mnemonic")
+}
+@(objc_type=MenuItem, objc_name="setTitleWithMnemonic")
+MenuItem_setTitleWithMnemonic :: #force_inline proc "c" (self: ^MenuItem, stringWithAmpersand: ^String) {
+ msgSend(nil, self, "setTitleWithMnemonic:", stringWithAmpersand)
+}
+@(objc_type=MenuItem, objc_name="load", objc_is_class_method=true)
+MenuItem_load :: #force_inline proc "c" () {
+ msgSend(nil, MenuItem, "load")
+}
+@(objc_type=MenuItem, objc_name="initialize", objc_is_class_method=true)
+MenuItem_initialize :: #force_inline proc "c" () {
+ msgSend(nil, MenuItem, "initialize")
+}
+@(objc_type=MenuItem, objc_name="new", objc_is_class_method=true)
+MenuItem_new :: #force_inline proc "c" () -> ^MenuItem {
+ return msgSend(^MenuItem, MenuItem, "new")
+}
+@(objc_type=MenuItem, objc_name="allocWithZone", objc_is_class_method=true)
+MenuItem_allocWithZone :: #force_inline proc "c" (zone: ^Zone) -> ^MenuItem {
+ return msgSend(^MenuItem, MenuItem, "allocWithZone:", zone)
+}
+@(objc_type=MenuItem, objc_name="alloc", objc_is_class_method=true)
+MenuItem_alloc :: #force_inline proc "c" () -> ^MenuItem {
+ return msgSend(^MenuItem, MenuItem, "alloc")
+}
+@(objc_type=MenuItem, objc_name="copyWithZone", objc_is_class_method=true)
+MenuItem_copyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
+ return msgSend(id, MenuItem, "copyWithZone:", zone)
+}
+@(objc_type=MenuItem, objc_name="mutableCopyWithZone", objc_is_class_method=true)
+MenuItem_mutableCopyWithZone :: #force_inline proc "c" (zone: ^Zone) -> id {
+ return msgSend(id, MenuItem, "mutableCopyWithZone:", zone)
+}
+@(objc_type=MenuItem, objc_name="instancesRespondToSelector", objc_is_class_method=true)
+MenuItem_instancesRespondToSelector :: #force_inline proc "c" (aSelector: SEL) -> bool {
+ return msgSend(bool, MenuItem, "instancesRespondToSelector:", aSelector)
+}
+@(objc_type=MenuItem, objc_name="conformsToProtocol", objc_is_class_method=true)
+MenuItem_conformsToProtocol :: #force_inline proc "c" (protocol: ^Protocol) -> bool {
+ return msgSend(bool, MenuItem, "conformsToProtocol:", protocol)
+}
+@(objc_type=MenuItem, objc_name="instanceMethodForSelector", objc_is_class_method=true)
+MenuItem_instanceMethodForSelector :: #force_inline proc "c" (aSelector: SEL) -> IMP {
+ return msgSend(IMP, MenuItem, "instanceMethodForSelector:", aSelector)
+}
+// @(objc_type=MenuItem, objc_name="instanceMethodSignatureForSelector", objc_is_class_method=true)
+// MenuItem_instanceMethodSignatureForSelector :: #force_inline proc "c" (aSelector: SEL) -> ^MethodSignature {
+// return msgSend(^MethodSignature, MenuItem, "instanceMethodSignatureForSelector:", aSelector)
+// }
+@(objc_type=MenuItem, objc_name="isSubclassOfClass", objc_is_class_method=true)
+MenuItem_isSubclassOfClass :: #force_inline proc "c" (aClass: Class) -> bool {
+ return msgSend(bool, MenuItem, "isSubclassOfClass:", aClass)
+}
+@(objc_type=MenuItem, objc_name="resolveClassMethod", objc_is_class_method=true)
+MenuItem_resolveClassMethod :: #force_inline proc "c" (sel: SEL) -> bool {
+ return msgSend(bool, MenuItem, "resolveClassMethod:", sel)
+}
+@(objc_type=MenuItem, objc_name="resolveInstanceMethod", objc_is_class_method=true)
+MenuItem_resolveInstanceMethod :: #force_inline proc "c" (sel: SEL) -> bool {
+ return msgSend(bool, MenuItem, "resolveInstanceMethod:", sel)
+}
+@(objc_type=MenuItem, objc_name="hash", objc_is_class_method=true)
+MenuItem_hash :: #force_inline proc "c" () -> UInteger {
+ return msgSend(UInteger, MenuItem, "hash")
+}
+@(objc_type=MenuItem, objc_name="superclass", objc_is_class_method=true)
+MenuItem_superclass :: #force_inline proc "c" () -> Class {
+ return msgSend(Class, MenuItem, "superclass")
+}
+@(objc_type=MenuItem, objc_name="class", objc_is_class_method=true)
+MenuItem_class :: #force_inline proc "c" () -> Class {
+ return msgSend(Class, MenuItem, "class")
+}
+@(objc_type=MenuItem, objc_name="description", objc_is_class_method=true)
+MenuItem_description :: #force_inline proc "c" () -> ^String {
+ return msgSend(^String, MenuItem, "description")
+}
+@(objc_type=MenuItem, objc_name="debugDescription", objc_is_class_method=true)
+MenuItem_debugDescription :: #force_inline proc "c" () -> ^String {
+ return msgSend(^String, MenuItem, "debugDescription")
+}
+@(objc_type=MenuItem, objc_name="version", objc_is_class_method=true)
+MenuItem_version :: #force_inline proc "c" () -> Integer {
+ return msgSend(Integer, MenuItem, "version")
+}
+@(objc_type=MenuItem, objc_name="setVersion", objc_is_class_method=true)
+MenuItem_setVersion :: #force_inline proc "c" (aVersion: Integer) {
+ msgSend(nil, MenuItem, "setVersion:", aVersion)
+}
+@(objc_type=MenuItem, objc_name="poseAsClass", objc_is_class_method=true)
+MenuItem_poseAsClass :: #force_inline proc "c" (aClass: Class) {
+ msgSend(nil, MenuItem, "poseAsClass:", aClass)
+}
+@(objc_type=MenuItem, objc_name="cancelPreviousPerformRequestsWithTarget_selector_object", objc_is_class_method=true)
+MenuItem_cancelPreviousPerformRequestsWithTarget_selector_object :: #force_inline proc "c" (aTarget: id, aSelector: SEL, anArgument: id) {
+ msgSend(nil, MenuItem, "cancelPreviousPerformRequestsWithTarget:selector:object:", aTarget, aSelector, anArgument)
+}
+@(objc_type=MenuItem, objc_name="cancelPreviousPerformRequestsWithTarget_", objc_is_class_method=true)
+MenuItem_cancelPreviousPerformRequestsWithTarget_ :: #force_inline proc "c" (aTarget: id) {
+ msgSend(nil, MenuItem, "cancelPreviousPerformRequestsWithTarget:", aTarget)
+}
+@(objc_type=MenuItem, objc_name="accessInstanceVariablesDirectly", objc_is_class_method=true)
+MenuItem_accessInstanceVariablesDirectly :: #force_inline proc "c" () -> bool {
+ return msgSend(bool, MenuItem, "accessInstanceVariablesDirectly")
+}
+@(objc_type=MenuItem, objc_name="useStoredAccessor", objc_is_class_method=true)
+MenuItem_useStoredAccessor :: #force_inline proc "c" () -> bool {
+ return msgSend(bool, MenuItem, "useStoredAccessor")
+}
+@(objc_type=MenuItem, objc_name="keyPathsForValuesAffectingValueForKey", objc_is_class_method=true)
+MenuItem_keyPathsForValuesAffectingValueForKey :: #force_inline proc "c" (key: ^String) -> ^Set {
+ return msgSend(^Set, MenuItem, "keyPathsForValuesAffectingValueForKey:", key)
+}
+@(objc_type=MenuItem, objc_name="automaticallyNotifiesObserversForKey", objc_is_class_method=true)
+MenuItem_automaticallyNotifiesObserversForKey :: #force_inline proc "c" (key: ^String) -> bool {
+ return msgSend(bool, MenuItem, "automaticallyNotifiesObserversForKey:", key)
+}
+@(objc_type=MenuItem, objc_name="setKeys", objc_is_class_method=true)
+MenuItem_setKeys :: #force_inline proc "c" (keys: ^Array, dependentKey: ^String) {
+ msgSend(nil, MenuItem, "setKeys:triggerChangeNotificationsForDependentKey:", keys, dependentKey)
+}
+@(objc_type=MenuItem, objc_name="classFallbacksForKeyedArchiver", objc_is_class_method=true)
+MenuItem_classFallbacksForKeyedArchiver :: #force_inline proc "c" () -> ^Array {
+ return msgSend(^Array, MenuItem, "classFallbacksForKeyedArchiver")
+}
+@(objc_type=MenuItem, objc_name="classForKeyedUnarchiver", objc_is_class_method=true)
+MenuItem_classForKeyedUnarchiver :: #force_inline proc "c" () -> Class {
+ return msgSend(Class, MenuItem, "classForKeyedUnarchiver")
+}
+@(objc_type=MenuItem, objc_name="exposeBinding", objc_is_class_method=true)
+MenuItem_exposeBinding :: #force_inline proc "c" (binding: ^String) {
+ msgSend(nil, MenuItem, "exposeBinding:", binding)
+}
+@(objc_type=MenuItem, objc_name="setDefaultPlaceholder", objc_is_class_method=true)
+MenuItem_setDefaultPlaceholder :: #force_inline proc "c" (placeholder: id, marker: id, binding: ^String) {
+ msgSend(nil, MenuItem, "setDefaultPlaceholder:forMarker:withBinding:", placeholder, marker, binding)
+}
+@(objc_type=MenuItem, objc_name="defaultPlaceholderForMarker", objc_is_class_method=true)
+MenuItem_defaultPlaceholderForMarker :: #force_inline proc "c" (marker: id, binding: ^String) -> id {
+ return msgSend(id, MenuItem, "defaultPlaceholderForMarker:withBinding:", marker, binding)
+}
+@(objc_type=MenuItem, objc_name="cancelPreviousPerformRequestsWithTarget")
+MenuItem_cancelPreviousPerformRequestsWithTarget :: proc {
+ MenuItem_cancelPreviousPerformRequestsWithTarget_selector_object,
+ MenuItem_cancelPreviousPerformRequestsWithTarget_,
+} \ No newline at end of file
diff --git a/core/sys/darwin/Foundation/NSWindow.odin b/core/sys/darwin/Foundation/NSWindow.odin
index 57ac2b6f6..f113dd3df 100644
--- a/core/sys/darwin/Foundation/NSWindow.odin
+++ b/core/sys/darwin/Foundation/NSWindow.odin
@@ -146,7 +146,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
return nil
}
if template.windowWillPositionSheetUsingRect != nil {
- windowWillPositionSheetUsingRect :: proc "c" (self: id, window: ^Window, sheet: ^Window, rect: Rect) -> Rect {
+ windowWillPositionSheetUsingRect :: proc "c" (self: id, cmd: SEL, window: ^Window, sheet: ^Window, rect: Rect) -> Rect {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillPositionSheetUsingRect(window, sheet, rect)
@@ -154,7 +154,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willPositionSheet:usingRect:"), auto_cast windowWillPositionSheetUsingRect, _RECT_ENCODING+"@:@@"+_RECT_ENCODING)
}
if template.windowWillBeginSheet != nil {
- windowWillBeginSheet :: proc "c" (self: id, notification: ^Notification) {
+ windowWillBeginSheet :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillBeginSheet(notification)
@@ -162,7 +162,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillBeginSheet:"), auto_cast windowWillBeginSheet, "v@:@")
}
if template.windowDidEndSheet != nil {
- windowDidEndSheet :: proc "c" (self: id, notification: ^Notification) {
+ windowDidEndSheet :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEndSheet(notification)
@@ -170,7 +170,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEndSheet:"), auto_cast windowDidEndSheet, "v@:@")
}
if template.windowWillResizeToSize != nil {
- windowWillResizeToSize :: proc "c" (self: id, sender: ^Window, frameSize: Size) -> Size {
+ windowWillResizeToSize :: proc "c" (self: id, cmd: SEL, sender: ^Window, frameSize: Size) -> Size {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillResizeToSize(sender, frameSize)
@@ -178,7 +178,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillResize:toSize:"), auto_cast windowWillResizeToSize, _SIZE_ENCODING+"@:@"+_SIZE_ENCODING)
}
if template.windowDidResize != nil {
- windowDidResize :: proc "c" (self: id, notification: ^Notification) {
+ windowDidResize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidResize(notification)
@@ -186,7 +186,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidResize:"), auto_cast windowDidResize, "v@:@")
}
if template.windowWillStartLiveResize != nil {
- windowWillStartLiveResize :: proc "c" (self: id, notification: ^Notification) {
+ windowWillStartLiveResize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillStartLiveResize(notification)
@@ -194,7 +194,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillStartLiveResize:"), auto_cast windowWillStartLiveResize, "v@:@")
}
if template.windowDidEndLiveResize != nil {
- windowDidEndLiveResize :: proc "c" (self: id, notification: ^Notification) {
+ windowDidEndLiveResize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEndLiveResize(notification)
@@ -202,7 +202,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEndLiveResize:"), auto_cast windowDidEndLiveResize, "v@:@")
}
if template.windowWillMiniaturize != nil {
- windowWillMiniaturize :: proc "c" (self: id, notification: ^Notification) {
+ windowWillMiniaturize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillMiniaturize(notification)
@@ -210,7 +210,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillMiniaturize:"), auto_cast windowWillMiniaturize, "v@:@")
}
if template.windowDidMiniaturize != nil {
- windowDidMiniaturize :: proc "c" (self: id, notification: ^Notification) {
+ windowDidMiniaturize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidMiniaturize(notification)
@@ -218,7 +218,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidMiniaturize:"), auto_cast windowDidMiniaturize, "v@:@")
}
if template.windowDidDeminiaturize != nil {
- windowDidDeminiaturize :: proc "c" (self: id, notification: ^Notification) {
+ windowDidDeminiaturize :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidDeminiaturize(notification)
@@ -226,7 +226,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidDeminiaturize:"), auto_cast windowDidDeminiaturize, "v@:@")
}
if template.windowWillUseStandardFrameDefaultFrame != nil {
- windowWillUseStandardFrameDefaultFrame :: proc(self: id, window: ^Window, newFrame: Rect) -> Rect {
+ windowWillUseStandardFrameDefaultFrame :: proc(self: id, cmd: SEL, window: ^Window, newFrame: Rect) -> Rect {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillUseStandardFrameDefaultFrame(window, newFrame)
@@ -234,7 +234,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillUseStandardFrame:defaultFrame:"), auto_cast windowWillUseStandardFrameDefaultFrame, _RECT_ENCODING+"@:@"+_RECT_ENCODING)
}
if template.windowShouldZoomToFrame != nil {
- windowShouldZoomToFrame :: proc "c" (self: id, window: ^Window, newFrame: Rect) -> BOOL {
+ windowShouldZoomToFrame :: proc "c" (self: id, cmd: SEL, window: ^Window, newFrame: Rect) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldZoomToFrame(window, newFrame)
@@ -242,7 +242,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowShouldZoom:toFrame:"), auto_cast windowShouldZoomToFrame, "B@:@"+_RECT_ENCODING)
}
if template.windowWillUseFullScreenContentSize != nil {
- windowWillUseFullScreenContentSize :: proc "c" (self: id, window: ^Window, proposedSize: Size) -> Size {
+ windowWillUseFullScreenContentSize :: proc "c" (self: id, cmd: SEL, window: ^Window, proposedSize: Size) -> Size {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillUseFullScreenContentSize(window, proposedSize)
@@ -250,7 +250,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willUseFullScreenContentSize:"), auto_cast windowWillUseFullScreenContentSize, _SIZE_ENCODING+"@:@"+_SIZE_ENCODING)
}
if template.windowWillUseFullScreenPresentationOptions != nil {
- windowWillUseFullScreenPresentationOptions :: proc(self: id, window: ^Window, proposedOptions: ApplicationPresentationOptions) -> ApplicationPresentationOptions {
+ windowWillUseFullScreenPresentationOptions :: proc(self: id, cmd: SEL, window: ^Window, proposedOptions: ApplicationPresentationOptions) -> ApplicationPresentationOptions {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillUseFullScreenPresentationOptions(window, proposedOptions)
@@ -258,7 +258,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willUseFullScreenPresentationOptions:"), auto_cast windowWillUseFullScreenPresentationOptions, _UINTEGER_ENCODING+"@:@"+_UINTEGER_ENCODING)
}
if template.windowWillEnterFullScreen != nil {
- windowWillEnterFullScreen :: proc "c" (self: id, notification: ^Notification) {
+ windowWillEnterFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillEnterFullScreen(notification)
@@ -266,7 +266,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillEnterFullScreen:"), auto_cast windowWillEnterFullScreen, "v@:@")
}
if template.windowDidEnterFullScreen != nil {
- windowDidEnterFullScreen :: proc "c" (self: id, notification: ^Notification) {
+ windowDidEnterFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEnterFullScreen(notification)
@@ -274,7 +274,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEnterFullScreen:"), auto_cast windowDidEnterFullScreen, "v@:@")
}
if template.windowWillExitFullScreen != nil {
- windowWillExitFullScreen :: proc "c" (self: id, notification: ^Notification) {
+ windowWillExitFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillExitFullScreen(notification)
@@ -282,7 +282,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillExitFullScreen:"), auto_cast windowWillExitFullScreen, "v@:@")
}
if template.windowDidExitFullScreen != nil {
- windowDidExitFullScreen :: proc "c" (self: id, notification: ^Notification) {
+ windowDidExitFullScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidExitFullScreen(notification)
@@ -290,7 +290,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidExitFullScreen:"), auto_cast windowDidExitFullScreen, "v@:@")
}
if template.customWindowsToEnterFullScreenForWindow != nil {
- customWindowsToEnterFullScreenForWindow :: proc "c" (self: id, window: ^Window) -> ^Array {
+ customWindowsToEnterFullScreenForWindow :: proc "c" (self: id, cmd: SEL, window: ^Window) -> ^Array {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.customWindowsToEnterFullScreenForWindow(window)
@@ -298,7 +298,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("customWindowsToEnterFullScreenForWindow:"), auto_cast customWindowsToEnterFullScreenForWindow, "@@:@")
}
if template.customWindowsToEnterFullScreenForWindowOnScreen != nil {
- customWindowsToEnterFullScreenForWindowOnScreen :: proc(self: id, window: ^Window, screen: ^Screen) -> ^Array {
+ customWindowsToEnterFullScreenForWindowOnScreen :: proc(self: id, cmd: SEL, window: ^Window, screen: ^Screen) -> ^Array {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.customWindowsToEnterFullScreenForWindowOnScreen(window, screen)
@@ -306,7 +306,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("customWindowsToEnterFullScreenForWindow:onScreen:"), auto_cast customWindowsToEnterFullScreenForWindowOnScreen, "@@:@@")
}
if template.windowStartCustomAnimationToEnterFullScreenWithDuration != nil {
- windowStartCustomAnimationToEnterFullScreenWithDuration :: proc "c" (self: id, window: ^Window, duration: TimeInterval) {
+ windowStartCustomAnimationToEnterFullScreenWithDuration :: proc "c" (self: id, cmd: SEL, window: ^Window, duration: TimeInterval) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowStartCustomAnimationToEnterFullScreenWithDuration(window, duration)
@@ -314,7 +314,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:startCustomAnimationToEnterFullScreenWithDuration:"), auto_cast windowStartCustomAnimationToEnterFullScreenWithDuration, "v@:@@")
}
if template.windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration != nil {
- windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration :: proc(self: id, window: ^Window, screen: ^Screen, duration: TimeInterval) {
+ windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration :: proc(self: id, cmd: SEL, window: ^Window, screen: ^Screen, duration: TimeInterval) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration(window, screen, duration)
@@ -322,7 +322,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:startCustomAnimationToEnterFullScreenOnScreen:withDuration:"), auto_cast windowStartCustomAnimationToEnterFullScreenOnScreenWithDuration, "v@:@@d")
}
if template.windowDidFailToEnterFullScreen != nil {
- windowDidFailToEnterFullScreen :: proc "c" (self: id, window: ^Window) {
+ windowDidFailToEnterFullScreen :: proc "c" (self: id, cmd: SEL, window: ^Window) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidFailToEnterFullScreen(window)
@@ -330,7 +330,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidFailToEnterFullScreen:"), auto_cast windowDidFailToEnterFullScreen, "v@:@")
}
if template.customWindowsToExitFullScreenForWindow != nil {
- customWindowsToExitFullScreenForWindow :: proc "c" (self: id, window: ^Window) -> ^Array {
+ customWindowsToExitFullScreenForWindow :: proc "c" (self: id, cmd: SEL, window: ^Window) -> ^Array {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.customWindowsToExitFullScreenForWindow(window)
@@ -338,7 +338,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("customWindowsToExitFullScreenForWindow:"), auto_cast customWindowsToExitFullScreenForWindow, "@@:@")
}
if template.windowStartCustomAnimationToExitFullScreenWithDuration != nil {
- windowStartCustomAnimationToExitFullScreenWithDuration :: proc "c" (self: id, window: ^Window, duration: TimeInterval) {
+ windowStartCustomAnimationToExitFullScreenWithDuration :: proc "c" (self: id, cmd: SEL, window: ^Window, duration: TimeInterval) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowStartCustomAnimationToExitFullScreenWithDuration(window, duration)
@@ -346,7 +346,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:startCustomAnimationToExitFullScreenWithDuration:"), auto_cast windowStartCustomAnimationToExitFullScreenWithDuration, "v@:@d")
}
if template.windowDidFailToExitFullScreen != nil {
- windowDidFailToExitFullScreen :: proc "c" (self: id, window: ^Window) {
+ windowDidFailToExitFullScreen :: proc "c" (self: id, cmd: SEL, window: ^Window) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidFailToExitFullScreen(window)
@@ -354,7 +354,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidFailToExitFullScreen:"), auto_cast windowDidFailToExitFullScreen, "v@:@")
}
if template.windowWillMove != nil {
- windowWillMove :: proc "c" (self: id, notification: ^Notification) {
+ windowWillMove :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillMove(notification)
@@ -362,7 +362,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillMove:"), auto_cast windowWillMove, "v@:@")
}
if template.windowDidMove != nil {
- windowDidMove :: proc "c" (self: id, notification: ^Notification) {
+ windowDidMove :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidMove(notification)
@@ -370,7 +370,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidMove:"), auto_cast windowDidMove, "v@:@")
}
if template.windowDidChangeScreen != nil {
- windowDidChangeScreen :: proc "c" (self: id, notification: ^Notification) {
+ windowDidChangeScreen :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeScreen(notification)
@@ -378,7 +378,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeScreen:"), auto_cast windowDidChangeScreen, "v@:@")
}
if template.windowDidChangeScreenProfile != nil {
- windowDidChangeScreenProfile :: proc "c" (self: id, notification: ^Notification) {
+ windowDidChangeScreenProfile :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeScreenProfile(notification)
@@ -386,7 +386,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeScreenProfile:"), auto_cast windowDidChangeScreenProfile, "v@:@")
}
if template.windowDidChangeBackingProperties != nil {
- windowDidChangeBackingProperties :: proc "c" (self: id, notification: ^Notification) {
+ windowDidChangeBackingProperties :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeBackingProperties(notification)
@@ -394,7 +394,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeBackingProperties:"), auto_cast windowDidChangeBackingProperties, "v@:@")
}
if template.windowShouldClose != nil {
- windowShouldClose :: proc "c" (self:id, sender: ^Window) -> BOOL {
+ windowShouldClose :: proc "c" (self:id, cmd: SEL, sender: ^Window) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldClose(sender)
@@ -402,7 +402,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowShouldClose:"), auto_cast windowShouldClose, "B@:@")
}
if template.windowWillClose != nil {
- windowWillClose :: proc "c" (self:id, notification: ^Notification) {
+ windowWillClose :: proc "c" (self:id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillClose(notification)
@@ -410,7 +410,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillClose:"), auto_cast windowWillClose, "v@:@")
}
if template.windowDidBecomeKey != nil {
- windowDidBecomeKey :: proc "c" (self: id, notification: ^Notification) {
+ windowDidBecomeKey :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidBecomeKey(notification)
@@ -418,7 +418,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidBecomeKey:"), auto_cast windowDidBecomeKey, "v@:@")
}
if template.windowDidResignKey != nil {
- windowDidResignKey :: proc "c" (self: id, notification: ^Notification) {
+ windowDidResignKey :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidResignKey(notification)
@@ -426,7 +426,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidResignKey:"), auto_cast windowDidResignKey, "v@:@")
}
if template.windowDidBecomeMain != nil {
- windowDidBecomeMain :: proc "c" (self: id, notification: ^Notification) {
+ windowDidBecomeMain :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidBecomeMain(notification)
@@ -434,7 +434,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidBecomeMain:"), auto_cast windowDidBecomeMain, "v@:@")
}
if template.windowDidResignMain != nil {
- windowDidResignMain :: proc "c" (self: id, notification: ^Notification) {
+ windowDidResignMain :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidResignMain(notification)
@@ -442,7 +442,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidResignMain:"), auto_cast windowDidResignMain, "v@:@")
}
if template.windowWillReturnFieldEditorToObject != nil {
- windowWillReturnFieldEditorToObject :: proc "c" (self:id, sender: ^Window, client: id) -> id {
+ windowWillReturnFieldEditorToObject :: proc "c" (self:id, cmd: SEL, sender: ^Window, client: id) -> id {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillReturnFieldEditorToObject(sender, client)
@@ -450,7 +450,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillReturnFieldEditor:toObject:"), auto_cast windowWillReturnFieldEditorToObject, "@@:@@")
}
if template.windowDidUpdate != nil {
- windowDidUpdate :: proc "c" (self: id, notification: ^Notification) {
+ windowDidUpdate :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidUpdate(notification)
@@ -458,7 +458,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidUpdate:"), auto_cast windowDidUpdate, "v@:@")
}
if template.windowDidExpose != nil {
- windowDidExpose :: proc "c" (self: id, notification: ^Notification) {
+ windowDidExpose :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidExpose(notification)
@@ -466,7 +466,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidExpose:"), auto_cast windowDidExpose, "v@:@")
}
if template.windowDidChangeOcclusionState != nil {
- windowDidChangeOcclusionState :: proc "c" (self: id, notification: ^Notification) {
+ windowDidChangeOcclusionState :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidChangeOcclusionState(notification)
@@ -474,7 +474,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidChangeOcclusionState:"), auto_cast windowDidChangeOcclusionState, "v@:@")
}
if template.windowShouldDragDocumentWithEventFromWithPasteboard != nil {
- windowShouldDragDocumentWithEventFromWithPasteboard :: proc "c" (self: id, window: ^Window, event: ^Event, dragImageLocation: Point, pasteboard: ^Pasteboard) -> BOOL {
+ windowShouldDragDocumentWithEventFromWithPasteboard :: proc "c" (self: id, cmd: SEL, window: ^Window, event: ^Event, dragImageLocation: Point, pasteboard: ^Pasteboard) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldDragDocumentWithEventFromWithPasteboard(window, event, dragImageLocation, pasteboard)
@@ -482,7 +482,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:shouldDragDocumentWithEvent:from:withPasteboard:"), auto_cast windowShouldDragDocumentWithEventFromWithPasteboard, "B@:@@"+_POINT_ENCODING+"@")
}
if template.windowWillReturnUndoManager != nil {
- windowWillReturnUndoManager :: proc "c" (self: id, window: ^Window) -> ^UndoManager {
+ windowWillReturnUndoManager :: proc "c" (self: id, cmd: SEL, window: ^Window) -> ^UndoManager {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillReturnUndoManager(window)
@@ -490,7 +490,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillReturnUndoManager:"), auto_cast windowWillReturnUndoManager, "@@:@")
}
if template.windowShouldPopUpDocumentPathMenu != nil {
- windowShouldPopUpDocumentPathMenu :: proc "c" (self: id, window: ^Window, menu: ^Menu) -> BOOL {
+ windowShouldPopUpDocumentPathMenu :: proc "c" (self: id, cmd: SEL, window: ^Window, menu: ^Menu) -> BOOL {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowShouldPopUpDocumentPathMenu(window, menu)
@@ -498,7 +498,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:shouldPopUpDocumentPathMenu:"), auto_cast windowShouldPopUpDocumentPathMenu, "B@:@@")
}
if template.windowWillEncodeRestorableState != nil {
- windowWillEncodeRestorableState :: proc "c" (self: id, window: ^Window, state: ^Coder) {
+ windowWillEncodeRestorableState :: proc "c" (self: id, cmd: SEL, window: ^Window, state: ^Coder) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillEncodeRestorableState(window, state)
@@ -506,7 +506,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willEncodeRestorableState:"), auto_cast windowWillEncodeRestorableState, "v@:@@")
}
if template.windowDidEncodeRestorableState != nil {
- windowDidEncodeRestorableState :: proc "c" (self: id, window: ^Window, state: ^Coder) {
+ windowDidEncodeRestorableState :: proc "c" (self: id, cmd: SEL, window: ^Window, state: ^Coder) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEncodeRestorableState(window, state)
@@ -514,7 +514,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:didDecodeRestorableState:"), auto_cast windowDidEncodeRestorableState, "v@:@@")
}
if template.windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize != nil {
- windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize :: proc "c" (self: id, window: ^Window, maxPreferredFrameSize: Size, maxAllowedFrameSize: Size) -> Size {
+ windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize :: proc "c" (self: id, cmd: SEL, window: ^Window, maxPreferredFrameSize: Size, maxAllowedFrameSize: Size) -> Size {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
return del.windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize(window, maxPreferredFrameSize, maxPreferredFrameSize)
@@ -522,7 +522,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("window:willResizeForVersionBrowserWithMaxPreferredSize:maxAllowedSize:"), auto_cast windowWillResizeForVersionBrowserWithMaxPreferredSizeMaxAllowedSize, _SIZE_ENCODING+"@:@"+_SIZE_ENCODING+_SIZE_ENCODING)
}
if template.windowWillEnterVersionBrowser != nil {
- windowWillEnterVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
+ windowWillEnterVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillEnterVersionBrowser(notification)
@@ -530,7 +530,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillEnterVersionBrowser:"), auto_cast windowWillEnterVersionBrowser, "v@:@")
}
if template.windowDidEnterVersionBrowser != nil {
- windowDidEnterVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
+ windowDidEnterVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidEnterVersionBrowser(notification)
@@ -538,7 +538,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowDidEnterVersionBrowser:"), auto_cast windowDidEnterVersionBrowser, "v@:@")
}
if template.windowWillExitVersionBrowser != nil {
- windowWillExitVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
+ windowWillExitVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowWillExitVersionBrowser(notification)
@@ -546,7 +546,7 @@ window_delegate_register_and_alloc :: proc(template: WindowDelegateTemplate, cla
class_addMethod(class, intrinsics.objc_find_selector("windowWillExitVersionBrowser:"), auto_cast windowWillExitVersionBrowser, "v@:@")
}
if template.windowDidExitVersionBrowser != nil {
- windowDidExitVersionBrowser :: proc "c" (self: id, notification: ^Notification) {
+ windowDidExitVersionBrowser :: proc "c" (self: id, cmd: SEL, notification: ^Notification) {
del := cast(^_WindowDelegateInternal)object_getIndexedIvars(self)
context = del._context
del.windowDidExitVersionBrowser(notification)
@@ -780,4 +780,4 @@ Window_performWindowDragWithEvent :: proc "c" (self: ^Window, event: ^Event) {
@(objc_type=Window, objc_name="setToolbar")
Window_setToolbar :: proc "c" (self: ^Window, toolbar: ^Toolbar) {
msgSend(nil, self, "setToolbar:", toolbar)
-} \ No newline at end of file
+}
diff --git a/core/sys/darwin/Foundation/objc_helper.odin b/core/sys/darwin/Foundation/objc_helper.odin
new file mode 100644
index 000000000..0748d700b
--- /dev/null
+++ b/core/sys/darwin/Foundation/objc_helper.odin
@@ -0,0 +1,136 @@
+package objc_Foundation
+
+import "base:runtime"
+import "base:intrinsics"
+
+Subclasser_Proc :: proc(cls: Class, vtable: rawptr)
+
+Object_VTable_Info :: struct {
+ vtable: rawptr,
+ size: uint,
+ impl: Subclasser_Proc,
+}
+
+Class_VTable_Info :: struct {
+ _context: runtime.Context,
+ super_vtable: rawptr,
+ protocol_vtable: rawptr,
+}
+
+@(require_results)
+class_get_metaclass :: #force_inline proc "contextless" (cls: Class) -> Class {
+ return (^Class)(cls)^
+}
+
+@(require_results)
+object_get_vtable_info :: proc "contextless" (obj: id) -> ^Class_VTable_Info {
+ return (^Class_VTable_Info)(object_getIndexedIvars(obj))
+}
+
+@(require_results)
+make_subclasser :: #force_inline proc(vtable: ^$T, impl: proc(cls: Class, vt: ^T)) -> Object_VTable_Info {
+ return Object_VTable_Info{
+ vtable = vtable,
+ size = size_of(T),
+ impl = (Subclasser_Proc)(impl),
+ }
+}
+
+@(require_results)
+register_subclass :: proc(
+ class_name: cstring,
+ superclass: Class,
+ superclass_overrides: Maybe(Object_VTable_Info) = nil,
+ protocol: Maybe(Object_VTable_Info) = nil,
+ _context: Maybe(runtime.Context) = nil,
+) -> Class {
+ assert(superclass != nil)
+
+ super_size: uint
+ proto_size: uint
+
+ if superclass_overrides != nil {
+ // Align to 8-byte boundary
+ super_size = (superclass_overrides.?.size + 7)/8 * 8
+ }
+
+ if protocol != nil {
+ // Align to 8-byte boundary
+ proto_size = (protocol.?.size + 7)/8 * 8
+ }
+
+ cls := objc_lookUpClass(class_name)
+ if cls != nil {
+ return cls
+ }
+
+ extra_size := uint(size_of(Class_VTable_Info)) + 8 + super_size + proto_size
+
+ cls = objc_allocateClassPair(superclass, class_name, extra_size)
+ assert(cls != nil)
+
+ if s, ok := superclass_overrides.?; ok {
+ s.impl(cls, s.vtable)
+ }
+
+ if p, ok := protocol.?; ok {
+ p.impl(cls, p.vtable)
+ }
+
+ objc_registerClassPair(cls)
+ meta_cls := class_get_metaclass(cls)
+ meta_size := uint(class_getInstanceSize(meta_cls))
+
+ // Offsets are always aligned to 8-byte boundary
+ info_offset := (meta_size + 7) / 8 * 8
+ super_vtable_offset := (info_offset + size_of(Class_VTable_Info) + 7) / 8 * 8
+ ptoto_vtable_offset := super_vtable_offset + super_size
+
+
+ p_info := (^Class_VTable_Info)(([^]u8)(cls)[info_offset:])
+ p_super_vtable := ([^]u8)(cls)[super_vtable_offset:]
+ p_proto_vtable := ([^]u8)(cls)[ptoto_vtable_offset:]
+
+ intrinsics.mem_zero(p_info, size_of(Class_VTable_Info))
+
+ // Assign the context
+ p_info._context = _context.? or_else context
+
+ if s, ok := superclass_overrides.?; ok {
+ p_info.super_vtable = p_super_vtable
+ intrinsics.mem_copy(p_super_vtable, s.vtable, super_size)
+ }
+ if p, ok := protocol.?; ok {
+ p_info.protocol_vtable = p_proto_vtable
+ intrinsics.mem_copy(p_proto_vtable, p.vtable, p.size)
+ }
+
+ return cls
+}
+
+@(require_results)
+class_get_vtable_info :: proc "contextless" (cls: Class) -> ^Class_VTable_Info {
+ meta_cls := class_get_metaclass(cls)
+ meta_size := uint(class_getInstanceSize(meta_cls))
+
+ // Align to 8-byte boundary
+ info_offset := (meta_size+7) / 8 * 8
+
+ p_cls := ([^]u8)(cls)[info_offset:]
+ ctx := (^Class_VTable_Info)(p_cls)
+ return ctx
+}
+
+@(require_results)
+alloc_user_object :: proc "contextless" (cls: Class, _context: Maybe(runtime.Context) = nil) -> id {
+ info := class_get_vtable_info(cls)
+
+ obj := class_createInstance(cls, size_of(Class_VTable_Info))
+ obj_info := (^Class_VTable_Info)(object_getIndexedIvars(obj))
+ obj_info^ = info^
+
+ if _context != nil {
+ obj_info._context = _context.?
+ }
+ return obj
+} \ No newline at end of file
diff --git a/core/sys/darwin/copyfile.odin b/core/sys/darwin/copyfile.odin
new file mode 100644
index 000000000..6c58b8067
--- /dev/null
+++ b/core/sys/darwin/copyfile.odin
@@ -0,0 +1,67 @@
+package darwin
+
+import "core:sys/posix"
+
+copyfile_state_t :: distinct rawptr
+
+copyfile_flags :: bit_set[enum {
+ ACL,
+ STAT,
+ XATTR,
+ DATA,
+
+ RECURSIVE = 15,
+
+ CHECK,
+ EXCL,
+ NOFOLLOW_SRC,
+ NOFOLLOW_DST,
+ MOVE,
+ UNLINK,
+ PACK,
+ UNPACK,
+
+ CLONE,
+ CLONE_FORCE,
+ RUN_IN_PLACE,
+ DATA_SPARSE,
+ PRESERVE_DST_TRACKED,
+ VERBOSE = 30,
+}; u32]
+
+COPYFILE_SECURITY :: copyfile_flags{.STAT, .ACL}
+COPYFILE_METADATA :: COPYFILE_SECURITY + copyfile_flags{.XATTR}
+COPYFILE_ALL :: COPYFILE_METADATA + copyfile_flags{.DATA}
+
+COPYFILE_NOFOLLOW :: copyfile_flags{.NOFOLLOW_SRC, .NOFOLLOW_DST}
+
+copyfile_state_flag :: enum u32 {
+ SRC_FD = 1,
+ SRC_FILENAME,
+ DST_FD,
+ DST_FILENAME,
+ QUARANTINE,
+ STATUS_CB,
+ STATUS_CTX,
+ COPIED,
+ XATTRNAME,
+ WAS_CLONED,
+ SRC_BSIZE,
+ DST_BSIZE,
+ BSIZE,
+ FORBID_CROSS_MOUNT,
+ NOCPROTECT,
+ PRESERVE_SUID,
+ RECURSIVE_SRC_FTSENT,
+ FORBID_DST_EXISTING_SYMLINKS,
+}
+
+foreign system {
+ copyfile :: proc(from, to: cstring, state: copyfile_state_t, flags: copyfile_flags) -> i32 ---
+ fcopyfile :: proc(from, to: posix.FD, state: copyfile_state_t, flags: copyfile_flags) -> i32 ---
+
+ copyfile_state_alloc :: proc() -> copyfile_state_t ---
+ copyfile_state_free :: proc(state: copyfile_state_t) -> posix.result ---
+ copyfile_state_get :: proc(state: copyfile_state_t, flag: copyfile_state_flag, dst: rawptr) -> posix.result ---
+ copyfile_state_set :: proc(state: copyfile_state_t, flag: copyfile_state_flag, src: rawptr) -> posix.result ---
+}
diff --git a/core/sys/darwin/darwin.odin b/core/sys/darwin/darwin.odin
index d109f5544..96cfc7be6 100644
--- a/core/sys/darwin/darwin.odin
+++ b/core/sys/darwin/darwin.odin
@@ -3,6 +3,7 @@ package darwin
import "core:c"
+@(export)
foreign import system "system:System.framework"
Bool :: b8
diff --git a/core/sys/darwin/sync.odin b/core/sys/darwin/sync.odin
index 58fc7c9e4..6d68dc8f8 100644
--- a/core/sys/darwin/sync.odin
+++ b/core/sys/darwin/sync.odin
@@ -1,7 +1,5 @@
package darwin
-foreign import system "system:System.framework"
-
// #define OS_WAIT_ON_ADDR_AVAILABILITY \
// __API_AVAILABLE(macos(14.4), ios(17.4), tvos(17.4), watchos(10.4))
when ODIN_OS == .Darwin {
diff --git a/core/sys/darwin/xnu_system_call_wrappers.odin b/core/sys/darwin/xnu_system_call_wrappers.odin
index 1188091a9..6376949f4 100644
--- a/core/sys/darwin/xnu_system_call_wrappers.odin
+++ b/core/sys/darwin/xnu_system_call_wrappers.odin
@@ -19,16 +19,6 @@ X_OK :: c.int((1 << 0)) /* test for execute or search permission */
W_OK :: c.int((1 << 1)) /* test for write permission */
R_OK :: c.int((1 << 2)) /* test for read permission */
-/* copyfile flags */
-COPYFILE_ACL :: (1 << 0)
-COPYFILE_STAT :: (1 << 1)
-COPYFILE_XATTR :: (1 << 2)
-COPYFILE_DATA :: (1 << 3)
-
-COPYFILE_SECURITY :: (COPYFILE_STAT | COPYFILE_ACL)
-COPYFILE_METADATA :: (COPYFILE_SECURITY | COPYFILE_XATTR)
-COPYFILE_ALL :: (COPYFILE_METADATA | COPYFILE_DATA)
-
/* syslimits.h */
PATH_MAX :: 1024 /* max bytes in pathname */