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