use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-cloud-kit")]
use objc2_cloud_kit::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UICloudSharingPermissionOptions(pub NSUInteger);
bitflags::bitflags! {
impl UICloudSharingPermissionOptions: NSUInteger {
#[doc(alias = "UICloudSharingPermissionStandard")]
const Standard = 0;
#[doc(alias = "UICloudSharingPermissionAllowPublic")]
const AllowPublic = 1<<0;
#[doc(alias = "UICloudSharingPermissionAllowPrivate")]
const AllowPrivate = 1<<1;
#[doc(alias = "UICloudSharingPermissionAllowReadOnly")]
const AllowReadOnly = 1<<2;
#[doc(alias = "UICloudSharingPermissionAllowReadWrite")]
const AllowReadWrite = 1<<3;
}
}
unsafe impl Encode for UICloudSharingPermissionOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for UICloudSharingPermissionOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait UICloudSharingControllerDelegate:
NSObjectProtocol + MainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[unsafe(method(cloudSharingController:failedToSaveShareWithError:))]
#[unsafe(method_family = none)]
fn cloudSharingController_failedToSaveShareWithError(
&self,
csc: &UICloudSharingController,
error: &NSError,
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[unsafe(method(itemTitleForCloudSharingController:))]
#[unsafe(method_family = none)]
fn itemTitleForCloudSharingController(
&self,
csc: &UICloudSharingController,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(itemThumbnailDataForCloudSharingController:))]
#[unsafe(method_family = none)]
fn itemThumbnailDataForCloudSharingController(
&self,
csc: &UICloudSharingController,
) -> Option<Retained<NSData>>;
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(itemTypeForCloudSharingController:))]
#[unsafe(method_family = none)]
fn itemTypeForCloudSharingController(
&self,
csc: &UICloudSharingController,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(cloudSharingControllerDidSaveShare:))]
#[unsafe(method_family = none)]
fn cloudSharingControllerDidSaveShare(&self, csc: &UICloudSharingController);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(cloudSharingControllerDidStopSharing:))]
#[unsafe(method_family = none)]
fn cloudSharingControllerDidStopSharing(&self, csc: &UICloudSharingController);
}
);
extern_class!(
#[unsafe(super(UIViewController, UIResponder, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
pub struct UICloudSharingController;
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl NSCoding for UICloudSharingController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl NSObjectProtocol for UICloudSharingController {}
);
#[cfg(all(
feature = "UIAppearance",
feature = "UIResponder",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UIAppearanceContainer for UICloudSharingController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIContentContainer for UICloudSharingController {}
);
#[cfg(all(
feature = "UIFocus",
feature = "UIResponder",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UIFocusEnvironment for UICloudSharingController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
unsafe impl UIResponderStandardEditActions for UICloudSharingController {}
);
#[cfg(all(
feature = "UIResponder",
feature = "UITraitCollection",
feature = "UIViewController"
))]
extern_conformance!(
unsafe impl UITraitEnvironment for UICloudSharingController {}
);
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UICloudSharingController {
extern_methods!(
#[unsafe(method(initWithNibName:bundle:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithNibName_bundle(
this: Allocated<Self>,
nib_name_or_nil: Option<&NSString>,
nib_bundle_or_nil: Option<&NSBundle>,
) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "block2", feature = "objc2-cloud-kit"))]
#[deprecated = "Use -[UIActivityViewController initWithActivityItemsConfiguration:] and pass it a UIActivityItemsConfigurationReading-conforming object with an NSItemProvider and registered preparation handler"]
#[unsafe(method(initWithPreparationHandler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithPreparationHandler(
this: Allocated<Self>,
preparation_handler: &block2::DynBlock<
dyn Fn(
NonNull<UICloudSharingController>,
NonNull<block2::DynBlock<dyn Fn(*mut CKShare, *mut CKContainer, *mut NSError)>>,
),
>,
) -> Retained<Self>;
#[cfg(feature = "objc2-cloud-kit")]
#[unsafe(method(initWithShare:container:))]
#[unsafe(method_family = init)]
pub fn initWithShare_container(
this: Allocated<Self>,
share: &CKShare,
container: &CKContainer,
) -> Retained<Self>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UICloudSharingControllerDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UICloudSharingControllerDelegate>>,
);
#[cfg(feature = "objc2-cloud-kit")]
#[unsafe(method(share))]
#[unsafe(method_family = none)]
pub fn share(&self) -> Option<Retained<CKShare>>;
#[unsafe(method(availablePermissions))]
#[unsafe(method_family = none)]
pub fn availablePermissions(&self) -> UICloudSharingPermissionOptions;
#[unsafe(method(setAvailablePermissions:))]
#[unsafe(method_family = none)]
pub fn setAvailablePermissions(
&self,
available_permissions: UICloudSharingPermissionOptions,
);
#[cfg(feature = "UIActivityItemProvider")]
#[unsafe(method(activityItemSource))]
#[unsafe(method_family = none)]
pub fn activityItemSource(&self) -> Retained<ProtocolObject<dyn UIActivityItemSource>>;
);
}
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UICloudSharingController {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}