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 fn sharedAppleEventManager() -> Retained<NSAppleEventManager>;
62
63 #[cfg(feature = "objc2-core-services")]
64 #[cfg(target_vendor = "apple")]
65 #[unsafe(method(setEventHandler:andSelector:forEventClass:andEventID:))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn setEventHandler_andSelector_forEventClass_andEventID(
72 &self,
73 handler: &AnyObject,
74 handle_event_selector: Sel,
75 event_class: AEEventClass,
76 event_id: AEEventID,
77 );
78
79 #[cfg(feature = "objc2-core-services")]
80 #[cfg(target_vendor = "apple")]
81 #[unsafe(method(removeEventHandlerForEventClass:andEventID:))]
82 #[unsafe(method_family = none)]
83 pub fn removeEventHandlerForEventClass_andEventID(
84 &self,
85 event_class: AEEventClass,
86 event_id: AEEventID,
87 );
88
89 #[cfg(feature = "objc2-core-services")]
90 #[cfg(target_vendor = "apple")]
91 #[unsafe(method(dispatchRawAppleEvent:withRawReply:handlerRefCon:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn dispatchRawAppleEvent_withRawReply_handlerRefCon(
99 &self,
100 the_apple_event: NonNull<AppleEvent>,
101 the_reply: NonNull<AppleEvent>,
102 handler_ref_con: SRefCon,
103 ) -> OSErr;
104
105 #[cfg(feature = "NSAppleEventDescriptor")]
106 #[unsafe(method(currentAppleEvent))]
107 #[unsafe(method_family = none)]
108 pub fn currentAppleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
109
110 #[cfg(feature = "NSAppleEventDescriptor")]
111 #[unsafe(method(currentReplyAppleEvent))]
112 #[unsafe(method_family = none)]
113 pub fn currentReplyAppleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
114
115 #[unsafe(method(suspendCurrentAppleEvent))]
116 #[unsafe(method_family = none)]
117 pub fn suspendCurrentAppleEvent(&self) -> NSAppleEventManagerSuspensionID;
118
119 #[cfg(feature = "NSAppleEventDescriptor")]
120 #[unsafe(method(appleEventForSuspensionID:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn appleEventForSuspensionID(
126 &self,
127 suspension_id: NSAppleEventManagerSuspensionID,
128 ) -> Retained<NSAppleEventDescriptor>;
129
130 #[cfg(feature = "NSAppleEventDescriptor")]
131 #[unsafe(method(replyAppleEventForSuspensionID:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn replyAppleEventForSuspensionID(
137 &self,
138 suspension_id: NSAppleEventManagerSuspensionID,
139 ) -> Retained<NSAppleEventDescriptor>;
140
141 #[unsafe(method(setCurrentAppleEventAndReplyEventWithSuspensionID:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn setCurrentAppleEventAndReplyEventWithSuspensionID(
147 &self,
148 suspension_id: NSAppleEventManagerSuspensionID,
149 );
150
151 #[unsafe(method(resumeWithSuspensionID:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn resumeWithSuspensionID(&self, suspension_id: NSAppleEventManagerSuspensionID);
157 );
158}
159
160impl NSAppleEventManager {
162 extern_methods!(
163 #[unsafe(method(init))]
164 #[unsafe(method_family = init)]
165 pub fn init(this: Allocated<Self>) -> Retained<Self>;
166
167 #[unsafe(method(new))]
168 #[unsafe(method_family = new)]
169 pub fn new() -> Retained<Self>;
170 );
171}
172
173impl DefaultRetained for NSAppleEventManager {
174 #[inline]
175 fn default_retained() -> Retained<Self> {
176 Self::new()
177 }
178}