objc2_foundation/generated/
NSAppleEventManager.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-services")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_services::*;
11
12use crate::*;
13
14#[repr(C)]
16#[derive(Debug)]
17pub struct __NSAppleEventManagerSuspension {
18 inner: [u8; 0],
19 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
20}
21
22unsafe impl RefEncode for __NSAppleEventManagerSuspension {
23 const ENCODING_REF: Encoding =
24 Encoding::Pointer(&Encoding::Struct("__NSAppleEventManagerSuspension", &[]));
25}
26
27pub type NSAppleEventManagerSuspensionID = *const __NSAppleEventManagerSuspension;
29
30extern "C" {
31 pub static NSAppleEventTimeOutDefault: c_double;
33}
34
35extern "C" {
36 pub static NSAppleEventTimeOutNone: c_double;
38}
39
40extern "C" {
41 #[cfg(all(feature = "NSNotification", feature = "NSString"))]
43 pub static NSAppleEventManagerWillProcessFirstEventNotification: &'static NSNotificationName;
44}
45
46extern_class!(
47 #[unsafe(super(NSObject))]
49 #[derive(Debug, PartialEq, Eq, Hash)]
50 pub struct NSAppleEventManager;
51);
52
53extern_conformance!(
54 unsafe impl NSObjectProtocol for NSAppleEventManager {}
55);
56
57impl NSAppleEventManager {
58 extern_methods!(
59 #[unsafe(method(sharedAppleEventManager))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn sharedAppleEventManager() -> Retained<NSAppleEventManager>;
62
63 #[cfg(feature = "objc2-core-services")]
64 #[cfg(target_vendor = "apple")]
65 #[unsafe(method(setEventHandler:andSelector:forEventClass:andEventID:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn setEventHandler_andSelector_forEventClass_andEventID(
68 &self,
69 handler: &AnyObject,
70 handle_event_selector: Sel,
71 event_class: AEEventClass,
72 event_id: AEEventID,
73 );
74
75 #[cfg(feature = "objc2-core-services")]
76 #[cfg(target_vendor = "apple")]
77 #[unsafe(method(removeEventHandlerForEventClass:andEventID:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn removeEventHandlerForEventClass_andEventID(
80 &self,
81 event_class: AEEventClass,
82 event_id: AEEventID,
83 );
84
85 #[cfg(feature = "objc2-core-services")]
86 #[cfg(target_vendor = "apple")]
87 #[unsafe(method(dispatchRawAppleEvent:withRawReply:handlerRefCon:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn dispatchRawAppleEvent_withRawReply_handlerRefCon(
90 &self,
91 the_apple_event: NonNull<AppleEvent>,
92 the_reply: NonNull<AppleEvent>,
93 handler_ref_con: SRefCon,
94 ) -> OSErr;
95
96 #[cfg(feature = "NSAppleEventDescriptor")]
97 #[unsafe(method(currentAppleEvent))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn currentAppleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
100
101 #[cfg(feature = "NSAppleEventDescriptor")]
102 #[unsafe(method(currentReplyAppleEvent))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn currentReplyAppleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
105
106 #[unsafe(method(suspendCurrentAppleEvent))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn suspendCurrentAppleEvent(&self) -> NSAppleEventManagerSuspensionID;
109
110 #[cfg(feature = "NSAppleEventDescriptor")]
111 #[unsafe(method(appleEventForSuspensionID:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn appleEventForSuspensionID(
114 &self,
115 suspension_id: NSAppleEventManagerSuspensionID,
116 ) -> Retained<NSAppleEventDescriptor>;
117
118 #[cfg(feature = "NSAppleEventDescriptor")]
119 #[unsafe(method(replyAppleEventForSuspensionID:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn replyAppleEventForSuspensionID(
122 &self,
123 suspension_id: NSAppleEventManagerSuspensionID,
124 ) -> Retained<NSAppleEventDescriptor>;
125
126 #[unsafe(method(setCurrentAppleEventAndReplyEventWithSuspensionID:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setCurrentAppleEventAndReplyEventWithSuspensionID(
129 &self,
130 suspension_id: NSAppleEventManagerSuspensionID,
131 );
132
133 #[unsafe(method(resumeWithSuspensionID:))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn resumeWithSuspensionID(&self, suspension_id: NSAppleEventManagerSuspensionID);
136 );
137}
138
139impl NSAppleEventManager {
141 extern_methods!(
142 #[unsafe(method(init))]
143 #[unsafe(method_family = init)]
144 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
145
146 #[unsafe(method(new))]
147 #[unsafe(method_family = new)]
148 pub unsafe fn new() -> Retained<Self>;
149 );
150}