mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #5880 from terids/core-darwin-bindings
core/sys/darwin/Foundation: Add additional AppKit bindings
This commit is contained in:
@@ -132,6 +132,11 @@ Application_finishLaunching :: proc "c" (self: ^Application) {
|
|||||||
msgSend(nil, self, "finishLaunching")
|
msgSend(nil, self, "finishLaunching")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@(objc_type=Application, objc_name="stop")
|
||||||
|
Application_stop :: proc "c" (self: ^Application, sender: ^Object) {
|
||||||
|
msgSend(nil, self, "stop:", sender)
|
||||||
|
}
|
||||||
|
|
||||||
@(objc_type=Application, objc_name="terminate")
|
@(objc_type=Application, objc_name="terminate")
|
||||||
Application_terminate :: proc "c" (self: ^Application, sender: ^Object) {
|
Application_terminate :: proc "c" (self: ^Application, sender: ^Object) {
|
||||||
msgSend(nil, self, "terminate:", sender)
|
msgSend(nil, self, "terminate:", sender)
|
||||||
@@ -156,6 +161,12 @@ Application_nextEventMatchingMask :: proc "c" (self: ^Application, mask: EventMa
|
|||||||
Application_sendEvent :: proc "c" (self: ^Application, event: ^Event) {
|
Application_sendEvent :: proc "c" (self: ^Application, event: ^Event) {
|
||||||
msgSend(nil, self, "sendEvent:", event)
|
msgSend(nil, self, "sendEvent:", event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@(objc_type=Application, objc_name="postEvent")
|
||||||
|
Application_postEvent :: proc "c" (self: ^Application, event: ^Event, atStart: BOOL) {
|
||||||
|
msgSend(nil, self, "postEvent:atStart:", event, atStart)
|
||||||
|
}
|
||||||
|
|
||||||
@(objc_type=Application, objc_name="updateWindows")
|
@(objc_type=Application, objc_name="updateWindows")
|
||||||
Application_updateWindows :: proc "c" (self: ^Application) {
|
Application_updateWindows :: proc "c" (self: ^Application) {
|
||||||
msgSend(nil, self, "updateWindows")
|
msgSend(nil, self, "updateWindows")
|
||||||
@@ -175,6 +186,11 @@ RunningApplication_localizedName :: proc "c" (self: ^RunningApplication) -> ^Str
|
|||||||
return msgSend(^String, self, "localizedName")
|
return msgSend(^String, self, "localizedName")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@(objc_type=RunningApplication, objc_name="finishedLaunching")
|
||||||
|
RunningApplication_finishedLaunching :: proc "c" (self: ^RunningApplication) -> BOOL {
|
||||||
|
return msgSend(BOOL, self, "isFinishedLaunching")
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationDelegateTemplate :: struct {
|
ApplicationDelegateTemplate :: struct {
|
||||||
// Launching Applications
|
// Launching Applications
|
||||||
applicationWillFinishLaunching: proc(notification: ^Notification),
|
applicationWillFinishLaunching: proc(notification: ^Notification),
|
||||||
|
|||||||
@@ -250,6 +250,35 @@ kVK :: enum {
|
|||||||
ISO_Section = 0x0A,
|
ISO_Section = 0x0A,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* class methods for creating events */
|
||||||
|
|
||||||
|
@(objc_type=Event, objc_name="otherEventWithType", objc_is_class_method=true)
|
||||||
|
Event_otherEventWithType :: proc "c" (
|
||||||
|
type: EventType,
|
||||||
|
location: Point,
|
||||||
|
flags: EventModifierFlags,
|
||||||
|
time: TimeInterval,
|
||||||
|
window_number: Integer,
|
||||||
|
ctx: id,
|
||||||
|
subtype: i16,
|
||||||
|
data1: Integer,
|
||||||
|
data2: Integer,
|
||||||
|
) -> ^Event {
|
||||||
|
return msgSend(
|
||||||
|
^Event,
|
||||||
|
Event,
|
||||||
|
"otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:",
|
||||||
|
type,
|
||||||
|
location,
|
||||||
|
flags,
|
||||||
|
time,
|
||||||
|
window_number,
|
||||||
|
ctx,
|
||||||
|
subtype,
|
||||||
|
data1,
|
||||||
|
data2,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/* these messages are valid for all events */
|
/* these messages are valid for all events */
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,60 @@ BackingStoreType :: enum UInteger {
|
|||||||
Buffered = 2,
|
Buffered = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowCollectionBehaviorFlag :: enum UInteger {
|
||||||
|
CanJoinAllSpaces = 0,
|
||||||
|
MoveToActiveSpace = 1,
|
||||||
|
Managed = 2,
|
||||||
|
Transient = 3,
|
||||||
|
Stationary = 4,
|
||||||
|
ParticipatesInCycle = 5,
|
||||||
|
IgnoresCycle = 6,
|
||||||
|
FullScreenPrimary = 7,
|
||||||
|
FullScreenAuxiliary = 8,
|
||||||
|
FullScreenNone = 9,
|
||||||
|
FullScreenAllowsTiling = 11,
|
||||||
|
FullScreenDisallowsTiling = 12,
|
||||||
|
Primary = 16,
|
||||||
|
Auxiliary = 17,
|
||||||
|
CanJoinAllApplications = 18,
|
||||||
|
}
|
||||||
|
WindowCollectionBehavior :: distinct bit_set[WindowCollectionBehaviorFlag; UInteger]
|
||||||
|
WindowCollectionBehaviorDefault :: WindowCollectionBehavior{}
|
||||||
|
WindowCollectionBehaviorPrimary :: WindowCollectionBehavior{.Primary, .FullScreenAuxiliary}
|
||||||
|
WindowCollectionBehaviorAuxiliary :: WindowCollectionBehavior{.Auxiliary, .FullScreenNone}
|
||||||
|
WindowCollectionBehaviorCanJoinAllApplications :: WindowCollectionBehavior{.CanJoinAllApplications}
|
||||||
|
WindowCollectionBehaviorCanJoinAllSpaces :: WindowCollectionBehavior{.CanJoinAllSpaces}
|
||||||
|
WindowCollectionBehaviorMoveToActiveSpace :: WindowCollectionBehavior{.MoveToActiveSpace}
|
||||||
|
WindowCollectionBehaviorStationary :: WindowCollectionBehavior{.Stationary}
|
||||||
|
WindowCollectionBehaviorManaged :: WindowCollectionBehavior{.Managed}
|
||||||
|
WindowCollectionBehaviorTransient :: WindowCollectionBehavior{.Transient}
|
||||||
|
WindowCollectionBehaviorFullScreenPrimary :: WindowCollectionBehavior{.FullScreenPrimary}
|
||||||
|
WindowCollectionBehaviorFullScreenAuxiliary :: WindowCollectionBehavior{.FullScreenAuxiliary}
|
||||||
|
WindowCollectionBehaviorFullScreenNone :: WindowCollectionBehavior{.FullScreenNone}
|
||||||
|
WindowCollectionBehaviorFullScreenAllowsTiling :: WindowCollectionBehavior{.FullScreenAllowsTiling}
|
||||||
|
WindowCollectionBehaviorFullScreenDisallowsTiling :: WindowCollectionBehavior{.FullScreenDisallowsTiling}
|
||||||
|
WindowCollectionBehaviorParticipatesInCycle :: WindowCollectionBehavior{.ParticipatesInCycle}
|
||||||
|
WindowCollectionBehaviorIgnoresCycle :: WindowCollectionBehavior{.IgnoresCycle}
|
||||||
|
|
||||||
|
WindowLevel :: enum Integer {
|
||||||
|
Normal = 0,
|
||||||
|
Floating = 3,
|
||||||
|
Submenu = 3,
|
||||||
|
TornOffMenu = 3,
|
||||||
|
ModalPanel = 8,
|
||||||
|
MainMenu = 24,
|
||||||
|
Status = 25,
|
||||||
|
PopUpMenu = 101,
|
||||||
|
ScreenSaver = 1000,
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowTabbingMode :: enum Integer {
|
||||||
|
Automatic = 0,
|
||||||
|
Preferred = 1,
|
||||||
|
Disallowed = 2,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WindowDelegateTemplate :: struct {
|
WindowDelegateTemplate :: struct {
|
||||||
// Managing Sheets
|
// Managing Sheets
|
||||||
windowWillPositionSheetUsingRect: proc(window: ^Window, sheet: ^Window, rect: Rect) -> Rect,
|
windowWillPositionSheetUsingRect: proc(window: ^Window, sheet: ^Window, rect: Rect) -> Rect,
|
||||||
@@ -600,6 +654,10 @@ Responder :: struct {using _: Object}
|
|||||||
@(objc_class="NSView")
|
@(objc_class="NSView")
|
||||||
View :: struct {using _: Responder}
|
View :: struct {using _: Responder}
|
||||||
|
|
||||||
|
@(objc_type=View, objc_name="alloc", objc_is_class_method=true)
|
||||||
|
View_alloc :: proc "c" () -> ^View {
|
||||||
|
return msgSend(^View, View, "alloc")
|
||||||
|
}
|
||||||
|
|
||||||
@(objc_type=View, objc_name="initWithFrame")
|
@(objc_type=View, objc_name="initWithFrame")
|
||||||
View_initWithFrame :: proc "c" (self: ^View, frame: Rect) -> ^View {
|
View_initWithFrame :: proc "c" (self: ^View, frame: Rect) -> ^View {
|
||||||
@@ -670,6 +728,10 @@ Window_setFrame :: proc "c" (self: ^Window, frame: Rect, display: BOOL) {
|
|||||||
Window_setFrameOrigin :: proc "c" (self: ^Window, origin: Point) {
|
Window_setFrameOrigin :: proc "c" (self: ^Window, origin: Point) {
|
||||||
msgSend(nil, self, "setFrameOrigin:", origin)
|
msgSend(nil, self, "setFrameOrigin:", origin)
|
||||||
}
|
}
|
||||||
|
@(objc_type=Window, objc_name="center")
|
||||||
|
Window_center :: proc "c" (self: ^Window) {
|
||||||
|
msgSend(nil, self, "center")
|
||||||
|
}
|
||||||
@(objc_type=Window, objc_name="opaque")
|
@(objc_type=Window, objc_name="opaque")
|
||||||
Window_opaque :: proc "c" (self: ^Window) -> BOOL {
|
Window_opaque :: proc "c" (self: ^Window) -> BOOL {
|
||||||
return msgSend(BOOL, self, "opaque")
|
return msgSend(BOOL, self, "opaque")
|
||||||
@@ -686,6 +748,14 @@ Window_backgroundColor :: proc "c" (self: ^Window) -> ^Color {
|
|||||||
Window_setBackgroundColor :: proc "c" (self: ^Window, color: ^Color) {
|
Window_setBackgroundColor :: proc "c" (self: ^Window, color: ^Color) {
|
||||||
msgSend(nil, self, "setBackgroundColor:", color)
|
msgSend(nil, self, "setBackgroundColor:", color)
|
||||||
}
|
}
|
||||||
|
@(objc_type = Window, objc_name = "orderFront")
|
||||||
|
Window_orderFront :: proc "c" (self: ^Window, sender: id) {
|
||||||
|
msgSend(nil, self, "orderFront:", sender)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "orderOut")
|
||||||
|
Window_orderOut :: proc "c" (self: ^Window, sender: id) {
|
||||||
|
msgSend(nil, self, "orderOut:", sender)
|
||||||
|
}
|
||||||
@(objc_type=Window, objc_name="makeKeyAndOrderFront")
|
@(objc_type=Window, objc_name="makeKeyAndOrderFront")
|
||||||
Window_makeKeyAndOrderFront :: proc "c" (self: ^Window, key: ^Object) {
|
Window_makeKeyAndOrderFront :: proc "c" (self: ^Window, key: ^Object) {
|
||||||
msgSend(nil, self, "makeKeyAndOrderFront:", key)
|
msgSend(nil, self, "makeKeyAndOrderFront:", key)
|
||||||
@@ -722,6 +792,10 @@ Window_close :: proc "c" (self: ^Window) {
|
|||||||
Window_setDelegate :: proc "c" (self: ^Window, delegate: ^WindowDelegate) {
|
Window_setDelegate :: proc "c" (self: ^Window, delegate: ^WindowDelegate) {
|
||||||
msgSend(nil, self, "setDelegate:", delegate)
|
msgSend(nil, self, "setDelegate:", delegate)
|
||||||
}
|
}
|
||||||
|
@(objc_type = Window, objc_name = "delegate")
|
||||||
|
Window_delegate :: proc "c" (self: ^Window) -> ^WindowDelegate {
|
||||||
|
return msgSend(^WindowDelegate, self, "delegate")
|
||||||
|
}
|
||||||
@(objc_type=Window, objc_name="backingScaleFactor")
|
@(objc_type=Window, objc_name="backingScaleFactor")
|
||||||
Window_backingScaleFactor :: proc "c" (self: ^Window) -> Float {
|
Window_backingScaleFactor :: proc "c" (self: ^Window) -> Float {
|
||||||
return msgSend(Float, self, "backingScaleFactor")
|
return msgSend(Float, self, "backingScaleFactor")
|
||||||
@@ -798,3 +872,35 @@ Window_performWindowDragWithEvent :: proc "c" (self: ^Window, event: ^Event) {
|
|||||||
Window_setToolbar :: proc "c" (self: ^Window, toolbar: ^Toolbar) {
|
Window_setToolbar :: proc "c" (self: ^Window, toolbar: ^Toolbar) {
|
||||||
msgSend(nil, self, "setToolbar:", toolbar)
|
msgSend(nil, self, "setToolbar:", toolbar)
|
||||||
}
|
}
|
||||||
|
@(objc_type = Window, objc_name = "setCollectionBehavior")
|
||||||
|
Window_setCollectionBehavior :: proc "c" (self: ^Window, behavior: WindowCollectionBehavior) {
|
||||||
|
msgSend(nil, self, "setCollectionBehavior:", behavior)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "collectionBehavior")
|
||||||
|
Window_collectionBehavior :: proc "c" (self: ^Window) -> WindowCollectionBehavior {
|
||||||
|
return msgSend(WindowCollectionBehavior, self, "collectionBehavior")
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "setLevel")
|
||||||
|
Window_setLevel :: proc "c" (self: ^Window, level: WindowLevel) {
|
||||||
|
msgSend(nil, self, "setLevel:", level)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "setReleasedWhenClosed")
|
||||||
|
Window_setReleasedWhenClosed :: proc "c" (self: ^Window, flag: BOOL) {
|
||||||
|
msgSend(nil, self, "setReleasedWhenClosed:", flag)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "makeFirstResponder")
|
||||||
|
Window_makeFirstResponder :: proc "c" (self: ^Window, responder: ^Responder) -> BOOL {
|
||||||
|
return msgSend(BOOL, self, "makeFirstResponder:", responder)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "setRestorable")
|
||||||
|
Window_setRestorable :: proc "c" (self: ^Window, flag: BOOL) {
|
||||||
|
msgSend(nil, self, "setRestorable:", flag)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "setTabbingMode")
|
||||||
|
Window_setTabbingMode :: proc "c" (self: ^Window, mode: WindowTabbingMode) {
|
||||||
|
msgSend(nil, self, "setTabbingMode:", mode)
|
||||||
|
}
|
||||||
|
@(objc_type = Window, objc_name = "toggleFullScreen")
|
||||||
|
Window_toggleFullScreen :: proc "c" (self: ^Window, sender: id) {
|
||||||
|
msgSend(nil, self, "toggleFullScreen:", sender)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user