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        /// This is a [weak property][objc2::topics::weak_property].
62        /// Setter for [`delegate`][Self::delegate].
63        #[unsafe(method(setDelegate:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn setDelegate(
66            &self,
67            delegate: Option<&ProtocolObject<dyn RPBroadcastActivityControllerDelegate>>,
68        );
69    );
70}
71
72/// Methods declared on superclass `NSObject`.
73impl RPBroadcastActivityController {
74    extern_methods!(
75        #[unsafe(method(init))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79        #[unsafe(method(new))]
80        #[unsafe(method_family = new)]
81        pub unsafe fn new() -> Retained<Self>;
82    );
83}
84
85extern_protocol!(
86    /// RPBroadcastActivityControllerDelegate is used to notify the caller when the user has finshed with the RPBroadcastActivityController's picker.
87    ///
88    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastactivitycontrollerdelegate?language=objc)
89    pub unsafe trait RPBroadcastActivityControllerDelegate: NSObjectProtocol {
90        #[unsafe(method(broadcastActivityController:didFinishWithBroadcastController:error:))]
91        #[unsafe(method_family = none)]
92        unsafe fn broadcastActivityController_didFinishWithBroadcastController_error(
93            &self,
94            broadcast_activity_controller: &RPBroadcastActivityController,
95            broadcast_controller: Option<&RPBroadcastController>,
96            error: Option<&NSError>,
97        );
98    }
99);
100
101extern_class!(
102    /// Available once a user has successfully initiated a broadcast using an RPBroadcastActivityViewController. Can be used to start, pause and stop a broadcast.
103    ///
104    /// See also [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastcontroller?language=objc)
105    #[unsafe(super(NSObject))]
106    #[derive(Debug, PartialEq, Eq, Hash)]
107    pub struct RPBroadcastController;
108);
109
110extern_conformance!(
111    unsafe impl NSObjectProtocol for RPBroadcastController {}
112);
113
114impl RPBroadcastController {
115    extern_methods!(
116        #[unsafe(method(isBroadcasting))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn isBroadcasting(&self) -> bool;
119
120        #[unsafe(method(isPaused))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn isPaused(&self) -> bool;
123
124        #[unsafe(method(broadcastURL))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn broadcastURL(&self) -> Retained<NSURL>;
127
128        #[unsafe(method(serviceInfo))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn serviceInfo(&self) -> Option<Retained<NSDictionary<NSString, NSObject>>>;
131
132        #[unsafe(method(delegate))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn delegate(
135            &self,
136        ) -> Option<Retained<ProtocolObject<dyn RPBroadcastControllerDelegate>>>;
137
138        /// This is a [weak property][objc2::topics::weak_property].
139        /// Setter for [`delegate`][Self::delegate].
140        #[unsafe(method(setDelegate:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setDelegate(
143            &self,
144            delegate: Option<&ProtocolObject<dyn RPBroadcastControllerDelegate>>,
145        );
146
147        #[deprecated = "No longer supported"]
148        #[unsafe(method(broadcastExtensionBundleID))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn broadcastExtensionBundleID(&self) -> Option<Retained<NSString>>;
151
152        #[cfg(feature = "block2")]
153        #[unsafe(method(startBroadcastWithHandler:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn startBroadcastWithHandler(
156            &self,
157            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
158        );
159
160        #[unsafe(method(pauseBroadcast))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn pauseBroadcast(&self);
163
164        #[unsafe(method(resumeBroadcast))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn resumeBroadcast(&self);
167
168        #[cfg(feature = "block2")]
169        #[unsafe(method(finishBroadcastWithHandler:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn finishBroadcastWithHandler(
172            &self,
173            handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
174        );
175    );
176}
177
178/// Methods declared on superclass `NSObject`.
179impl RPBroadcastController {
180    extern_methods!(
181        #[unsafe(method(init))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
184
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new() -> Retained<Self>;
188    );
189}
190
191extern_protocol!(
192    /// [Apple's documentation](https://developer.apple.com/documentation/replaykit/rpbroadcastcontrollerdelegate?language=objc)
193    pub unsafe trait RPBroadcastControllerDelegate: NSObjectProtocol {
194        #[optional]
195        #[unsafe(method(broadcastController:didFinishWithError:))]
196        #[unsafe(method_family = none)]
197        unsafe fn broadcastController_didFinishWithError(
198            &self,
199            broadcast_controller: &RPBroadcastController,
200            error: Option<&NSError>,
201        );
202
203        #[optional]
204        #[unsafe(method(broadcastController:didUpdateServiceInfo:))]
205        #[unsafe(method_family = none)]
206        unsafe fn broadcastController_didUpdateServiceInfo(
207            &self,
208            broadcast_controller: &RPBroadcastController,
209            service_info: &NSDictionary<NSString, NSObject>,
210        );
211
212        #[optional]
213        #[unsafe(method(broadcastController:didUpdateBroadcastURL:))]
214        #[unsafe(method_family = none)]
215        unsafe fn broadcastController_didUpdateBroadcastURL(
216            &self,
217            broadcast_controller: &RPBroadcastController,
218            broadcast_url: &NSURL,
219        );
220    }
221);