use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[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!(
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 {}
);