objc2_screen_capture_kit/generated/
SCShareableContent.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-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14/// Defines the type of content being shared
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scshareablecontentstyle?language=objc)
17// NS_ENUM
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct SCShareableContentStyle(pub NSInteger);
21impl SCShareableContentStyle {
22    #[doc(alias = "SCShareableContentStyleNone")]
23    pub const None: Self = Self(0);
24    #[doc(alias = "SCShareableContentStyleWindow")]
25    pub const Window: Self = Self(1);
26    #[doc(alias = "SCShareableContentStyleDisplay")]
27    pub const Display: Self = Self(2);
28    #[doc(alias = "SCShareableContentStyleApplication")]
29    pub const Application: Self = Self(3);
30}
31
32unsafe impl Encode for SCShareableContentStyle {
33    const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for SCShareableContentStyle {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scrunningapplication?language=objc)
42    #[unsafe(super(NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    pub struct SCRunningApplication;
45);
46
47extern_conformance!(
48    unsafe impl NSObjectProtocol for SCRunningApplication {}
49);
50
51impl SCRunningApplication {
52    extern_methods!(
53        /// bundleIdentifier the bundleIdentifier for the SCRunningApplication
54        #[unsafe(method(bundleIdentifier))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn bundleIdentifier(&self) -> Retained<NSString>;
57
58        /// applicationName the application name for the SCRunningApplication
59        #[unsafe(method(applicationName))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn applicationName(&self) -> Retained<NSString>;
62
63        #[cfg(feature = "libc")]
64        /// processID the SCRunningApplication
65        #[unsafe(method(processID))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn processID(&self) -> libc::pid_t;
68
69        #[unsafe(method(init))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73        #[unsafe(method(new))]
74        #[unsafe(method_family = new)]
75        pub unsafe fn new() -> Retained<Self>;
76    );
77}
78
79extern_class!(
80    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scwindow?language=objc)
81    #[unsafe(super(NSObject))]
82    #[derive(Debug, PartialEq, Eq, Hash)]
83    pub struct SCWindow;
84);
85
86extern_conformance!(
87    unsafe impl NSObjectProtocol for SCWindow {}
88);
89
90impl SCWindow {
91    extern_methods!(
92        #[cfg(feature = "objc2-core-graphics")]
93        /// windowID the CGWindowID for the SCWindow
94        #[unsafe(method(windowID))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn windowID(&self) -> CGWindowID;
97
98        #[cfg(feature = "objc2-core-foundation")]
99        /// frame the CGRect for the SCWindow
100        #[unsafe(method(frame))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn frame(&self) -> CGRect;
103
104        /// title the window title for the SCWindow
105        #[unsafe(method(title))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
108
109        /// windowLayer the window layer for the SCWindow
110        #[unsafe(method(windowLayer))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn windowLayer(&self) -> NSInteger;
113
114        /// owningApplication is the SCRunningApplication that owns this SCWindow
115        #[unsafe(method(owningApplication))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn owningApplication(&self) -> Option<Retained<SCRunningApplication>>;
118
119        /// onScreen the bool property denoting of the SCWindow is on the screen
120        #[unsafe(method(isOnScreen))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn isOnScreen(&self) -> bool;
123
124        /// active the bool property denoting of the SCWindow is active. with Stage Manager, SCWindow can be offScreen and active
125        #[unsafe(method(isActive))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn isActive(&self) -> bool;
128
129        #[unsafe(method(init))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
132
133        #[unsafe(method(new))]
134        #[unsafe(method_family = new)]
135        pub unsafe fn new() -> Retained<Self>;
136    );
137}
138
139extern_class!(
140    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scdisplay?language=objc)
141    #[unsafe(super(NSObject))]
142    #[derive(Debug, PartialEq, Eq, Hash)]
143    pub struct SCDisplay;
144);
145
146extern_conformance!(
147    unsafe impl NSObjectProtocol for SCDisplay {}
148);
149
150impl SCDisplay {
151    extern_methods!(
152        #[cfg(feature = "objc2-core-graphics")]
153        /// displayId the CGDirectDisplayID for the SCDisplay
154        #[unsafe(method(displayID))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn displayID(&self) -> CGDirectDisplayID;
157
158        /// width the width, in points, for the SCDisplay
159        #[unsafe(method(width))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn width(&self) -> NSInteger;
162
163        /// height the height, in points, for the SCDisplay
164        #[unsafe(method(height))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn height(&self) -> NSInteger;
167
168        #[cfg(feature = "objc2-core-foundation")]
169        /// frame the CGRect frame for the SCDisplay
170        #[unsafe(method(frame))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn frame(&self) -> CGRect;
173
174        #[unsafe(method(init))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
177
178        #[unsafe(method(new))]
179        #[unsafe(method_family = new)]
180        pub unsafe fn new() -> Retained<Self>;
181    );
182}
183
184extern_class!(
185    /// SCShareableContentInfo
186    ///
187    /// SCShareableContentInformation is an object that has information about the content of the stream
188    ///
189    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scshareablecontentinfo?language=objc)
190    #[unsafe(super(NSObject))]
191    #[derive(Debug, PartialEq, Eq, Hash)]
192    pub struct SCShareableContentInfo;
193);
194
195extern_conformance!(
196    unsafe impl NSObjectProtocol for SCShareableContentInfo {}
197);
198
199impl SCShareableContentInfo {
200    extern_methods!(
201        /// style of stream
202        #[unsafe(method(style))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn style(&self) -> SCShareableContentStyle;
205
206        /// Pixel to points scaling factor
207        #[unsafe(method(pointPixelScale))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn pointPixelScale(&self) -> c_float;
210
211        #[cfg(feature = "objc2-core-foundation")]
212        /// Size and location of content in points
213        #[unsafe(method(contentRect))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn contentRect(&self) -> CGRect;
216    );
217}
218
219/// Methods declared on superclass `NSObject`.
220impl SCShareableContentInfo {
221    extern_methods!(
222        #[unsafe(method(init))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225
226        #[unsafe(method(new))]
227        #[unsafe(method_family = new)]
228        pub unsafe fn new() -> Retained<Self>;
229    );
230}
231
232extern_class!(
233    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scshareablecontent?language=objc)
234    #[unsafe(super(NSObject))]
235    #[derive(Debug, PartialEq, Eq, Hash)]
236    pub struct SCShareableContent;
237);
238
239extern_conformance!(
240    unsafe impl NSObjectProtocol for SCShareableContent {}
241);
242
243impl SCShareableContent {
244    extern_methods!(
245        #[cfg(feature = "block2")]
246        /// getShareableContentWithCompletionHandler:completionHandler
247        ///
248        /// Parameter `completionHandler`: the call back that will hand you back a SCShareableContent object
249        ///
250        /// this method will create a SCShareableContent object that is called on the supplied queue. The SCShareableContent will contain the windows, displays and applications that are available to capture
251        #[unsafe(method(getShareableContentWithCompletionHandler:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn getShareableContentWithCompletionHandler(
254            completion_handler: &block2::DynBlock<dyn Fn(*mut SCShareableContent, *mut NSError)>,
255        );
256
257        #[cfg(feature = "block2")]
258        /// getCurrentProcessShareableContentWithCompletionHandler:completionHandler
259        ///
260        /// Parameter `completionHandler`: the call back that will hand you back a SCShareableContent object
261        ///
262        /// this method will create a SCShareableContent object that is called on the supplied queue. The SCShareableContent will contain redacted information about windows, displays and applications that are available to capture by current process without user consent via TCC
263        #[unsafe(method(getCurrentProcessShareableContentWithCompletionHandler:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn getCurrentProcessShareableContentWithCompletionHandler(
266            completion_handler: &block2::DynBlock<dyn Fn(*mut SCShareableContent, *mut NSError)>,
267        );
268
269        #[cfg(feature = "block2")]
270        /// getShareableContentExcludingDesktopWindows:onScreenWindowsOnly:completionHandler
271        ///
272        /// Parameter `excludeDesktopWindows`: a BOOL indicating if we should exclude desktop windows
273        ///
274        /// Parameter `onScreenWindowsOnly`: filter only windows that are on screen
275        ///
276        /// Parameter `completionHandler`: the call back that will hand you back a SCShareableContent object
277        ///
278        /// this method will create a SCShareableContent object that is called on the supplied queue. The SCShareableContent will contain the windows, displays and applications that are available to capture
279        #[unsafe(method(getShareableContentExcludingDesktopWindows:onScreenWindowsOnly:completionHandler:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn getShareableContentExcludingDesktopWindows_onScreenWindowsOnly_completionHandler(
282            exclude_desktop_windows: bool,
283            on_screen_windows_only: bool,
284            completion_handler: &block2::DynBlock<dyn Fn(*mut SCShareableContent, *mut NSError)>,
285        );
286
287        #[cfg(feature = "block2")]
288        /// getShareableContentExcludingDesktopWindows:onScreenWindowsOnlyBelowWindow:completionHandler
289        ///
290        /// Parameter `excludeDesktopWindows`: a BOOL indicating if we should exclude desktop windows
291        ///
292        /// Parameter `window`: filter only windows below this SCWindow
293        ///
294        /// Parameter `completionHandler`: the call back that will hand you back a SCShareableContent object
295        ///
296        /// this method will create a SCShareableContent object that is called on the supplied queue. The SCShareableContent will contain the windows, displays and applications that are available to capture
297        #[unsafe(method(getShareableContentExcludingDesktopWindows:onScreenWindowsOnlyBelowWindow:completionHandler:))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn getShareableContentExcludingDesktopWindows_onScreenWindowsOnlyBelowWindow_completionHandler(
300            exclude_desktop_windows: bool,
301            window: &SCWindow,
302            completion_handler: &block2::DynBlock<dyn Fn(*mut SCShareableContent, *mut NSError)>,
303        );
304
305        #[cfg(feature = "block2")]
306        /// getShareableContentExcludingDesktopWindows:onScreenWindowsOnlyAboveWindow:completionHandler
307        ///
308        /// Parameter `excludeDesktopWindows`: a BOOL indicating if we should exclude desktop windows
309        ///
310        /// Parameter `window`: filter only windows above this SCWindow
311        ///
312        /// Parameter `completionHandler`: the call back that will hand you back a SCShareableContent object
313        ///
314        /// this method will create a SCShareableContent object that is called on the supplied queue. The SCShareableContent will contain the windows, displays and applications that are available to capture
315        #[unsafe(method(getShareableContentExcludingDesktopWindows:onScreenWindowsOnlyAboveWindow:completionHandler:))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn getShareableContentExcludingDesktopWindows_onScreenWindowsOnlyAboveWindow_completionHandler(
318            exclude_desktop_windows: bool,
319            window: &SCWindow,
320            completion_handler: &block2::DynBlock<dyn Fn(*mut SCShareableContent, *mut NSError)>,
321        );
322
323        #[cfg(feature = "SCStream")]
324        /// infoForFilter:
325        ///
326        /// Parameter `filter`: content filter to translate to content details
327        ///
328        /// this method will create a SCShareableContentInformation object given a filter
329        #[unsafe(method(infoForFilter:))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn infoForFilter(filter: &SCContentFilter) -> Retained<SCShareableContentInfo>;
332
333        /// windows SCShareableContent property that contains all the sharable SCWindows
334        #[unsafe(method(windows))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn windows(&self) -> Retained<NSArray<SCWindow>>;
337
338        /// displays SCShareableContent property that contains all the sharable SCDisplays
339        #[unsafe(method(displays))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn displays(&self) -> Retained<NSArray<SCDisplay>>;
342
343        /// applications SCShareableContent property that contains all the sharable SCRunningApplications
344        #[unsafe(method(applications))]
345        #[unsafe(method_family = none)]
346        pub unsafe fn applications(&self) -> Retained<NSArray<SCRunningApplication>>;
347
348        #[unsafe(method(init))]
349        #[unsafe(method_family = init)]
350        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
351
352        #[unsafe(method(new))]
353        #[unsafe(method_family = new)]
354        pub unsafe fn new() -> Retained<Self>;
355    );
356}