objc2_ui_kit/generated/
UIDragSession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_protocol!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidragdropsession?language=objc)
14    pub unsafe trait UIDragDropSession: NSObjectProtocol + MainThreadOnly {
15        #[cfg(feature = "UIDragItem")]
16        #[unsafe(method(items))]
17        #[unsafe(method_family = none)]
18        fn items(&self) -> Retained<NSArray<UIDragItem>>;
19
20        #[cfg(all(
21            feature = "UIResponder",
22            feature = "UIView",
23            feature = "objc2-core-foundation"
24        ))]
25        #[unsafe(method(locationInView:))]
26        #[unsafe(method_family = none)]
27        fn locationInView(&self, view: &UIView) -> CGPoint;
28
29        #[unsafe(method(allowsMoveOperation))]
30        #[unsafe(method_family = none)]
31        fn allowsMoveOperation(&self) -> bool;
32
33        #[unsafe(method(isRestrictedToDraggingApplication))]
34        #[unsafe(method_family = none)]
35        fn isRestrictedToDraggingApplication(&self) -> bool;
36
37        #[unsafe(method(hasItemsConformingToTypeIdentifiers:))]
38        #[unsafe(method_family = none)]
39        fn hasItemsConformingToTypeIdentifiers(&self, type_identifiers: &NSArray<NSString>)
40            -> bool;
41
42        /// # Safety
43        ///
44        /// `a_class` must implement NSItemProviderReading.
45        #[unsafe(method(canLoadObjectsOfClass:))]
46        #[unsafe(method_family = none)]
47        unsafe fn canLoadObjectsOfClass(&self, a_class: &AnyClass) -> bool;
48    }
49);
50
51extern_protocol!(
52    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidragsession?language=objc)
53    pub unsafe trait UIDragSession: UIDragDropSession + MainThreadOnly {
54        #[unsafe(method(localContext))]
55        #[unsafe(method_family = none)]
56        fn localContext(&self) -> Option<Retained<AnyObject>>;
57
58        /// Setter for [`localContext`][Self::localContext].
59        ///
60        /// # Safety
61        ///
62        /// `local_context` should be of the correct type.
63        #[unsafe(method(setLocalContext:))]
64        #[unsafe(method_family = none)]
65        unsafe fn setLocalContext(&self, local_context: Option<&AnyObject>);
66    }
67);
68
69/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropsessionprogressindicatorstyle?language=objc)
70// NS_ENUM
71#[repr(transparent)]
72#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
73pub struct UIDropSessionProgressIndicatorStyle(pub NSUInteger);
74impl UIDropSessionProgressIndicatorStyle {
75    #[doc(alias = "UIDropSessionProgressIndicatorStyleNone")]
76    pub const None: Self = Self(0);
77    #[doc(alias = "UIDropSessionProgressIndicatorStyleDefault")]
78    pub const Default: Self = Self(1);
79}
80
81unsafe impl Encode for UIDropSessionProgressIndicatorStyle {
82    const ENCODING: Encoding = NSUInteger::ENCODING;
83}
84
85unsafe impl RefEncode for UIDropSessionProgressIndicatorStyle {
86    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
87}
88
89extern_protocol!(
90    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropsession?language=objc)
91    pub unsafe trait UIDropSession:
92        UIDragDropSession + NSProgressReporting + MainThreadOnly
93    {
94        #[unsafe(method(localDragSession))]
95        #[unsafe(method_family = none)]
96        fn localDragSession(&self) -> Option<Retained<ProtocolObject<dyn UIDragSession>>>;
97
98        #[unsafe(method(progressIndicatorStyle))]
99        #[unsafe(method_family = none)]
100        fn progressIndicatorStyle(&self) -> UIDropSessionProgressIndicatorStyle;
101
102        /// Setter for [`progressIndicatorStyle`][Self::progressIndicatorStyle].
103        #[unsafe(method(setProgressIndicatorStyle:))]
104        #[unsafe(method_family = none)]
105        fn setProgressIndicatorStyle(
106            &self,
107            progress_indicator_style: UIDropSessionProgressIndicatorStyle,
108        );
109
110        #[cfg(feature = "block2")]
111        /// # Safety
112        ///
113        /// `a_class` must implement NSItemProviderReading.
114        #[unsafe(method(loadObjectsOfClass:completion:))]
115        #[unsafe(method_family = none)]
116        unsafe fn loadObjectsOfClass_completion(
117            &self,
118            a_class: &AnyClass,
119            completion: &block2::DynBlock<
120                dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSItemProviderReading>>>),
121            >,
122        ) -> Retained<NSProgress>;
123    }
124);