objc2_ui_kit/generated/
UIDragInteraction.rs1use 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 pub unsafe trait UIDragAnimating: NSObjectProtocol + MainThreadOnly {
15 #[cfg(feature = "block2")]
16 #[unsafe(method(addAnimations:))]
17 #[unsafe(method_family = none)]
18 unsafe fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
19
20 #[cfg(all(feature = "UIViewAnimating", feature = "block2"))]
21 #[unsafe(method(addCompletion:))]
22 #[unsafe(method_family = none)]
23 unsafe fn addCompletion(
24 &self,
25 completion: &block2::DynBlock<dyn Fn(UIViewAnimatingPosition)>,
26 );
27 }
28);
29
30extern_class!(
31 #[unsafe(super(NSObject))]
33 #[thread_kind = MainThreadOnly]
34 #[derive(Debug, PartialEq, Eq, Hash)]
35 pub struct UIDragInteraction;
36);
37
38extern_conformance!(
39 unsafe impl NSObjectProtocol for UIDragInteraction {}
40);
41
42#[cfg(feature = "UIInteraction")]
43extern_conformance!(
44 unsafe impl UIInteraction for UIDragInteraction {}
45);
46
47impl UIDragInteraction {
48 extern_methods!(
49 #[unsafe(method(initWithDelegate:))]
50 #[unsafe(method_family = init)]
51 pub unsafe fn initWithDelegate(
52 this: Allocated<Self>,
53 delegate: &ProtocolObject<dyn UIDragInteractionDelegate>,
54 ) -> Retained<Self>;
55
56 #[unsafe(method(init))]
57 #[unsafe(method_family = init)]
58 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
59
60 #[unsafe(method(new))]
61 #[unsafe(method_family = new)]
62 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
63
64 #[unsafe(method(delegate))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn delegate(
67 &self,
68 ) -> Option<Retained<ProtocolObject<dyn UIDragInteractionDelegate>>>;
69
70 #[unsafe(method(allowsSimultaneousRecognitionDuringLift))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn allowsSimultaneousRecognitionDuringLift(&self) -> bool;
73
74 #[unsafe(method(setAllowsSimultaneousRecognitionDuringLift:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn setAllowsSimultaneousRecognitionDuringLift(
78 &self,
79 allows_simultaneous_recognition_during_lift: bool,
80 );
81
82 #[unsafe(method(isEnabled))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn isEnabled(&self) -> bool;
85
86 #[unsafe(method(setEnabled:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn setEnabled(&self, enabled: bool);
90
91 #[unsafe(method(isEnabledByDefault))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn isEnabledByDefault(mtm: MainThreadMarker) -> bool;
94 );
95}
96
97extern_protocol!(
98 pub unsafe trait UIDragInteractionDelegate: NSObjectProtocol + MainThreadOnly {
100 #[cfg(all(feature = "UIDragItem", feature = "UIDragSession"))]
101 #[unsafe(method(dragInteraction:itemsForBeginningSession:))]
102 #[unsafe(method_family = none)]
103 unsafe fn dragInteraction_itemsForBeginningSession(
104 &self,
105 interaction: &UIDragInteraction,
106 session: &ProtocolObject<dyn UIDragSession>,
107 ) -> Retained<NSArray<UIDragItem>>;
108
109 #[cfg(all(
110 feature = "UIDragItem",
111 feature = "UIDragSession",
112 feature = "UITargetedDragPreview",
113 feature = "UITargetedPreview"
114 ))]
115 #[optional]
116 #[unsafe(method(dragInteraction:previewForLiftingItem:session:))]
117 #[unsafe(method_family = none)]
118 unsafe fn dragInteraction_previewForLiftingItem_session(
119 &self,
120 interaction: &UIDragInteraction,
121 item: &UIDragItem,
122 session: &ProtocolObject<dyn UIDragSession>,
123 ) -> Option<Retained<UITargetedDragPreview>>;
124
125 #[cfg(feature = "UIDragSession")]
126 #[optional]
127 #[unsafe(method(dragInteraction:willAnimateLiftWithAnimator:session:))]
128 #[unsafe(method_family = none)]
129 unsafe fn dragInteraction_willAnimateLiftWithAnimator_session(
130 &self,
131 interaction: &UIDragInteraction,
132 animator: &ProtocolObject<dyn UIDragAnimating>,
133 session: &ProtocolObject<dyn UIDragSession>,
134 );
135
136 #[cfg(feature = "UIDragSession")]
137 #[optional]
138 #[unsafe(method(dragInteraction:sessionWillBegin:))]
139 #[unsafe(method_family = none)]
140 unsafe fn dragInteraction_sessionWillBegin(
141 &self,
142 interaction: &UIDragInteraction,
143 session: &ProtocolObject<dyn UIDragSession>,
144 );
145
146 #[cfg(feature = "UIDragSession")]
147 #[optional]
148 #[unsafe(method(dragInteraction:sessionAllowsMoveOperation:))]
149 #[unsafe(method_family = none)]
150 unsafe fn dragInteraction_sessionAllowsMoveOperation(
151 &self,
152 interaction: &UIDragInteraction,
153 session: &ProtocolObject<dyn UIDragSession>,
154 ) -> bool;
155
156 #[cfg(feature = "UIDragSession")]
157 #[optional]
158 #[unsafe(method(dragInteraction:sessionIsRestrictedToDraggingApplication:))]
159 #[unsafe(method_family = none)]
160 unsafe fn dragInteraction_sessionIsRestrictedToDraggingApplication(
161 &self,
162 interaction: &UIDragInteraction,
163 session: &ProtocolObject<dyn UIDragSession>,
164 ) -> bool;
165
166 #[cfg(feature = "UIDragSession")]
167 #[optional]
168 #[unsafe(method(dragInteraction:prefersFullSizePreviewsForSession:))]
169 #[unsafe(method_family = none)]
170 unsafe fn dragInteraction_prefersFullSizePreviewsForSession(
171 &self,
172 interaction: &UIDragInteraction,
173 session: &ProtocolObject<dyn UIDragSession>,
174 ) -> bool;
175
176 #[cfg(feature = "UIDragSession")]
177 #[optional]
178 #[unsafe(method(dragInteraction:sessionDidMove:))]
179 #[unsafe(method_family = none)]
180 unsafe fn dragInteraction_sessionDidMove(
181 &self,
182 interaction: &UIDragInteraction,
183 session: &ProtocolObject<dyn UIDragSession>,
184 );
185
186 #[cfg(all(feature = "UIDragSession", feature = "UIDropInteraction"))]
187 #[optional]
188 #[unsafe(method(dragInteraction:session:willEndWithOperation:))]
189 #[unsafe(method_family = none)]
190 unsafe fn dragInteraction_session_willEndWithOperation(
191 &self,
192 interaction: &UIDragInteraction,
193 session: &ProtocolObject<dyn UIDragSession>,
194 operation: UIDropOperation,
195 );
196
197 #[cfg(all(feature = "UIDragSession", feature = "UIDropInteraction"))]
198 #[optional]
199 #[unsafe(method(dragInteraction:session:didEndWithOperation:))]
200 #[unsafe(method_family = none)]
201 unsafe fn dragInteraction_session_didEndWithOperation(
202 &self,
203 interaction: &UIDragInteraction,
204 session: &ProtocolObject<dyn UIDragSession>,
205 operation: UIDropOperation,
206 );
207
208 #[cfg(feature = "UIDragSession")]
209 #[optional]
210 #[unsafe(method(dragInteraction:sessionDidTransferItems:))]
211 #[unsafe(method_family = none)]
212 unsafe fn dragInteraction_sessionDidTransferItems(
213 &self,
214 interaction: &UIDragInteraction,
215 session: &ProtocolObject<dyn UIDragSession>,
216 );
217
218 #[cfg(all(
219 feature = "UIDragItem",
220 feature = "UIDragSession",
221 feature = "objc2-core-foundation"
222 ))]
223 #[optional]
224 #[unsafe(method(dragInteraction:itemsForAddingToSession:withTouchAtPoint:))]
225 #[unsafe(method_family = none)]
226 unsafe fn dragInteraction_itemsForAddingToSession_withTouchAtPoint(
227 &self,
228 interaction: &UIDragInteraction,
229 session: &ProtocolObject<dyn UIDragSession>,
230 point: CGPoint,
231 ) -> Retained<NSArray<UIDragItem>>;
232
233 #[cfg(all(feature = "UIDragSession", feature = "objc2-core-foundation"))]
234 #[optional]
235 #[unsafe(method(dragInteraction:sessionForAddingItems:withTouchAtPoint:))]
236 #[unsafe(method_family = none)]
237 unsafe fn dragInteraction_sessionForAddingItems_withTouchAtPoint(
238 &self,
239 interaction: &UIDragInteraction,
240 sessions: &NSArray<ProtocolObject<dyn UIDragSession>>,
241 point: CGPoint,
242 ) -> Option<Retained<ProtocolObject<dyn UIDragSession>>>;
243
244 #[cfg(all(feature = "UIDragItem", feature = "UIDragSession"))]
245 #[optional]
246 #[unsafe(method(dragInteraction:session:willAddItems:forInteraction:))]
247 #[unsafe(method_family = none)]
248 unsafe fn dragInteraction_session_willAddItems_forInteraction(
249 &self,
250 interaction: &UIDragInteraction,
251 session: &ProtocolObject<dyn UIDragSession>,
252 items: &NSArray<UIDragItem>,
253 adding_interaction: &UIDragInteraction,
254 );
255
256 #[cfg(all(
257 feature = "UIDragItem",
258 feature = "UITargetedDragPreview",
259 feature = "UITargetedPreview"
260 ))]
261 #[optional]
262 #[unsafe(method(dragInteraction:previewForCancellingItem:withDefault:))]
263 #[unsafe(method_family = none)]
264 unsafe fn dragInteraction_previewForCancellingItem_withDefault(
265 &self,
266 interaction: &UIDragInteraction,
267 item: &UIDragItem,
268 default_preview: &UITargetedDragPreview,
269 ) -> Option<Retained<UITargetedDragPreview>>;
270
271 #[cfg(feature = "UIDragItem")]
272 #[optional]
273 #[unsafe(method(dragInteraction:item:willAnimateCancelWithAnimator:))]
274 #[unsafe(method_family = none)]
275 unsafe fn dragInteraction_item_willAnimateCancelWithAnimator(
276 &self,
277 interaction: &UIDragInteraction,
278 item: &UIDragItem,
279 animator: &ProtocolObject<dyn UIDragAnimating>,
280 );
281 }
282);