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