objc2-ui-kit 0.3.2

Bindings to the UIKit 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-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidraganimating?language=objc)
    pub unsafe trait UIDragAnimating: NSObjectProtocol + MainThreadOnly {
        #[cfg(feature = "block2")]
        #[unsafe(method(addAnimations:))]
        #[unsafe(method_family = none)]
        fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);

        #[cfg(all(feature = "UIViewAnimating", feature = "block2"))]
        #[unsafe(method(addCompletion:))]
        #[unsafe(method_family = none)]
        fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn(UIViewAnimatingPosition)>);
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidraginteraction?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIDragInteraction;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIDragInteraction {}
);

#[cfg(feature = "UIInteraction")]
extern_conformance!(
    unsafe impl UIInteraction for UIDragInteraction {}
);

impl UIDragInteraction {
    extern_methods!(
        #[unsafe(method(initWithDelegate:))]
        #[unsafe(method_family = init)]
        pub fn initWithDelegate(
            this: Allocated<Self>,
            delegate: &ProtocolObject<dyn UIDragInteractionDelegate>,
        ) -> Retained<Self>;

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;

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

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

        /// Setter for [`allowsSimultaneousRecognitionDuringLift`][Self::allowsSimultaneousRecognitionDuringLift].
        #[unsafe(method(setAllowsSimultaneousRecognitionDuringLift:))]
        #[unsafe(method_family = none)]
        pub fn setAllowsSimultaneousRecognitionDuringLift(
            &self,
            allows_simultaneous_recognition_during_lift: bool,
        );

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

        /// Setter for [`isEnabled`][Self::isEnabled].
        #[unsafe(method(setEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setEnabled(&self, enabled: bool);

        #[unsafe(method(isEnabledByDefault))]
        #[unsafe(method_family = none)]
        pub fn isEnabledByDefault(mtm: MainThreadMarker) -> bool;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidraginteractiondelegate?language=objc)
    pub unsafe trait UIDragInteractionDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "UIDragItem", feature = "UIDragSession"))]
        #[unsafe(method(dragInteraction:itemsForBeginningSession:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_itemsForBeginningSession(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        ) -> Retained<NSArray<UIDragItem>>;

        #[cfg(all(
            feature = "UIDragItem",
            feature = "UIDragSession",
            feature = "UITargetedDragPreview",
            feature = "UITargetedPreview"
        ))]
        #[optional]
        #[unsafe(method(dragInteraction:previewForLiftingItem:session:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_previewForLiftingItem_session(
            &self,
            interaction: &UIDragInteraction,
            item: &UIDragItem,
            session: &ProtocolObject<dyn UIDragSession>,
        ) -> Option<Retained<UITargetedDragPreview>>;

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:willAnimateLiftWithAnimator:session:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_willAnimateLiftWithAnimator_session(
            &self,
            interaction: &UIDragInteraction,
            animator: &ProtocolObject<dyn UIDragAnimating>,
            session: &ProtocolObject<dyn UIDragSession>,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:sessionWillBegin:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_sessionWillBegin(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:sessionAllowsMoveOperation:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_sessionAllowsMoveOperation(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        ) -> bool;

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:sessionIsRestrictedToDraggingApplication:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_sessionIsRestrictedToDraggingApplication(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        ) -> bool;

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:prefersFullSizePreviewsForSession:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_prefersFullSizePreviewsForSession(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        ) -> bool;

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:sessionDidMove:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_sessionDidMove(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        );

        #[cfg(all(feature = "UIDragSession", feature = "UIDropInteraction"))]
        #[optional]
        #[unsafe(method(dragInteraction:session:willEndWithOperation:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_session_willEndWithOperation(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
            operation: UIDropOperation,
        );

        #[cfg(all(feature = "UIDragSession", feature = "UIDropInteraction"))]
        #[optional]
        #[unsafe(method(dragInteraction:session:didEndWithOperation:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_session_didEndWithOperation(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
            operation: UIDropOperation,
        );

        #[cfg(feature = "UIDragSession")]
        #[optional]
        #[unsafe(method(dragInteraction:sessionDidTransferItems:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_sessionDidTransferItems(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
        );

        #[cfg(all(
            feature = "UIDragItem",
            feature = "UIDragSession",
            feature = "objc2-core-foundation"
        ))]
        #[optional]
        #[unsafe(method(dragInteraction:itemsForAddingToSession:withTouchAtPoint:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_itemsForAddingToSession_withTouchAtPoint(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
            point: CGPoint,
        ) -> Retained<NSArray<UIDragItem>>;

        #[cfg(all(feature = "UIDragSession", feature = "objc2-core-foundation"))]
        #[optional]
        #[unsafe(method(dragInteraction:sessionForAddingItems:withTouchAtPoint:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_sessionForAddingItems_withTouchAtPoint(
            &self,
            interaction: &UIDragInteraction,
            sessions: &NSArray<ProtocolObject<dyn UIDragSession>>,
            point: CGPoint,
        ) -> Option<Retained<ProtocolObject<dyn UIDragSession>>>;

        #[cfg(all(feature = "UIDragItem", feature = "UIDragSession"))]
        #[optional]
        #[unsafe(method(dragInteraction:session:willAddItems:forInteraction:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_session_willAddItems_forInteraction(
            &self,
            interaction: &UIDragInteraction,
            session: &ProtocolObject<dyn UIDragSession>,
            items: &NSArray<UIDragItem>,
            adding_interaction: &UIDragInteraction,
        );

        #[cfg(all(
            feature = "UIDragItem",
            feature = "UITargetedDragPreview",
            feature = "UITargetedPreview"
        ))]
        #[optional]
        #[unsafe(method(dragInteraction:previewForCancellingItem:withDefault:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_previewForCancellingItem_withDefault(
            &self,
            interaction: &UIDragInteraction,
            item: &UIDragItem,
            default_preview: &UITargetedDragPreview,
        ) -> Option<Retained<UITargetedDragPreview>>;

        #[cfg(feature = "UIDragItem")]
        #[optional]
        #[unsafe(method(dragInteraction:item:willAnimateCancelWithAnimator:))]
        #[unsafe(method_family = none)]
        fn dragInteraction_item_willAnimateCancelWithAnimator(
            &self,
            interaction: &UIDragInteraction,
            item: &UIDragItem,
            animator: &ProtocolObject<dyn UIDragAnimating>,
        );
    }
);