objc2_screen_capture_kit/generated/
SCContentSharingPicker.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// SCContentSharingPickerModeSingleWindow picker mode for single window selection
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickermode?language=objc)
13// NS_OPTIONS
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct SCContentSharingPickerMode(pub NSUInteger);
17bitflags::bitflags! {
18    impl SCContentSharingPickerMode: NSUInteger {
19        #[doc(alias = "SCContentSharingPickerModeSingleWindow")]
20        const SingleWindow = 1<<0;
21        #[doc(alias = "SCContentSharingPickerModeMultipleWindows")]
22        const MultipleWindows = 1<<1;
23        #[doc(alias = "SCContentSharingPickerModeSingleApplication")]
24        const SingleApplication = 1<<2;
25        #[doc(alias = "SCContentSharingPickerModeMultipleApplications")]
26        const MultipleApplications = 1<<3;
27        #[doc(alias = "SCContentSharingPickerModeSingleDisplay")]
28        const SingleDisplay = 1<<4;
29    }
30}
31
32unsafe impl Encode for SCContentSharingPickerMode {
33    const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for SCContentSharingPickerMode {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// SCContentSharingPickerConfiguration
42    ///
43    /// SCContentSharingPickerConfiguration is an object which can optionally be set on the SCContentSharingPicker for customized configuration.
44    ///
45    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerconfiguration?language=objc)
46    #[unsafe(super(NSObject))]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct SCContentSharingPickerConfiguration<NSCopying: ?Sized = AnyObject>;
49);
50
51impl<NSCopying: ?Sized + Message> SCContentSharingPickerConfiguration<NSCopying> {
52    /// Unchecked conversion of the generic parameter.
53    ///
54    /// # Safety
55    ///
56    /// The generic must be valid to reinterpret as the given type.
57    #[inline]
58    pub unsafe fn cast_unchecked<NewNSCopying: ?Sized + Message>(
59        &self,
60    ) -> &SCContentSharingPickerConfiguration<NewNSCopying> {
61        unsafe { &*((self as *const Self).cast()) }
62    }
63}
64
65extern_conformance!(
66    unsafe impl<NSCopying: ?Sized> NSObjectProtocol for SCContentSharingPickerConfiguration<NSCopying> {}
67);
68
69impl<NSCopying: Message> SCContentSharingPickerConfiguration<NSCopying> {
70    extern_methods!(
71        /// allowedPickerModes Limits the type of selections available to the user when the picker is presented. Default is 0, no excluded picking modes
72        #[unsafe(method(allowedPickerModes))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn allowedPickerModes(&self) -> SCContentSharingPickerMode;
75
76        /// Setter for [`allowedPickerModes`][Self::allowedPickerModes].
77        #[unsafe(method(setAllowedPickerModes:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setAllowedPickerModes(
80            &self,
81            allowed_picker_modes: SCContentSharingPickerMode,
82        );
83
84        /// excludedWindowIDs Excludes CGWindowIDs for picking
85        #[unsafe(method(excludedWindowIDs))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn excludedWindowIDs(&self) -> Retained<NSArray<NSNumber>>;
88
89        /// Setter for [`excludedWindowIDs`][Self::excludedWindowIDs].
90        #[unsafe(method(setExcludedWindowIDs:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn setExcludedWindowIDs(&self, excluded_window_i_ds: &NSArray<NSNumber>);
93
94        /// excludedBundleIDs Excludes bundle IDs for picking
95        #[unsafe(method(excludedBundleIDs))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn excludedBundleIDs(&self) -> Retained<NSArray<NSString>>;
98
99        /// Setter for [`excludedBundleIDs`][Self::excludedBundleIDs].
100        #[unsafe(method(setExcludedBundleIDs:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setExcludedBundleIDs(&self, excluded_bundle_i_ds: &NSArray<NSString>);
103
104        /// allowsChangingSelectedContent Controls if the user can make updates to the content filter after the initial selection. Defaults is YES.
105        #[unsafe(method(allowsChangingSelectedContent))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn allowsChangingSelectedContent(&self) -> bool;
108
109        /// Setter for [`allowsChangingSelectedContent`][Self::allowsChangingSelectedContent].
110        #[unsafe(method(setAllowsChangingSelectedContent:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setAllowsChangingSelectedContent(
113            &self,
114            allows_changing_selected_content: bool,
115        );
116    );
117}
118
119/// Methods declared on superclass `NSObject`.
120impl<NSCopying: Message> SCContentSharingPickerConfiguration<NSCopying> {
121    extern_methods!(
122        #[unsafe(method(init))]
123        #[unsafe(method_family = init)]
124        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
125
126        #[unsafe(method(new))]
127        #[unsafe(method_family = new)]
128        pub unsafe fn new() -> Retained<Self>;
129    );
130}
131
132extern_class!(
133    /// SCContentSharingPicker
134    ///
135    /// SCContentSharingPicker is an object created by client applications to opt-in to Control Center's content picker
136    ///
137    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccontentsharingpicker?language=objc)
138    #[unsafe(super(NSObject))]
139    #[derive(Debug, PartialEq, Eq, Hash)]
140    pub struct SCContentSharingPicker;
141);
142
143extern_conformance!(
144    unsafe impl NSObjectProtocol for SCContentSharingPicker {}
145);
146
147impl SCContentSharingPicker {
148    extern_methods!(
149        #[unsafe(method(init))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new() -> Retained<Self>;
156
157        /// sharedPicker the singleton shared picker for the application
158        #[unsafe(method(sharedPicker))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn sharedPicker() -> Retained<SCContentSharingPicker>;
161
162        /// defaultConfiguration for the content sharing picker. If a stream does not have a configuration, the default configuration will be used.
163        #[unsafe(method(defaultConfiguration))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn defaultConfiguration(&self) -> Retained<SCContentSharingPickerConfiguration>;
166
167        /// Setter for [`defaultConfiguration`][Self::defaultConfiguration].
168        ///
169        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
170        ///
171        /// # Safety
172        ///
173        /// `default_configuration` generic should be of the correct type.
174        #[unsafe(method(setDefaultConfiguration:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setDefaultConfiguration(
177            &self,
178            default_configuration: &SCContentSharingPickerConfiguration,
179        );
180
181        /// maximumStreamCount An integer value that, if set, limits when Control Center will show the UI to present a picker with no associated stream. If set to 0, Control Center will never ever show UI to present a picker without an associated stream.
182        #[unsafe(method(maximumStreamCount))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn maximumStreamCount(&self) -> Option<Retained<NSNumber>>;
185
186        /// Setter for [`maximumStreamCount`][Self::maximumStreamCount].
187        #[unsafe(method(setMaximumStreamCount:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setMaximumStreamCount(&self, maximum_stream_count: Option<&NSNumber>);
190
191        /// active A picker needs to be marked as active for its UI to appear. If `startPickingContent` is called and the picker is not marked as active, the picker will not appear.
192        #[unsafe(method(isActive))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn isActive(&self) -> bool;
195
196        /// Setter for [`isActive`][Self::isActive].
197        #[unsafe(method(setActive:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setActive(&self, active: bool);
200
201        /// addObserver:
202        ///
203        /// Parameter `observer`: the observer object that adheres to SCContentSharingPickerObserver protocol
204        ///
205        /// Adds an observer object that will receive the results of user interaction with a displayed picker
206        #[unsafe(method(addObserver:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn addObserver(
209            &self,
210            observer: &ProtocolObject<dyn SCContentSharingPickerObserver>,
211        );
212
213        /// removeObserver:
214        ///
215        /// Parameter `observer`: the observer object that adheres to SCContentSharingPickerObserver protocol
216        ///
217        /// Removes an observer object that will receive the results of user interaction with a displayed picker
218        #[unsafe(method(removeObserver:))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn removeObserver(
221            &self,
222            observer: &ProtocolObject<dyn SCContentSharingPickerObserver>,
223        );
224
225        #[cfg(feature = "SCStream")]
226        /// setConfiguration:forStream:
227        ///
228        /// Parameter `pickerConfig`: configuration for the picker
229        ///
230        /// Parameter `stream`: stream for optional picking configuration
231        ///
232        /// Sets optional configuration for the picker for a specific stream. If this is not set, the stream will use the defaultConfiguration instead
233        ///
234        /// # Safety
235        ///
236        /// `picker_config` generic should be of the correct type.
237        #[unsafe(method(setConfiguration:forStream:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn setConfiguration_forStream(
240            &self,
241            picker_config: Option<&SCContentSharingPickerConfiguration>,
242            stream: &SCStream,
243        );
244
245        /// present
246        ///
247        /// show content sharing picker to get content for updating a new stream
248        #[unsafe(method(present))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn present(&self);
251
252        #[cfg(feature = "SCShareableContent")]
253        /// presentPickerUsingContentStyle:
254        ///
255        /// Parameter `contentStyle`: the mode in which picking should start
256        ///
257        /// Takes a person straight into picking particular windows or displays
258        #[unsafe(method(presentPickerUsingContentStyle:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn presentPickerUsingContentStyle(&self, content_style: SCShareableContentStyle);
261
262        #[cfg(feature = "SCStream")]
263        /// presentPickerForStream:
264        ///
265        /// Parameter `stream`: the stream to update
266        ///
267        /// show content sharing picker with an existing stream
268        #[unsafe(method(presentPickerForStream:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn presentPickerForStream(&self, stream: &SCStream);
271
272        #[cfg(all(feature = "SCShareableContent", feature = "SCStream"))]
273        /// presentPickerForStream:usingContentStyle:
274        ///
275        /// Parameter `stream`: the stream that the picker will display
276        ///
277        /// Parameter `contentStyle`: the mode in which picking should start
278        ///
279        /// Takes a person straight into picking particular windows or displays
280        #[unsafe(method(presentPickerForStream:usingContentStyle:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn presentPickerForStream_usingContentStyle(
283            &self,
284            stream: &SCStream,
285            content_style: SCShareableContentStyle,
286        );
287    );
288}
289
290extern_protocol!(
291    /// SCContentSharingPickerObserver
292    ///
293    /// SCContentSharingPickerObserver the protocol that is used to inform client when the picker did make selection or cancel
294    ///
295    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccontentsharingpickerobserver?language=objc)
296    pub unsafe trait SCContentSharingPickerObserver: NSObjectProtocol {
297        #[cfg(feature = "SCStream")]
298        /// contentSharingPicker:didCancelforStream:
299        ///
300        /// Parameter `picker`: the SCContentSharingPicker object
301        ///
302        /// Parameter `stream`: the optional associated stream for this picker
303        ///
304        /// the observer callback method when the picker has been canceled with no selection.
305        #[unsafe(method(contentSharingPicker:didCancelForStream:))]
306        #[unsafe(method_family = none)]
307        unsafe fn contentSharingPicker_didCancelForStream(
308            &self,
309            picker: &SCContentSharingPicker,
310            stream: Option<&SCStream>,
311        );
312
313        #[cfg(feature = "SCStream")]
314        /// contentSharingPicker:didUpdateWithFilter:forStream:
315        ///
316        /// Parameter `picker`: the SCContentSharingPicker object
317        ///
318        /// Parameter `filter`: the updated filter
319        ///
320        /// Parameter `stream`: the updated stream
321        ///
322        /// the observer callback method when the user has finished updating content for a stream
323        #[unsafe(method(contentSharingPicker:didUpdateWithFilter:forStream:))]
324        #[unsafe(method_family = none)]
325        unsafe fn contentSharingPicker_didUpdateWithFilter_forStream(
326            &self,
327            picker: &SCContentSharingPicker,
328            filter: &SCContentFilter,
329            stream: Option<&SCStream>,
330        );
331
332        /// contentSharingPickerStartDidFailWithError:
333        ///
334        /// Parameter `error`: the error denoted for the failure to start picker
335        ///
336        /// the observer callback method when the picker was asked to start but failed to do so.
337        #[unsafe(method(contentSharingPickerStartDidFailWithError:))]
338        #[unsafe(method_family = none)]
339        unsafe fn contentSharingPickerStartDidFailWithError(&self, error: &NSError);
340    }
341);