objc2_replay_kit/generated/
RPBroadcast.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15extern_class!(
16    /// Controller object that allows clients to present the macOS broadcast picker and returns the RPBroadcastController object that controls broadcast functionality.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastactivitycontroller?language=objc)
19    #[unsafe(super(NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    pub struct RPBroadcastActivityController;
22);
23
24extern_conformance!(
25    unsafe impl NSObjectProtocol for RPBroadcastActivityController {}
26);
27
28impl RPBroadcastActivityController {
29    extern_methods!(
30        #[cfg(all(
31            feature = "block2",
32            feature = "objc2-app-kit",
33            feature = "objc2-core-foundation"
34        ))]
35        #[cfg(target_os = "macos")]
36        /// Shows the broadcast picker at specified origin point from specified application window. Loads a RPBroadcastActivityController instance and returns it in the handler block. Calling this will present a macOS picker with a list of available broadcast services for the user to select and return the the RPBroadcastActivityController object. Note, the origin point represent the top left hand corner position of the picker that will be displayed. Upon completion of the picker, the picker object will be automatically dismissed and the delegate's broadcastActivityController:didFinishWithBroadcastController:error: will be called.
37        ///
38        /// Parameter `point`: origin point where (0,0) is the bottom left of the specified application window
39        ///
40        /// Parameter `window`: application window presenting the picker. nil specifies the picker is presented from the application main window.
41        ///
42        /// Parameter `preferredExtension`: The extension bundle identifier for the preferred broadcast extension service. nil specifies all extensions will be shown.
43        ///
44        /// The handler will be called after the user us finished with the picker and has finish setting up the broadcast extension, which will provide an instance of RPBroadcastAcvityController and an error if one occured.
45        #[unsafe(method(showBroadcastPickerAtPoint:fromWindow:preferredExtensionIdentifier:completionHandler:))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn showBroadcastPickerAtPoint_fromWindow_preferredExtensionIdentifier_completionHandler(
48            point: CGPoint,
49            window: Option<&NSWindow>,
50            preferred_extension: Option<&NSString>,
51            handler: &block2::DynBlock<dyn Fn(*mut RPBroadcastActivityController, *mut NSError)>,
52        );
53
54        /// Delegate that is notified when the activity view controller is complete.
55        #[unsafe(method(delegate))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn delegate(
58            &self,
59        ) -> Option<Retained<ProtocolObject<dyn RPBroadcastActivityControllerDelegate>>>;
60
61        /// Setter for [`delegate`][Self::delegate].
62        ///
63        /// This is a [weak property][objc2::topics::weak_property].
64        #[unsafe(method(setDelegate:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setDelegate(
67            &self,
68            delegate: Option<&ProtocolObject<dyn RPBroadcastActivityControllerDelegate>>,
69        );
70    );
71}
72
73/// Methods declared on superclass `NSObject`.
74impl RPBroadcastActivityController {
75    extern_methods!(
76        #[unsafe(method(init))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
79
80        #[unsafe(method(new))]
81        #[unsafe(method_family = new)]
82        pub unsafe fn new() -> Retained<Self>;
83    );
84}
85
86extern_protocol!(
87    /// RPBroadcastActivityControllerDelegate is used to notify the caller when the user has finshed with the RPBroadcastActivityController's picker.
88    ///
89    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastactivitycontrollerdelegate?language=objc)
90    pub unsafe trait RPBroadcastActivityControllerDelegate: NSObjectProtocol {
91        #[unsafe(method(broadcastActivityController:didFinishWithBroadcastController:error:))]
92        #[unsafe(method_family = none)]
93        unsafe fn broadcastActivityController_didFinishWithBroadcastController_error(
94            &self,
95            broadcast_activity_controller: &RPBroadcastActivityController,
96            broadcast_controller: Option<&RPBroadcastController>,
97            error: Option<&NSError>,
98        );
99    }
100);
101
102extern_class!(
103    /// Available once a user has successfully initiated a broadcast using an RPBroadcastActivityViewController. Can be used to start, pause and stop a broadcast.
104    ///
105    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastcontroller?language=objc)
106    #[unsafe(super(NSObject))]
107    #[derive(Debug, PartialEq, Eq, Hash)]
108    pub struct RPBroadcastController;
109);
110
111extern_conformance!(
112    unsafe impl NSObjectProtocol for RPBroadcastController {}
113);
114
115impl RPBroadcastController {
116    extern_methods!(
117        #[unsafe(method(isBroadcasting))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn isBroadcasting(&self) -> bool;
120
121        #[unsafe(method(isPaused))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn isPaused(&self) -> bool;
124
125        #[unsafe(method(broadcastURL))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn broadcastURL(&self) -> Retained<NSURL>;
128
129        #[unsafe(method(serviceInfo))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn serviceInfo(&self) -> Option<Retained<NSDictionary<NSString, NSObject>>>;
132
133        #[unsafe(method(delegate))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn delegate(
136            &self,
137        ) -> Option<Retained<ProtocolObject<dyn RPBroadcastControllerDelegate>>>;
138
139        /// Setter for [`delegate`][Self::delegate].
140        ///
141        /// This is a [weak property][objc2::topics::weak_property].
142        #[unsafe(method(setDelegate:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setDelegate(
145            &self,
146            delegate: Option<&ProtocolObject<dyn RPBroadcastControllerDelegate>>,
147        );
148
149        #[deprecated = "No longer supported"]
150        #[unsafe(method(broadcastExtensionBundleID))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn broadcastExtensionBundleID(&self) -> Option<Retained<NSString>>;
153
154        #[cfg(feature = "block2")]
155        #[unsafe(method(startBroadcastWithHandler:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn startBroadcastWithHandler(
158            &self,
159            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
160        );
161
162        #[unsafe(method(pauseBroadcast))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn pauseBroadcast(&self);
165
166        #[unsafe(method(resumeBroadcast))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn resumeBroadcast(&self);
169
170        #[cfg(feature = "block2")]
171        #[unsafe(method(finishBroadcastWithHandler:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn finishBroadcastWithHandler(
174            &self,
175            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
176        );
177    );
178}
179
180/// Methods declared on superclass `NSObject`.
181impl RPBroadcastController {
182    extern_methods!(
183        #[unsafe(method(init))]
184        #[unsafe(method_family = init)]
185        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186
187        #[unsafe(method(new))]
188        #[unsafe(method_family = new)]
189        pub unsafe fn new() -> Retained<Self>;
190    );
191}
192
193extern_protocol!(
194    /// [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastcontrollerdelegate?language=objc)
195    pub unsafe trait RPBroadcastControllerDelegate: NSObjectProtocol {
196        #[optional]
197        #[unsafe(method(broadcastController:didFinishWithError:))]
198        #[unsafe(method_family = none)]
199        unsafe fn broadcastController_didFinishWithError(
200            &self,
201            broadcast_controller: &RPBroadcastController,
202            error: Option<&NSError>,
203        );
204
205        /// # Safety
206        ///
207        /// `service_info` generic must implement NSCoding.
208        #[optional]
209        #[unsafe(method(broadcastController:didUpdateServiceInfo:))]
210        #[unsafe(method_family = none)]
211        unsafe fn broadcastController_didUpdateServiceInfo(
212            &self,
213            broadcast_controller: &RPBroadcastController,
214            service_info: &NSDictionary<NSString, NSObject>,
215        );
216
217        #[optional]
218        #[unsafe(method(broadcastController:didUpdateBroadcastURL:))]
219        #[unsafe(method_family = none)]
220        unsafe fn broadcastController_didUpdateBroadcastURL(
221            &self,
222            broadcast_controller: &RPBroadcastController,
223            broadcast_url: &NSURL,
224        );
225    }
226);