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