aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/sys/darwin/Foundation/NSApplication.odin19
-rw-r--r--core/sys/darwin/Foundation/NSCursor.odin26
-rw-r--r--core/sys/darwin/Foundation/NSEvent.odin5
-rw-r--r--core/sys/darwin/Foundation/NSObject.odin8
-rw-r--r--core/sys/darwin/Foundation/NSRunLoop.odin27
-rw-r--r--core/sys/darwin/Foundation/NSTimer.odin15
-rw-r--r--core/sys/darwin/Foundation/NSWindow.odin8
-rw-r--r--vendor/darwin/QuartzCore/QuartzCore.odin22
8 files changed, 117 insertions, 13 deletions
diff --git a/core/sys/darwin/Foundation/NSApplication.odin b/core/sys/darwin/Foundation/NSApplication.odin
index 2295e46b8..cdda7b3e4 100644
--- a/core/sys/darwin/Foundation/NSApplication.odin
+++ b/core/sys/darwin/Foundation/NSApplication.odin
@@ -1,21 +1,9 @@
package objc_Foundation
-foreign import "system:Foundation.framework"
-
import "base:intrinsics"
import "base:runtime"
import "core:strings"
-RunLoopMode :: ^String
-
-@(link_prefix="NS")
-foreign Foundation {
- RunLoopCommonModes: RunLoopMode
- DefaultRunLoopMode: RunLoopMode
- EventTrackingRunLoopMode: RunLoopMode
- ModalPanelRunLoopMode: RunLoopMode
-}
-
ActivationPolicy :: enum UInteger {
Regular = 0,
Accessory = 1,
@@ -206,6 +194,13 @@ Application_updateWindows :: proc "c" (self: ^Application) {
msgSend(nil, self, "updateWindows")
}
+@(objc_type=Application, objc_name="sendAction")
+Application_sendAction :: proc "c" (self: ^Application, action: SEL, to: id, from: id) {
+ msgSend(nil, self, "sendAction:to:from:", action, to, from)
+}
+
+
+
@(objc_class="NSRunningApplication")
RunningApplication :: struct {using _: Object}
diff --git a/core/sys/darwin/Foundation/NSCursor.odin b/core/sys/darwin/Foundation/NSCursor.odin
new file mode 100644
index 000000000..ad2decdca
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSCursor.odin
@@ -0,0 +1,26 @@
+package objc_Foundation
+
+@(objc_class="NSCursor")
+Cursor :: struct {using _: Object}
+
+@(objc_type=Cursor, objc_name="set")
+Cursor_set :: proc(self: ^Cursor) {
+ msgSend(EventType, self, "set")
+}
+@(objc_type=Cursor, objc_name="currentCursor", objc_is_class_method=true)
+Cursor_currentCursor :: proc "c" () -> ^Cursor {
+ return msgSend(^Cursor, Cursor, "currentCursor")
+}
+@(objc_type=Cursor, objc_name="IBeamCursor", objc_is_class_method=true)
+Cursor_IBeamCursor :: proc "c" () -> ^Cursor {
+ return msgSend(^Cursor, Cursor, "IBeamCursor")
+}
+@(objc_type=Cursor, objc_name="arrowCursor", objc_is_class_method=true)
+Cursor_arrowCursor :: proc "c" () -> ^Cursor {
+ return msgSend(^Cursor, Cursor, "arrowCursor")
+}
+@(objc_type=Cursor, objc_name="pointingHandCursor", objc_is_class_method=true)
+Cursor_pointingHandCursor :: proc "c" () -> ^Cursor {
+ return msgSend(^Cursor, Cursor, "pointingHandCursor")
+}
+
diff --git a/core/sys/darwin/Foundation/NSEvent.odin b/core/sys/darwin/Foundation/NSEvent.odin
index 3bd0c1879..952a1726c 100644
--- a/core/sys/darwin/Foundation/NSEvent.odin
+++ b/core/sys/darwin/Foundation/NSEvent.odin
@@ -334,6 +334,11 @@ Event_locationInWindow :: proc "c" (self: ^Event) -> Point {
return msgSend(Point, self, "locationInWindow")
}
+@(objc_type=Event, objc_name="mouseLocation", objc_is_class_method=true)
+Event_mouseLocation :: proc "c" () -> Point {
+ return msgSend(Point, Event, "mouseLocation")
+}
+
@(objc_type=Event, objc_name="deltaX")
Event_deltaX :: proc "c" (self: ^Event) -> Float {
diff --git a/core/sys/darwin/Foundation/NSObject.odin b/core/sys/darwin/Foundation/NSObject.odin
index 31ece47a1..7a423e757 100644
--- a/core/sys/darwin/Foundation/NSObject.odin
+++ b/core/sys/darwin/Foundation/NSObject.odin
@@ -81,6 +81,12 @@ debugDescription :: proc "c" (self: ^Object) -> ^String {
return nil
}
+
+@(objc_type=Object, objc_name="performSelectorOnMainThread")
+performSelectorOnMainThread :: proc "c" (self: ^Object, aSelector: SEL, arg: id, wait: BOOL) {
+ msgSend(^String, self, "performSelectorOnMainThread:withObject:waitUntilDone:", aSelector, arg, wait)
+}
+
bridgingCast :: proc "c" ($T: typeid, obj: ^Object) where intrinsics.type_is_pointer(T), intrinsics.type_is_subtype_of(T, ^Object) {
return (T)(obj)
}
@@ -88,4 +94,4 @@ bridgingCast :: proc "c" ($T: typeid, obj: ^Object) where intrinsics.type_is_poi
@(objc_class="NSCoder")
Coder :: struct {using _: Object}
-// TODO(bill): Implement all the methods for this massive type \ No newline at end of file
+// TODO(bill): Implement all the methods for this massive type
diff --git a/core/sys/darwin/Foundation/NSRunLoop.odin b/core/sys/darwin/Foundation/NSRunLoop.odin
new file mode 100644
index 000000000..a9c47bd0e
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSRunLoop.odin
@@ -0,0 +1,27 @@
+package objc_Foundation
+
+foreign import "system:Foundation.framework"
+
+RunLoopMode :: ^String
+
+@(link_prefix="NS")
+foreign Foundation {
+ RunLoopCommonModes: RunLoopMode
+ DefaultRunLoopMode: RunLoopMode
+ EventTrackingRunLoopMode: RunLoopMode
+ ModalPanelRunLoopMode: RunLoopMode
+}
+
+@(objc_class="NSRunLoop")
+RunLoop :: struct { using _: Object }
+
+@(objc_type=RunLoop, objc_name="mainRunLoop", objc_is_class_method=true)
+RunLoop_mainRunLoop :: proc() -> ^RunLoop {
+ return msgSend(^RunLoop, RunLoop, "mainRunLoop")
+}
+
+@(objc_type=RunLoop, objc_name="addTimerForMode")
+RunLoop_addTimerForMode :: proc(self: ^RunLoop, timer: ^Timer, forMode: RunLoopMode) {
+ msgSend(nil, self, "addTimer:forMode:", timer, forMode)
+}
+
diff --git a/core/sys/darwin/Foundation/NSTimer.odin b/core/sys/darwin/Foundation/NSTimer.odin
new file mode 100644
index 000000000..2edcf34c3
--- /dev/null
+++ b/core/sys/darwin/Foundation/NSTimer.odin
@@ -0,0 +1,15 @@
+package objc_Foundation
+
+@(objc_class="NSTimer")
+Timer :: struct { using _: Object }
+
+@(objc_type=Timer, objc_name="scheduledTimerWithTimeIntervalRepeatsBlock", objc_is_class_method=true)
+Timer_scheduledTimerWithTimeIntervalRepeatsBlock :: proc(interval: TimeInterval, repeats: BOOL, block: ^Block) -> ^Timer {
+ return msgSend(^Timer, Timer, "scheduledTimerWithTimeInterval:repeats:block:")
+}
+
+@(objc_type=Timer, objc_name="scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeat", objc_is_class_method=true)
+Timer_scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeat :: proc(interval: TimeInterval, aTarget: id, aSelector: SEL, userInfo: id, repeats: BOOL) -> ^Timer {
+ return msgSend(^Timer, Timer, "scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:", interval, aTarget, aSelector, userInfo, repeats)
+}
+
diff --git a/core/sys/darwin/Foundation/NSWindow.odin b/core/sys/darwin/Foundation/NSWindow.odin
index 8317c7bb1..f39faca0a 100644
--- a/core/sys/darwin/Foundation/NSWindow.odin
+++ b/core/sys/darwin/Foundation/NSWindow.odin
@@ -699,6 +699,14 @@ View_convertPointFromView :: proc "c" (self: ^View, point: Point, view: ^View) -
View_addSubview :: proc "c" (self: ^View, view: ^View) {
msgSend(nil, self, "addSubview:", view)
}
+@(objc_type=View, objc_name="isFlipped")
+View_isFlipped :: proc "c" (self: ^View) -> BOOL {
+ return msgSend(BOOL, self, "isFlipped")
+}
+@(objc_type=View, objc_name="setIsFlipped")
+View_setIsFlipped :: proc "c" (self: ^View, flipped: BOOL) {
+ msgSend(nil, self, "setIsFlipped:", flipped)
+}
@(objc_class="NSWindow")
Window :: struct {using _: Responder}
diff --git a/vendor/darwin/QuartzCore/QuartzCore.odin b/vendor/darwin/QuartzCore/QuartzCore.odin
index 0e54b3d30..64e8e66d3 100644
--- a/vendor/darwin/QuartzCore/QuartzCore.odin
+++ b/vendor/darwin/QuartzCore/QuartzCore.odin
@@ -47,6 +47,10 @@ MetalLayer_pixelFormat :: proc "c" (self: ^MetalLayer) -> MTL.PixelFormat {
MetalLayer_setPixelFormat :: proc "c" (self: ^MetalLayer, pixelFormat: MTL.PixelFormat) {
msgSend(nil, self, "setPixelFormat:", pixelFormat)
}
+@(objc_type=MetalLayer, objc_name="setColorSpace")
+MetalLayer_setColorSpace :: proc "c" (self: ^MetalLayer, colorspace: NS.id) {
+ msgSend(nil, self, "setColorspace:", colorspace)
+}
@(objc_type=MetalLayer, objc_name="framebufferOnly")
MetalLayer_framebufferOnly :: proc "c" (self: ^MetalLayer) -> NS.BOOL {
@@ -126,3 +130,21 @@ MetalDrawable_addPresentedHandler :: proc "c" (self: ^MetalDrawable, block: Draw
msgSend(nil, self, "addPresentedHandler:", block)
}
+@(objc_class="CATransaction")
+Transaction :: struct { using _: NS.Object }
+
+@(objc_type=Transaction, objc_name="begin", objc_is_class_method=true)
+transaction_begin :: proc() {
+ msgSend(nil, Transaction, "begin")
+}
+
+@(objc_type=Transaction, objc_name="commit", objc_is_class_method=true)
+transaction_commit :: proc() {
+ msgSend(nil, Transaction, "commit")
+}
+
+@(objc_type=Transaction, objc_name="flush", objc_is_class_method=true)
+transaction_flush :: proc() {
+ msgSend(nil, Transaction, "flush")
+}
+