objc2_ui_kit/generated/
UIDropInteraction.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropinteraction?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIDropInteraction;
16);
17
18unsafe impl NSObjectProtocol for UIDropInteraction {}
19
20#[cfg(feature = "UIInteraction")]
21unsafe impl UIInteraction for UIDropInteraction {}
22
23impl UIDropInteraction {
24    extern_methods!(
25        #[unsafe(method(initWithDelegate:))]
26        #[unsafe(method_family = init)]
27        pub unsafe fn initWithDelegate(
28            this: Allocated<Self>,
29            delegate: &ProtocolObject<dyn UIDropInteractionDelegate>,
30        ) -> Retained<Self>;
31
32        #[unsafe(method(init))]
33        #[unsafe(method_family = init)]
34        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
35
36        #[unsafe(method(new))]
37        #[unsafe(method_family = new)]
38        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
39
40        #[unsafe(method(delegate))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn delegate(
43            &self,
44        ) -> Option<Retained<ProtocolObject<dyn UIDropInteractionDelegate>>>;
45
46        #[unsafe(method(allowsSimultaneousDropSessions))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn allowsSimultaneousDropSessions(&self) -> bool;
49
50        /// Setter for [`allowsSimultaneousDropSessions`][Self::allowsSimultaneousDropSessions].
51        #[unsafe(method(setAllowsSimultaneousDropSessions:))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn setAllowsSimultaneousDropSessions(
54            &self,
55            allows_simultaneous_drop_sessions: bool,
56        );
57    );
58}
59
60/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropoperation?language=objc)
61// NS_ENUM
62#[repr(transparent)]
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
64pub struct UIDropOperation(pub NSUInteger);
65impl UIDropOperation {
66    #[doc(alias = "UIDropOperationCancel")]
67    pub const Cancel: Self = Self(0);
68    #[doc(alias = "UIDropOperationForbidden")]
69    pub const Forbidden: Self = Self(1);
70    #[doc(alias = "UIDropOperationCopy")]
71    pub const Copy: Self = Self(2);
72    #[doc(alias = "UIDropOperationMove")]
73    pub const Move: Self = Self(3);
74}
75
76unsafe impl Encode for UIDropOperation {
77    const ENCODING: Encoding = NSUInteger::ENCODING;
78}
79
80unsafe impl RefEncode for UIDropOperation {
81    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84extern_class!(
85    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropproposal?language=objc)
86    #[unsafe(super(NSObject))]
87    #[thread_kind = MainThreadOnly]
88    #[derive(Debug, PartialEq, Eq, Hash)]
89    pub struct UIDropProposal;
90);
91
92unsafe impl NSCopying for UIDropProposal {}
93
94unsafe impl CopyingHelper for UIDropProposal {
95    type Result = Self;
96}
97
98unsafe impl NSObjectProtocol for UIDropProposal {}
99
100impl UIDropProposal {
101    extern_methods!(
102        #[unsafe(method(initWithDropOperation:))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn initWithDropOperation(
105            this: Allocated<Self>,
106            operation: UIDropOperation,
107        ) -> Retained<Self>;
108
109        #[unsafe(method(init))]
110        #[unsafe(method_family = init)]
111        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
112
113        #[unsafe(method(new))]
114        #[unsafe(method_family = new)]
115        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
116
117        #[unsafe(method(operation))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn operation(&self) -> UIDropOperation;
120
121        #[unsafe(method(isPrecise))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn isPrecise(&self) -> bool;
124
125        /// Setter for [`isPrecise`][Self::isPrecise].
126        #[unsafe(method(setPrecise:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setPrecise(&self, precise: bool);
129
130        #[unsafe(method(prefersFullSizePreview))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn prefersFullSizePreview(&self) -> bool;
133
134        /// Setter for [`prefersFullSizePreview`][Self::prefersFullSizePreview].
135        #[unsafe(method(setPrefersFullSizePreview:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setPrefersFullSizePreview(&self, prefers_full_size_preview: bool);
138    );
139}
140
141extern_protocol!(
142    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidropinteractiondelegate?language=objc)
143    pub unsafe trait UIDropInteractionDelegate: NSObjectProtocol + MainThreadOnly {
144        #[cfg(feature = "UIDragSession")]
145        #[optional]
146        #[unsafe(method(dropInteraction:canHandleSession:))]
147        #[unsafe(method_family = none)]
148        unsafe fn dropInteraction_canHandleSession(
149            &self,
150            interaction: &UIDropInteraction,
151            session: &ProtocolObject<dyn UIDropSession>,
152        ) -> bool;
153
154        #[cfg(feature = "UIDragSession")]
155        #[optional]
156        #[unsafe(method(dropInteraction:sessionDidEnter:))]
157        #[unsafe(method_family = none)]
158        unsafe fn dropInteraction_sessionDidEnter(
159            &self,
160            interaction: &UIDropInteraction,
161            session: &ProtocolObject<dyn UIDropSession>,
162        );
163
164        #[cfg(feature = "UIDragSession")]
165        #[optional]
166        #[unsafe(method(dropInteraction:sessionDidUpdate:))]
167        #[unsafe(method_family = none)]
168        unsafe fn dropInteraction_sessionDidUpdate(
169            &self,
170            interaction: &UIDropInteraction,
171            session: &ProtocolObject<dyn UIDropSession>,
172        ) -> Retained<UIDropProposal>;
173
174        #[cfg(feature = "UIDragSession")]
175        #[optional]
176        #[unsafe(method(dropInteraction:sessionDidExit:))]
177        #[unsafe(method_family = none)]
178        unsafe fn dropInteraction_sessionDidExit(
179            &self,
180            interaction: &UIDropInteraction,
181            session: &ProtocolObject<dyn UIDropSession>,
182        );
183
184        #[cfg(feature = "UIDragSession")]
185        #[optional]
186        #[unsafe(method(dropInteraction:performDrop:))]
187        #[unsafe(method_family = none)]
188        unsafe fn dropInteraction_performDrop(
189            &self,
190            interaction: &UIDropInteraction,
191            session: &ProtocolObject<dyn UIDropSession>,
192        );
193
194        #[cfg(feature = "UIDragSession")]
195        #[optional]
196        #[unsafe(method(dropInteraction:concludeDrop:))]
197        #[unsafe(method_family = none)]
198        unsafe fn dropInteraction_concludeDrop(
199            &self,
200            interaction: &UIDropInteraction,
201            session: &ProtocolObject<dyn UIDropSession>,
202        );
203
204        #[cfg(feature = "UIDragSession")]
205        #[optional]
206        #[unsafe(method(dropInteraction:sessionDidEnd:))]
207        #[unsafe(method_family = none)]
208        unsafe fn dropInteraction_sessionDidEnd(
209            &self,
210            interaction: &UIDropInteraction,
211            session: &ProtocolObject<dyn UIDropSession>,
212        );
213
214        #[cfg(all(
215            feature = "UIDragItem",
216            feature = "UITargetedDragPreview",
217            feature = "UITargetedPreview"
218        ))]
219        #[optional]
220        #[unsafe(method(dropInteraction:previewForDroppingItem:withDefault:))]
221        #[unsafe(method_family = none)]
222        unsafe fn dropInteraction_previewForDroppingItem_withDefault(
223            &self,
224            interaction: &UIDropInteraction,
225            item: &UIDragItem,
226            default_preview: &UITargetedDragPreview,
227        ) -> Option<Retained<UITargetedDragPreview>>;
228
229        #[cfg(all(feature = "UIDragInteraction", feature = "UIDragItem"))]
230        #[optional]
231        #[unsafe(method(dropInteraction:item:willAnimateDropWithAnimator:))]
232        #[unsafe(method_family = none)]
233        unsafe fn dropInteraction_item_willAnimateDropWithAnimator(
234            &self,
235            interaction: &UIDropInteraction,
236            item: &UIDragItem,
237            animator: &ProtocolObject<dyn UIDragAnimating>,
238        );
239    }
240);