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/uidragdropsession?language=objc)
    pub unsafe trait UIDragDropSession: NSObjectProtocol + MainThreadOnly {
        #[cfg(feature = "UIDragItem")]
        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        fn items(&self) -> Retained<NSArray<UIDragItem>>;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(locationInView:))]
        #[unsafe(method_family = none)]
        fn locationInView(&self, view: &UIView) -> CGPoint;

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

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

        #[unsafe(method(hasItemsConformingToTypeIdentifiers:))]
        #[unsafe(method_family = none)]
        fn hasItemsConformingToTypeIdentifiers(&self, type_identifiers: &NSArray<NSString>)
            -> bool;

        /// # Safety
        ///
        /// `a_class` must implement NSItemProviderReading.
        #[unsafe(method(canLoadObjectsOfClass:))]
        #[unsafe(method_family = none)]
        unsafe fn canLoadObjectsOfClass(&self, a_class: &AnyClass) -> bool;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidragsession?language=objc)
    pub unsafe trait UIDragSession: UIDragDropSession + MainThreadOnly {
        #[unsafe(method(localContext))]
        #[unsafe(method_family = none)]
        fn localContext(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`localContext`][Self::localContext].
        ///
        /// # Safety
        ///
        /// `local_context` should be of the correct type.
        #[unsafe(method(setLocalContext:))]
        #[unsafe(method_family = none)]
        unsafe fn setLocalContext(&self, local_context: Option<&AnyObject>);
    }
);

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropsessionprogressindicatorstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIDropSessionProgressIndicatorStyle(pub NSUInteger);
impl UIDropSessionProgressIndicatorStyle {
    #[doc(alias = "UIDropSessionProgressIndicatorStyleNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIDropSessionProgressIndicatorStyleDefault")]
    pub const Default: Self = Self(1);
}

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropsession?language=objc)
    pub unsafe trait UIDropSession:
        UIDragDropSession + NSProgressReporting + MainThreadOnly
    {
        #[unsafe(method(localDragSession))]
        #[unsafe(method_family = none)]
        fn localDragSession(&self) -> Option<Retained<ProtocolObject<dyn UIDragSession>>>;

        #[unsafe(method(progressIndicatorStyle))]
        #[unsafe(method_family = none)]
        fn progressIndicatorStyle(&self) -> UIDropSessionProgressIndicatorStyle;

        /// Setter for [`progressIndicatorStyle`][Self::progressIndicatorStyle].
        #[unsafe(method(setProgressIndicatorStyle:))]
        #[unsafe(method_family = none)]
        fn setProgressIndicatorStyle(
            &self,
            progress_indicator_style: UIDropSessionProgressIndicatorStyle,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `a_class` must implement NSItemProviderReading.
        #[unsafe(method(loadObjectsOfClass:completion:))]
        #[unsafe(method_family = none)]
        unsafe fn loadObjectsOfClass_completion(
            &self,
            a_class: &AnyClass,
            completion: &block2::DynBlock<
                dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSItemProviderReading>>>),
            >,
        ) -> Retained<NSProgress>;
    }
);