1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCContentSharingPickerMode(pub NSUInteger);
bitflags::bitflags! {
    impl SCContentSharingPickerMode: NSUInteger {
        #[doc(alias = "SCContentSharingPickerModeSingleWindow")]
        const SingleWindow = 1<<0;
        #[doc(alias = "SCContentSharingPickerModeMultipleWindows")]
        const MultipleWindows = 1<<1;
        #[doc(alias = "SCContentSharingPickerModeSingleApplication")]
        const SingleApplication = 1<<2;
        #[doc(alias = "SCContentSharingPickerModeMultipleApplications")]
        const MultipleApplications = 1<<3;
        #[doc(alias = "SCContentSharingPickerModeSingleDisplay")]
        const SingleDisplay = 1<<4;
    }
}

unsafe impl Encode for SCContentSharingPickerMode {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for SCContentSharingPickerMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

__inner_extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SCContentSharingPickerConfiguration<NSCopying: ?Sized = AnyObject> {
        __superclass: NSObject,
        _inner0: PhantomData<*mut NSCopying>,
        notunwindsafe: PhantomData<&'static mut ()>,
    }

    unsafe impl<NSCopying: ?Sized + Message> ClassType
        for SCContentSharingPickerConfiguration<NSCopying>
    {
        type Super = NSObject;
        type Mutability = InteriorMutable;

        fn as_super(&self) -> &Self::Super {
            &self.__superclass
        }

        fn as_super_mut(&mut self) -> &mut Self::Super {
            &mut self.__superclass
        }
    }
);

unsafe impl<NSCopying: ?Sized> NSObjectProtocol for SCContentSharingPickerConfiguration<NSCopying> {}

extern_methods!(
    unsafe impl<NSCopying: Message> SCContentSharingPickerConfiguration<NSCopying> {
        #[method(allowedPickerModes)]
        pub unsafe fn allowedPickerModes(&self) -> SCContentSharingPickerMode;

        #[method(setAllowedPickerModes:)]
        pub unsafe fn setAllowedPickerModes(
            &self,
            allowed_picker_modes: SCContentSharingPickerMode,
        );

        #[method_id(@__retain_semantics Other excludedWindowIDs)]
        pub unsafe fn excludedWindowIDs(&self) -> Retained<NSArray<NSNumber>>;

        #[method(setExcludedWindowIDs:)]
        pub unsafe fn setExcludedWindowIDs(&self, excluded_window_i_ds: &NSArray<NSNumber>);

        #[method_id(@__retain_semantics Other excludedBundleIDs)]
        pub unsafe fn excludedBundleIDs(&self) -> Retained<NSArray<NSString>>;

        #[method(setExcludedBundleIDs:)]
        pub unsafe fn setExcludedBundleIDs(&self, excluded_bundle_i_ds: &NSArray<NSString>);

        #[method(allowsChangingSelectedContent)]
        pub unsafe fn allowsChangingSelectedContent(&self) -> bool;

        #[method(setAllowsChangingSelectedContent:)]
        pub unsafe fn setAllowsChangingSelectedContent(
            &self,
            allows_changing_selected_content: bool,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl<NSCopying: Message> SCContentSharingPickerConfiguration<NSCopying> {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SCContentSharingPicker;

    unsafe impl ClassType for SCContentSharingPicker {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for SCContentSharingPicker {}

extern_methods!(
    unsafe impl SCContentSharingPicker {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;

        #[method_id(@__retain_semantics Other sharedPicker)]
        pub unsafe fn sharedPicker() -> Retained<SCContentSharingPicker>;

        #[method_id(@__retain_semantics Other defaultConfiguration)]
        pub unsafe fn defaultConfiguration(&self) -> Retained<SCContentSharingPickerConfiguration>;

        #[method(setDefaultConfiguration:)]
        pub unsafe fn setDefaultConfiguration(
            &self,
            default_configuration: &SCContentSharingPickerConfiguration,
        );

        #[method_id(@__retain_semantics Other maximumStreamCount)]
        pub unsafe fn maximumStreamCount(&self) -> Option<Retained<NSNumber>>;

        #[method(setMaximumStreamCount:)]
        pub unsafe fn setMaximumStreamCount(&self, maximum_stream_count: Option<&NSNumber>);

        #[method(isActive)]
        pub unsafe fn isActive(&self) -> bool;

        #[method(setActive:)]
        pub unsafe fn setActive(&self, active: bool);

        #[method(addObserver:)]
        pub unsafe fn addObserver(
            &self,
            observer: &ProtocolObject<dyn SCContentSharingPickerObserver>,
        );

        #[method(removeObserver:)]
        pub unsafe fn removeObserver(
            &self,
            observer: &ProtocolObject<dyn SCContentSharingPickerObserver>,
        );

        #[cfg(feature = "SCStream")]
        #[method(setConfiguration:forStream:)]
        pub unsafe fn setConfiguration_forStream(
            &self,
            picker_config: Option<&SCContentSharingPickerConfiguration>,
            stream: &SCStream,
        );

        #[method(present)]
        pub unsafe fn present(&self);

        #[cfg(feature = "SCShareableContent")]
        #[method(presentPickerUsingContentStyle:)]
        pub unsafe fn presentPickerUsingContentStyle(&self, content_style: SCShareableContentStyle);

        #[cfg(feature = "SCStream")]
        #[method(presentPickerForStream:)]
        pub unsafe fn presentPickerForStream(&self, stream: &SCStream);

        #[cfg(all(feature = "SCShareableContent", feature = "SCStream"))]
        #[method(presentPickerForStream:usingContentStyle:)]
        pub unsafe fn presentPickerForStream_usingContentStyle(
            &self,
            stream: &SCStream,
            content_style: SCShareableContentStyle,
        );
    }
);

extern_protocol!(
    pub unsafe trait SCContentSharingPickerObserver: NSObjectProtocol {
        #[cfg(feature = "SCStream")]
        #[method(contentSharingPicker:didCancelForStream:)]
        unsafe fn contentSharingPicker_didCancelForStream(
            &self,
            picker: &SCContentSharingPicker,
            stream: Option<&SCStream>,
        );

        #[cfg(feature = "SCStream")]
        #[method(contentSharingPicker:didUpdateWithFilter:forStream:)]
        unsafe fn contentSharingPicker_didUpdateWithFilter_forStream(
            &self,
            picker: &SCContentSharingPicker,
            filter: &SCContentFilter,
            stream: Option<&SCStream>,
        );

        #[method(contentSharingPickerStartDidFailWithError:)]
        unsafe fn contentSharingPickerStartDidFailWithError(&self, error: &NSError);
    }

    unsafe impl ProtocolType for dyn SCContentSharingPickerObserver {}
);