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