aboutsummaryrefslogtreecommitdiff
path: root/core/sys/darwin
diff options
context:
space:
mode:
authorColin Davidson <colrdavidson@gmail.com>2025-04-26 18:22:21 -0700
committerColin Davidson <colrdavidson@gmail.com>2025-04-26 18:22:21 -0700
commitf1fdd1a8b9a53d34b59f8bac86ebba5f35189f28 (patch)
tree5d8e0f200c25ae3451f666e7292f9cc9ad3db743 /core/sys/darwin
parent78d8ed2d391e8def6b303445c82f7d143897c251 (diff)
parent7d4c3d23e6156c1b4be1f91e6d18e51a8e9814f0 (diff)
Merge branch 'master' into macharena
Diffstat (limited to 'core/sys/darwin')
-rw-r--r--core/sys/darwin/Foundation/NSBlock.odin4
-rw-r--r--core/sys/darwin/Foundation/NSData.odin17
-rw-r--r--core/sys/darwin/Foundation/NSDate.odin5
-rw-r--r--core/sys/darwin/Foundation/NSDictionary.odin4
-rw-r--r--core/sys/darwin/Foundation/NSMenu.odin16
-rw-r--r--core/sys/darwin/Foundation/NSObjectProtocol.odin5
-rw-r--r--core/sys/darwin/Foundation/NSProcessInfo.odin203
-rw-r--r--core/sys/darwin/Foundation/NSSavePanel.odin10
-rw-r--r--core/sys/darwin/Foundation/NSString.odin5
-rw-r--r--core/sys/darwin/Foundation/NSToolbar.odin14
-rw-r--r--core/sys/darwin/Foundation/NSTypes.odin4
-rw-r--r--core/sys/darwin/Foundation/NSURL.odin5
-rw-r--r--core/sys/darwin/Foundation/NSURLRequest.odin24
-rw-r--r--core/sys/darwin/Foundation/NSURLResponse.odin19
-rw-r--r--core/sys/darwin/Foundation/NSWindow.odin32
15 files changed, 363 insertions, 4 deletions
diff --git a/core/sys/darwin/Foundation/NSBlock.odin b/core/sys/darwin/Foundation/NSBlock.odin
index b9d94bfee..1ef5e8a9b 100644
--- a/core/sys/darwin/Foundation/NSBlock.odin
+++ b/core/sys/darwin/Foundation/NSBlock.odin
@@ -25,6 +25,10 @@ Block_createLocalWithParam :: proc (user_data: rawptr, user_proc: proc "c" (user
b, _ := Block_createInternalWithParam(false, user_data, user_proc, {})
return b
}
+@(objc_type=Block, objc_name="invoke")
+Block_invoke :: proc "c" (self: ^Block, args: ..any) -> ^Object {
+ return msgSend(^Object, self, "invoke:", ..args)
+}
@(private)
Internal_Block_Literal_Base :: struct {
diff --git a/core/sys/darwin/Foundation/NSData.odin b/core/sys/darwin/Foundation/NSData.odin
index 04c1ce25d..8baaf3486 100644
--- a/core/sys/darwin/Foundation/NSData.odin
+++ b/core/sys/darwin/Foundation/NSData.odin
@@ -13,6 +13,23 @@ Data_init :: proc "c" (self: ^Data) -> ^Data {
return msgSend(^Data, self, "init")
}
+@(objc_type=Data, objc_name="initWithBytes")
+Data_initWithBytes :: proc "c" (self: ^Data, bytes: []byte) -> ^Data {
+ return msgSend(^Data, self, "initWithBytes:length:", raw_data(bytes), len(bytes))
+}
+
+@(objc_type=Data, objc_name="initWithBytesNoCopy")
+Data_initWithBytesNoCopy :: proc "c" (self: ^Data, bytes: []byte, freeWhenDone: BOOL) -> ^Data {
+ return msgSend(
+ ^Data,
+ self,
+ "initWithBytesNoCopy:length:freeWhenDone:",
+ raw_data(bytes),
+ len(bytes),
+ freeWhenDone,
+ )
+}
+
@(objc_type=Data, objc_name="mutableBytes")
Data_mutableBytes :: proc "c" (self: ^Data) -> rawptr {
return msgSend(rawptr, self, "mutableBytes")
diff --git a/core/sys/darwin/Foundation/NSDate.odin b/core/sys/darwin/Foundation/NSDate.odin
index 41efb0cf5..4ba539aa4 100644
--- a/core/sys/darwin/Foundation/NSDate.odin
+++ b/core/sys/darwin/Foundation/NSDate.odin
@@ -18,6 +18,11 @@ Date_dateWithTimeIntervalSinceNow :: proc "c" (secs: TimeInterval) -> ^Date {
return msgSend(^Date, Date, "dateWithTimeIntervalSinceNow:", secs)
}
+@(objc_type=Date, objc_name="timeIntervalSince1970")
+Date_timeIntervalSince1970 :: proc "c" (self: ^Date) -> f64 {
+ return msgSend(f64, self, "timeIntervalSince1970")
+}
+
@(objc_type=Date, objc_name="distantFuture", objc_is_class_method=true)
Date_distantFuture :: proc "c" () -> ^Date {
return msgSend(^Date, Date, "distantFuture")
diff --git a/core/sys/darwin/Foundation/NSDictionary.odin b/core/sys/darwin/Foundation/NSDictionary.odin
index 8af58cf62..ed98f3168 100644
--- a/core/sys/darwin/Foundation/NSDictionary.odin
+++ b/core/sys/darwin/Foundation/NSDictionary.odin
@@ -15,7 +15,7 @@ Dictionary_dictionaryWithObject :: proc "c" (object: ^Object, forKey: ^Object) -
@(objc_type=Dictionary, objc_name="dictionaryWithObjects", objc_is_class_method=true)
Dictionary_dictionaryWithObjects :: proc "c" (objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
- return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count", objects, forKeys, count)
+ return msgSend(^Dictionary, Dictionary, "dictionaryWithObjects:forKeys:count:", objects, forKeys, count)
}
@@ -31,7 +31,7 @@ Dictionary_init :: proc "c" (self: ^Dictionary) -> ^Dictionary {
@(objc_type=Dictionary, objc_name="initWithObjects")
Dictionary_initWithObjects :: proc "c" (self: ^Dictionary, objects: [^]^Object, forKeys: [^]^Object, count: UInteger) -> ^Dictionary {
- return msgSend(^Dictionary, self, "initWithObjects:forKeys:count", objects, forKeys, count)
+ return msgSend(^Dictionary, self, "initWithObjects:forKeys:count:", objects, forKeys, count)
}
@(objc_type=Dictionary, objc_name="objectForKey")
diff --git a/core/sys/darwin/Foundation/NSMenu.odin b/core/sys/darwin/Foundation/NSMenu.odin
index e49162a7f..9a74151b0 100644
--- a/core/sys/darwin/Foundation/NSMenu.odin
+++ b/core/sys/darwin/Foundation/NSMenu.odin
@@ -30,6 +30,7 @@ MenuItem :: struct {using _: Object}
MenuItem_alloc :: proc "c" () -> ^MenuItem {
return msgSend(^MenuItem, MenuItem, "alloc")
}
+
@(objc_type=MenuItem, objc_name="registerActionCallback", objc_is_class_method=true)
MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCallback) -> SEL {
s := string(name)
@@ -50,11 +51,21 @@ MenuItem_registerActionCallback :: proc "c" (name: cstring, callback: MenuItemCa
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=MenuItem, objc_name="init")
MenuItem_init :: proc "c" (self: ^MenuItem) -> ^MenuItem {
return msgSend(^MenuItem, self, "init")
}
+@(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=MenuItem, objc_name="setKeyEquivalentModifierMask")
MenuItem_setKeyEquivalentModifierMask :: proc "c" (self: ^MenuItem, modifierMask: KeyEquivalentModifierMask) {
msgSend(nil, self, "setKeyEquivalentModifierMask:", modifierMask)
@@ -75,6 +86,11 @@ MenuItem_title :: proc "c" (self: ^MenuItem) -> ^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_class="NSMenu")
diff --git a/core/sys/darwin/Foundation/NSObjectProtocol.odin b/core/sys/darwin/Foundation/NSObjectProtocol.odin
new file mode 100644
index 000000000..99d942579
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSObjectProtocol.odin
@@ -0,0 +1,5 @@
+package objc_Foundation
+
+@(objc_class="NSObjectProtocol")
+ObjectProtocol :: struct {using _: Object}
+// TODO: implement NSObjectProtocol
diff --git a/core/sys/darwin/Foundation/NSProcessInfo.odin b/core/sys/darwin/Foundation/NSProcessInfo.odin
new file mode 100644
index 000000000..e070bf8e2
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSProcessInfo.odin
@@ -0,0 +1,203 @@
+package objc_Foundation
+
+import "base:intrinsics"
+
+import "core:c"
+
+@(objc_class="NSProcessInfo")
+ProcessInfo :: struct {using _: Object}
+
+// Getting the Process Information Agent
+
+@(objc_type=ProcessInfo, objc_name="processInfo", objc_is_class_method=true)
+ProcessInfo_processInfo :: proc "c" () -> ^ProcessInfo {
+ return msgSend(^ProcessInfo, ProcessInfo, "processInfo")
+}
+
+// Accessing Process Information
+
+@(objc_type=ProcessInfo, objc_name="arguments")
+ProcessInfo_arguments :: proc "c" (self: ^ProcessInfo) -> ^Array {
+ return msgSend(^Array, self, "arguments")
+}
+
+@(objc_type=ProcessInfo, objc_name="environment")
+ProcessInfo_environment :: proc "c" (self: ^ProcessInfo) -> ^Dictionary {
+ return msgSend(^Dictionary, self, "environment")
+}
+
+@(objc_type=ProcessInfo, objc_name="globallyUniqueString")
+ProcessInfo_globallyUniqueString :: proc "c" (self: ^ProcessInfo) -> ^String {
+ return msgSend(^String, self, "globallyUniqueString")
+}
+
+@(objc_type=ProcessInfo, objc_name="isMacCatalystApp")
+ProcessInfo_isMacCatalystApp :: proc "c" (self: ^ProcessInfo) -> bool {
+ return msgSend(bool, self, "isMacCatalystApp")
+}
+
+@(objc_type=ProcessInfo, objc_name="isiOSAppOnMac")
+ProcessInfo_isiOSAppOnMac :: proc "c" (self: ^ProcessInfo) -> bool {
+ return msgSend(bool, self, "isiOSAppOnMac")
+}
+
+@(objc_type=ProcessInfo, objc_name="processIdentifier")
+ProcessInfo_processIdentifier :: proc "c" (self: ^ProcessInfo) -> c.int {
+ return msgSend(c.int, self, "processIdentifier")
+}
+
+@(objc_type=ProcessInfo, objc_name="processName")
+ProcessInfo_processName :: proc "c" (self: ^ProcessInfo) -> ^String {
+ return msgSend(^String, self, "processName")
+}
+
+// Accessing User Information
+
+@(objc_type=ProcessInfo, objc_name="userName")
+ProcessInfo_userName :: proc "c" (self: ^ProcessInfo) -> ^String {
+ return msgSend(^String, self, "userName")
+}
+
+@(objc_type=ProcessInfo, objc_name="fullUserName")
+ProcessInfo_fullUserName :: proc "c" (self: ^ProcessInfo) -> ^String {
+ return msgSend(^String, self, "fullUserName")
+}
+
+// Sudden Application Termination
+
+@(objc_type=ProcessInfo, objc_name="disableSuddenTermination")
+ProcessInfo_disableSuddenTermination :: proc "c" (self: ^ProcessInfo) {
+ msgSend(nil, self, "disableSuddenTermination")
+}
+
+@(objc_type=ProcessInfo, objc_name="enableSuddenTermination")
+ProcessInfo_enableSuddenTermination :: proc "c" (self: ^ProcessInfo) {
+ msgSend(nil, self, "enableSuddenTermination")
+}
+
+// Controlling Automatic Termination
+
+@(objc_type=ProcessInfo, objc_name="disableAutomaticTermination")
+ProcessInfo_disableAutomaticTermination :: proc "c" (self: ^ProcessInfo, reason: ^String) {
+ msgSend(nil, self, "disableAutomaticTermination:", reason)
+}
+
+@(objc_type=ProcessInfo, objc_name="enableAutomaticTermination")
+ProcessInfo_enableAutomaticTermination :: proc "c" (self: ^ProcessInfo, reason: ^String) {
+ msgSend(nil, self, "enableAutomaticTermination:", reason)
+}
+
+@(objc_type=ProcessInfo, objc_name="automaticTerminationSupportEnabled")
+ProcessInfo_automaticTerminationSupportEnabled :: proc "c" (self: ^ProcessInfo) -> bool {
+ return msgSend(bool, self, "automaticTerminationSupportEnabled")
+}
+
+@(objc_type=ProcessInfo, objc_name="setAutomaticTerminationSupportEnabled")
+ProcessInfo_setAutomaticTerminationSupportEnabled :: proc "c" (self: ^ProcessInfo, automaticTerminationSupportEnabled: bool) {
+ msgSend(nil, self, "setAutomaticTerminationSupportEnabled:", automaticTerminationSupportEnabled)
+}
+
+// Getting Host Information
+
+@(objc_type=ProcessInfo, objc_name="hostName")
+ProcessInfo_hostName :: proc "c" (self: ^ProcessInfo) -> ^String {
+ return msgSend(^String, self, "hostName")
+}
+
+@(objc_type=ProcessInfo, objc_name="operatingSystemVersionString")
+ProcessInfo_operatingSystemVersionString :: proc "c" (self: ^ProcessInfo) -> ^String {
+ return msgSend(^String, self, "operatingSystemVersionString")
+}
+
+@(objc_type=ProcessInfo, objc_name="operatingSystemVersion")
+ProcessInfo_operatingSystemVersion :: proc "c" (self: ^ProcessInfo) -> OperatingSystemVersion {
+ return msgSend(OperatingSystemVersion, self, "operatingSystemVersion")
+}
+
+@(objc_type=ProcessInfo, objc_name="isOperatingSystemAtLeastVersion")
+ProcessInfo_isOperatingSystemAtLeastVersion :: proc "c" (self: ^ProcessInfo, version: OperatingSystemVersion) -> bool {
+ return msgSend(bool, self, "isOperatingSystemAtLeastVersion:", version)
+}
+
+// Getting Computer Information
+
+@(objc_type=ProcessInfo, objc_name="processorCount")
+ProcessInfo_processorCount :: proc "c" (self: ^ProcessInfo) -> UInteger {
+ return msgSend(UInteger, self, "processorCount")
+}
+
+@(objc_type=ProcessInfo, objc_name="activeProcessorCount")
+ProcessInfo_activeProcessorCount :: proc "c" (self: ^ProcessInfo) -> UInteger {
+ return msgSend(UInteger, self, "activeProcessorCount")
+}
+
+@(objc_type=ProcessInfo, objc_name="physicalMemory")
+ProcessInfo_physicalMemory :: proc "c" (self: ^ProcessInfo) -> c.ulonglong {
+ return msgSend(c.ulonglong, self, "physicalMemory")
+}
+
+@(objc_type=ProcessInfo, objc_name="systemUptime")
+ProcessInfo_systemUptime :: proc "c" (self: ^ProcessInfo) -> TimeInterval {
+ return msgSend(TimeInterval, self, "systemUptime")
+}
+
+// Managing Activities
+
+@(private)
+log2 :: intrinsics.constant_log2
+
+ActivityOptionsBits :: enum u64 {
+ IdleDisplaySleepDisabled = log2(1099511627776), // Require the screen to stay powered on.
+ IdleSystemSleepDisabled = log2(1048576), // Prevent idle sleep.
+ SuddenTerminationDisabled = log2(16384), // Prevent sudden termination.
+ AutomaticTerminationDisabled = log2(32768), // Prevent automatic termination.
+ AnimationTrackingEnabled = log2(35184372088832), // Track activity with an animation signpost interval.
+ TrackingEnabled = log2(70368744177664), // Track activity with a signpost interval.
+ UserInitiated = log2(16777215), // Performing a user-requested action.
+ UserInitiatedAllowingIdleSystemSleep = log2(15728639), // Performing a user-requested action, but the system can sleep on idle.
+ Background = log2(255), // Initiated some kind of work, but not as the direct result of a user request.
+ LatencyCritical = log2(1095216660480), // Requires the highest amount of timer and I/O precision available.
+ UserInteractive = log2(1095233437695), // Responding to user interaction.
+}
+ActivityOptions :: bit_set[ActivityOptionsBits; u64]
+
+@(objc_type=ProcessInfo, objc_name="beginActivityWithOptions")
+ProcessInfo_beginActivityWithOptions :: proc "c" (self: ^ProcessInfo, options: ActivityOptions, reason: ^String) -> ^ObjectProtocol {
+ return msgSend(^ObjectProtocol, self, "beginActivityWithOptions:reason:", options, reason)
+}
+
+@(objc_type=ProcessInfo, objc_name="endActivity")
+ProcessInfo_endActivity :: proc "c" (self: ^ProcessInfo, activity: ^ObjectProtocol) {
+ msgSend(nil, self, "endActivity:", activity)
+}
+
+@(objc_type=ProcessInfo, objc_name="performActivityWithOptions")
+ProcessInfo_performActivityWithOptions :: proc "c" (self: ^ProcessInfo, options: ActivityOptions, reason: ^String, block: proc "c" ()) {
+ msgSend(nil, self, "performActivityWithOptions:reason:usingBlock:", options, reason, block)
+}
+
+@(objc_type=ProcessInfo, objc_name="performExpiringActivityWithReason")
+ProcessInfo_performExpiringActivityWithReason :: proc "c" (self: ^ProcessInfo, reason: ^String, block: proc "c" (expired: bool)) {
+ msgSend(nil, self, "performExpiringActivityWithReason:usingBlock:", reason, block)
+}
+
+// Getting the Thermal State
+
+ProcessInfoThermalState :: enum c.long {
+ Nominal,
+ Fair,
+ Serious,
+ Critical,
+}
+
+@(objc_type=ProcessInfo, objc_name="thermalState")
+ProcessInfo_thermalState :: proc "c" (self: ^ProcessInfo) -> ProcessInfoThermalState {
+ return msgSend(ProcessInfoThermalState, self, "thermalState")
+}
+
+// Determining Whether Low Power Mode is Enabled
+
+@(objc_type=ProcessInfo, objc_name="isLowPowerModeEnabled")
+ProcessInfo_isLowPowerModeEnabled :: proc "c" (self: ^ProcessInfo) -> bool {
+ return msgSend(bool, self, "isLowPowerModeEnabled")
+}
diff --git a/core/sys/darwin/Foundation/NSSavePanel.odin b/core/sys/darwin/Foundation/NSSavePanel.odin
index 8e4d7a07b..d40b3ecd5 100644
--- a/core/sys/darwin/Foundation/NSSavePanel.odin
+++ b/core/sys/darwin/Foundation/NSSavePanel.odin
@@ -7,3 +7,13 @@ SavePanel :: struct{ using _: Panel }
SavePanel_runModal :: proc "c" (self: ^SavePanel) -> ModalResponse {
return msgSend(ModalResponse, self, "runModal")
}
+
+@(objc_type=SavePanel, objc_name="savePanel", objc_is_class_method=true)
+SavePanel_savePanel :: proc "c" () -> ^SavePanel {
+ return msgSend(^SavePanel, SavePanel, "savePanel")
+}
+
+@(objc_type=SavePanel, objc_name="URL")
+SavePanel_URL :: proc "c" (self: ^SavePanel) -> ^URL {
+ return msgSend(^URL, self, "URL")
+}
diff --git a/core/sys/darwin/Foundation/NSString.odin b/core/sys/darwin/Foundation/NSString.odin
index a10b33fc0..eac855c3b 100644
--- a/core/sys/darwin/Foundation/NSString.odin
+++ b/core/sys/darwin/Foundation/NSString.odin
@@ -134,6 +134,11 @@ String_isEqualToString :: proc "c" (self, other: ^String) -> BOOL {
return msgSend(BOOL, self, "isEqualToString:", other)
}
+@(objc_type=String, objc_name="stringByAppendingString")
+String_stringByAppendingString :: proc "c" (self, other: ^String) -> ^String {
+ return msgSend(^String, self, "stringByAppendingString:", other)
+}
+
@(objc_type=String, objc_name="rangeOfString")
String_rangeOfString :: proc "c" (self, other: ^String, options: StringCompareOptions) -> Range {
return msgSend(Range, self, "rangeOfString:options:", other, options)
diff --git a/core/sys/darwin/Foundation/NSToolbar.odin b/core/sys/darwin/Foundation/NSToolbar.odin
new file mode 100644
index 000000000..be6613df4
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSToolbar.odin
@@ -0,0 +1,14 @@
+package objc_Foundation
+@(objc_class = "NSToolbar")
+
+Toolbar :: struct { using _: Object }
+
+@(objc_type = Toolbar, objc_name = "alloc", objc_is_class_method = true)
+Toolbar_alloc :: proc "c" () -> ^Toolbar {
+ return msgSend(^Toolbar, Toolbar, "alloc")
+}
+
+@(objc_type = Toolbar, objc_name = "init")
+Toolbar_init :: proc "c" (self: ^Toolbar) -> ^Toolbar {
+ return msgSend(^Toolbar, self, "init")
+}
diff --git a/core/sys/darwin/Foundation/NSTypes.odin b/core/sys/darwin/Foundation/NSTypes.odin
index fbd883a8f..822a07ab1 100644
--- a/core/sys/darwin/Foundation/NSTypes.odin
+++ b/core/sys/darwin/Foundation/NSTypes.odin
@@ -20,7 +20,7 @@ BOOL :: bool // TODO(bill): should this be `distinct`?
YES :: true
NO :: false
-OperatingSystemVersion :: struct #packed {
+OperatingSystemVersion :: struct #align(8) {
majorVersion: Integer,
minorVersion: Integer,
patchVersion: Integer,
@@ -58,4 +58,4 @@ when size_of(Float) == 8 {
} else {
_POINT_ENCODING :: "{NSPoint=ff}"
_SIZE_ENCODING :: "{NSSize=ff}"
-} \ No newline at end of file
+}
diff --git a/core/sys/darwin/Foundation/NSURL.odin b/core/sys/darwin/Foundation/NSURL.odin
index 9e9081219..fb9ebca9e 100644
--- a/core/sys/darwin/Foundation/NSURL.odin
+++ b/core/sys/darwin/Foundation/NSURL.odin
@@ -28,3 +28,8 @@ URL_initFileURLWithPath :: proc "c" (self: ^URL, path: ^String) -> ^URL {
URL_fileSystemRepresentation :: proc "c" (self: ^URL) -> cstring {
return msgSend(cstring, self, "fileSystemRepresentation")
}
+
+@(objc_type=URL, objc_name="relativePath")
+URL_relativePath :: proc "c" (self: ^URL) -> ^String {
+ return msgSend(^String, self, "relativePath")
+}
diff --git a/core/sys/darwin/Foundation/NSURLRequest.odin b/core/sys/darwin/Foundation/NSURLRequest.odin
new file mode 100644
index 000000000..6b2819c67
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSURLRequest.odin
@@ -0,0 +1,24 @@
+package objc_Foundation
+
+@(objc_class = "URLRequest")
+URLRequest :: struct { using _: Object }
+
+@(objc_type = URLRequest, objc_name = "alloc", objc_is_class_method = true)
+URLRequest_alloc :: proc "c" () -> ^URLRequest {
+ return msgSend(^URLRequest, URLRequest, "alloc")
+}
+
+@(objc_type = URLRequest, objc_name = "requestWithURL", objc_is_class_method = true)
+URLRequest_requestWithURL :: proc "c" (url: ^URL) -> ^URLRequest {
+ return msgSend(^URLRequest, URLRequest, "requestWithURL:", url)
+}
+
+@(objc_type = URLRequest, objc_name = "init")
+URLRequest_init :: proc "c" (self: ^URLRequest) -> ^URLRequest {
+ return msgSend(^URLRequest, URLRequest, "init")
+}
+
+@(objc_type = URLRequest, objc_name = "url")
+URLRequest_url :: proc "c" (self: ^URLRequest) -> ^URL {
+ return msgSend(^URL, self, "URL")
+} \ No newline at end of file
diff --git a/core/sys/darwin/Foundation/NSURLResponse.odin b/core/sys/darwin/Foundation/NSURLResponse.odin
new file mode 100644
index 000000000..6295817e8
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSURLResponse.odin
@@ -0,0 +1,19 @@
+package objc_Foundation
+
+@(objc_class = "NSURLResponse")
+URLResponse :: struct { using _: Object }
+
+@(objc_type = URLResponse, objc_name = "alloc", objc_is_class_method = true)
+URLResponse_alloc :: proc "c" () -> ^URLResponse {
+ return msgSend(^URLResponse, URLResponse, "alloc")
+}
+
+@(objc_type = URLResponse, objc_name = "init")
+URLResponse_init :: proc "c" (self: ^URLResponse) -> ^URLResponse {
+ return msgSend(^URLResponse, URLResponse, "init")
+}
+
+@(objc_type = URLResponse, objc_name = "initWithURL")
+URLResponse_initWithURL :: proc "c" (self: ^URLResponse, url: ^URL, mime_type: ^String, length: int, encoding: ^String ) -> ^URLResponse {
+ return msgSend(^URLResponse, self, "initWithURL:MIMEType:expectedContentLength:textEncodingName:", url, mime_type, Integer(length), encoding)
+} \ No newline at end of file
diff --git a/core/sys/darwin/Foundation/NSWindow.odin b/core/sys/darwin/Foundation/NSWindow.odin
index 0fe334207..57ac2b6f6 100644
--- a/core/sys/darwin/Foundation/NSWindow.odin
+++ b/core/sys/darwin/Foundation/NSWindow.odin
@@ -129,6 +129,10 @@ WindowDelegateTemplate :: struct {
windowDidExitVersionBrowser: proc(notification: ^Notification),
}
+Window_Title_Visibility :: enum UInteger {
+ Visible,
+ Hidden,
+}
WindowDelegate :: struct { using _: Object } // This is not the same as NSWindowDelegate
_WindowDelegateInternal :: struct {
@@ -616,6 +620,10 @@ View_setWantsLayer :: proc "c" (self: ^View, wantsLayer: BOOL) {
View_convertPointFromView :: proc "c" (self: ^View, point: Point, view: ^View) -> Point {
return msgSend(Point, self, "convertPoint:fromView:", point, view)
}
+@(objc_type=View, objc_name="addSubview")
+View_addSubview :: proc "c" (self: ^View, view: ^View) {
+ msgSend(nil, self, "addSubview:", view)
+}
@(objc_class="NSWindow")
Window :: struct {using _: Responder}
@@ -748,4 +756,28 @@ Window_hasTitleBar :: proc "c" (self: ^Window) -> BOOL {
@(objc_type=Window, objc_name="orderedIndex")
Window_orderedIndex :: proc "c" (self: ^Window) -> Integer {
return msgSend(Integer, self, "orderedIndex")
+}
+@(objc_type=Window, objc_name="setMinSize")
+Window_setMinSize :: proc "c" (self: ^Window, size: Size) {
+ msgSend(nil, self, "setMinSize:", size)
+}
+@(objc_type=Window, objc_name="setTitleVisibility")
+Window_setTitleVisibility :: proc "c" (self: ^Window, visibility: Window_Title_Visibility) {
+ msgSend(nil, self, "setTitleVisibility:", visibility)
+}
+@(objc_type=Window, objc_name="performZoom")
+Window_performZoom :: proc "c" (self: ^Window) {
+ msgSend(nil, self, "performZoom:", self)
+}
+@(objc_type=Window, objc_name="setFrameAutosaveName")
+NSWindow_setFrameAutosaveName :: proc "c" (self: ^Window, name: ^String) {
+ msgSend(nil, self, "setFrameAutosaveName:", name)
+}
+@(objc_type=Window, objc_name="performWindowDragWithEvent")
+Window_performWindowDragWithEvent :: proc "c" (self: ^Window, event: ^Event) {
+ msgSend(nil, self, "performWindowDragWithEvent:", 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