objc2-shared-with-you 0.3.2

Bindings to the SharedWithYou framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/sharedwithyou/swcollaborationviewdelegate?language=objc)
    pub unsafe trait SWCollaborationViewDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(collaborationViewShouldPresentPopover:))]
        #[unsafe(method_family = none)]
        unsafe fn collaborationViewShouldPresentPopover(
            &self,
            collaboration_view: &SWCollaborationView,
        ) -> bool;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(collaborationViewWillPresentPopover:))]
        #[unsafe(method_family = none)]
        unsafe fn collaborationViewWillPresentPopover(
            &self,
            collaboration_view: &SWCollaborationView,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(collaborationViewDidDismissPopover:))]
        #[unsafe(method_family = none)]
        unsafe fn collaborationViewDidDismissPopover(
            &self,
            collaboration_view: &SWCollaborationView,
        );
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/sharedwithyou/swcollaborationview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct SWCollaborationView;
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibility for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSDraggingDestination for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for SWCollaborationView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SWCollaborationView {
    extern_methods!(
        #[unsafe(method(cloudSharingDelegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn cloudSharingDelegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSCloudSharingServiceDelegate>>>;

        /// Setter for [`cloudSharingDelegate`][Self::cloudSharingDelegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setCloudSharingDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCloudSharingDelegate(
            &self,
            cloud_sharing_delegate: Option<&ProtocolObject<dyn NSCloudSharingServiceDelegate>>,
        );

        #[unsafe(method(setContentView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContentView(&self, detail_view_list_content_view: &NSView);

        #[unsafe(method(initWithItemProvider:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithItemProvider(
            this: Allocated<Self>,
            item_provider: &NSItemProvider,
        ) -> Retained<Self>;

        #[unsafe(method(activeParticipantCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn activeParticipantCount(&self) -> NSUInteger;

        /// Setter for [`activeParticipantCount`][Self::activeParticipantCount].
        #[unsafe(method(setActiveParticipantCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActiveParticipantCount(&self, active_participant_count: NSUInteger);

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn SWCollaborationViewDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn SWCollaborationViewDelegate>>,
        );

        #[unsafe(method(headerTitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn headerTitle(&self) -> Retained<NSString>;

        /// Setter for [`headerTitle`][Self::headerTitle].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setHeaderTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeaderTitle(&self, header_title: &NSString);

        #[unsafe(method(headerSubtitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn headerSubtitle(&self) -> Retained<NSString>;

        /// Setter for [`headerSubtitle`][Self::headerSubtitle].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setHeaderSubtitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeaderSubtitle(&self, header_subtitle: &NSString);

        #[unsafe(method(headerImage))]
        #[unsafe(method_family = none)]
        pub unsafe fn headerImage(&self) -> Retained<NSImage>;

        /// Setter for [`headerImage`][Self::headerImage].
        #[unsafe(method(setHeaderImage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeaderImage(&self, header_image: &NSImage);

        #[unsafe(method(menuFormRepresentation))]
        #[unsafe(method_family = none)]
        pub unsafe fn menuFormRepresentation(&self) -> Retained<NSMenuItem>;

        /// If you are using the built in manage share button, this delegate property will be forwarded along to the NSCloudSharingService that button presents. If you have your own and suppress the provided one via setShowManageButton, this does nothing.
        #[unsafe(method(cloudSharingServiceDelegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn cloudSharingServiceDelegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSCloudSharingServiceDelegate>>>;

        /// Setter for [`cloudSharingServiceDelegate`][Self::cloudSharingServiceDelegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setCloudSharingServiceDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCloudSharingServiceDelegate(
            &self,
            cloud_sharing_service_delegate: Option<
                &ProtocolObject<dyn NSCloudSharingServiceDelegate>,
            >,
        );

        #[cfg(feature = "block2")]
        /// Dismisses the popover, if presented.
        ///
        /// Parameter `completion`: Called when the popover dismissal finishes.
        #[unsafe(method(dismissPopover:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dismissPopover(&self, completion: Option<&block2::DynBlock<dyn Fn()>>);

        /// sets the title of the manage participants button in the collaboration popover to the given string, defaults to "Manage Share"
        #[unsafe(method(manageButtonTitle))]
        #[unsafe(method_family = none)]
        pub unsafe fn manageButtonTitle(&self) -> Retained<NSString>;

        /// Setter for [`manageButtonTitle`][Self::manageButtonTitle].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setManageButtonTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setManageButtonTitle(&self, manage_button_title: &NSString);

        /// whether the collaboration popover should show the default manage participants button in the popover, defaults to YES
        ///
        /// Parameter `showManageButton`: whether the button should be hidden
        #[unsafe(method(setShowManageButton:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowManageButton(&self, show_manage_button: bool);
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SWCollaborationView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SWCollaborationView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl SWCollaborationView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}