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        unsafe 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        unsafe fn locationInView(&self, view: &UIView) -> CGPoint;
28
29        #[unsafe(method(allowsMoveOperation))]
30        #[unsafe(method_family = none)]
31        unsafe fn allowsMoveOperation(&self) -> bool;
32
33        #[unsafe(method(isRestrictedToDraggingApplication))]
34        #[unsafe(method_family = none)]
35        unsafe fn isRestrictedToDraggingApplication(&self) -> bool;
36
37        #[unsafe(method(hasItemsConformingToTypeIdentifiers:))]
38        #[unsafe(method_family = none)]
39        unsafe fn hasItemsConformingToTypeIdentifiers(
40            &self,
41            type_identifiers: &NSArray<NSString>,
42        ) -> bool;
43
44        #[unsafe(method(canLoadObjectsOfClass:))]
45        #[unsafe(method_family = none)]
46        unsafe fn canLoadObjectsOfClass(&self, a_class: &AnyClass) -> bool;
47    }
48);
49
50extern_protocol!(
51    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidragsession?language=objc)
52    pub unsafe trait UIDragSession: UIDragDropSession + MainThreadOnly {
53        #[unsafe(method(localContext))]
54        #[unsafe(method_family = none)]
55        unsafe fn localContext(&self) -> Option<Retained<AnyObject>>;
56
57        /// Setter for [`localContext`][Self::localContext].
58        #[unsafe(method(setLocalContext:))]
59        #[unsafe(method_family = none)]
60        unsafe fn setLocalContext(&self, local_context: Option<&AnyObject>);
61    }
62);
63
64/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropsessionprogressindicatorstyle?language=objc)
65// NS_ENUM
66#[repr(transparent)]
67#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
68pub struct UIDropSessionProgressIndicatorStyle(pub NSUInteger);
69impl UIDropSessionProgressIndicatorStyle {
70    #[doc(alias = "UIDropSessionProgressIndicatorStyleNone")]
71    pub const None: Self = Self(0);
72    #[doc(alias = "UIDropSessionProgressIndicatorStyleDefault")]
73    pub const Default: Self = Self(1);
74}
75
76unsafe impl Encode for UIDropSessionProgressIndicatorStyle {
77    const ENCODING: Encoding = NSUInteger::ENCODING;
78}
79
80unsafe impl RefEncode for UIDropSessionProgressIndicatorStyle {
81    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84extern_protocol!(
85    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropsession?language=objc)
86    pub unsafe trait UIDropSession:
87        UIDragDropSession + NSProgressReporting + MainThreadOnly
88    {
89        #[unsafe(method(localDragSession))]
90        #[unsafe(method_family = none)]
91        unsafe fn localDragSession(&self) -> Option<Retained<ProtocolObject<dyn UIDragSession>>>;
92
93        #[unsafe(method(progressIndicatorStyle))]
94        #[unsafe(method_family = none)]
95        unsafe fn progressIndicatorStyle(&self) -> UIDropSessionProgressIndicatorStyle;
96
97        /// Setter for [`progressIndicatorStyle`][Self::progressIndicatorStyle].
98        #[unsafe(method(setProgressIndicatorStyle:))]
99        #[unsafe(method_family = none)]
100        unsafe fn setProgressIndicatorStyle(
101            &self,
102            progress_indicator_style: UIDropSessionProgressIndicatorStyle,
103        );
104
105        #[cfg(feature = "block2")]
106        #[unsafe(method(loadObjectsOfClass:completion:))]
107        #[unsafe(method_family = none)]
108        unsafe fn loadObjectsOfClass_completion(
109            &self,
110            a_class: &AnyClass,
111            completion: &block2::DynBlock<
112                dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSItemProviderReading>>>),
113            >,
114        ) -> Retained<NSProgress>;
115    }
116);