objc2_ui_kit/generated/
UITextDropping.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
7use crate::*;
8
9extern_protocol!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdroppable?language=objc)
11    #[cfg(all(
12        feature = "UIPasteConfigurationSupporting",
13        feature = "UITextInput",
14        feature = "UITextInputTraits",
15        feature = "UITextPasteConfigurationSupporting"
16    ))]
17    pub unsafe trait UITextDroppable:
18        UITextInput + UITextPasteConfigurationSupporting + MainThreadOnly
19    {
20        #[unsafe(method(textDropDelegate))]
21        #[unsafe(method_family = none)]
22        fn textDropDelegate(&self) -> Option<Retained<ProtocolObject<dyn UITextDropDelegate>>>;
23
24        /// Setter for [`textDropDelegate`][Self::textDropDelegate].
25        ///
26        /// This is a [weak property][objc2::topics::weak_property].
27        #[unsafe(method(setTextDropDelegate:))]
28        #[unsafe(method_family = none)]
29        fn setTextDropDelegate(
30            &self,
31            text_drop_delegate: Option<&ProtocolObject<dyn UITextDropDelegate>>,
32        );
33
34        #[cfg(feature = "UIDropInteraction")]
35        #[unsafe(method(textDropInteraction))]
36        #[unsafe(method_family = none)]
37        fn textDropInteraction(&self) -> Option<Retained<UIDropInteraction>>;
38
39        #[unsafe(method(isTextDropActive))]
40        #[unsafe(method_family = none)]
41        fn isTextDropActive(&self) -> bool;
42    }
43);
44
45/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdropeditability?language=objc)
46// NS_ENUM
47#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct UITextDropEditability(pub NSUInteger);
50impl UITextDropEditability {
51    #[doc(alias = "UITextDropEditabilityNo")]
52    pub const No: Self = Self(0);
53    #[doc(alias = "UITextDropEditabilityTemporary")]
54    pub const Temporary: Self = Self(1);
55    #[doc(alias = "UITextDropEditabilityYes")]
56    pub const Yes: Self = Self(2);
57}
58
59unsafe impl Encode for UITextDropEditability {
60    const ENCODING: Encoding = NSUInteger::ENCODING;
61}
62
63unsafe impl RefEncode for UITextDropEditability {
64    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
65}
66
67extern_protocol!(
68    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdropdelegate?language=objc)
69    pub unsafe trait UITextDropDelegate: NSObjectProtocol + MainThreadOnly {
70        #[cfg(all(
71            feature = "UIPasteConfigurationSupporting",
72            feature = "UIResponder",
73            feature = "UITextInput",
74            feature = "UITextInputTraits",
75            feature = "UITextPasteConfigurationSupporting",
76            feature = "UIView"
77        ))]
78        /// # Safety
79        ///
80        /// `text_droppable_view` must implement UITextDroppable.
81        #[optional]
82        #[unsafe(method(textDroppableView:willBecomeEditableForDrop:))]
83        #[unsafe(method_family = none)]
84        unsafe fn textDroppableView_willBecomeEditableForDrop(
85            &self,
86            text_droppable_view: &UIView,
87            drop: &ProtocolObject<dyn UITextDropRequest>,
88        ) -> UITextDropEditability;
89
90        #[cfg(all(
91            feature = "UIDropInteraction",
92            feature = "UIPasteConfigurationSupporting",
93            feature = "UIResponder",
94            feature = "UITextDropProposal",
95            feature = "UITextInput",
96            feature = "UITextInputTraits",
97            feature = "UITextPasteConfigurationSupporting",
98            feature = "UIView"
99        ))]
100        /// # Safety
101        ///
102        /// `text_droppable_view` must implement UITextDroppable.
103        #[optional]
104        #[unsafe(method(textDroppableView:proposalForDrop:))]
105        #[unsafe(method_family = none)]
106        unsafe fn textDroppableView_proposalForDrop(
107            &self,
108            text_droppable_view: &UIView,
109            drop: &ProtocolObject<dyn UITextDropRequest>,
110        ) -> Retained<UITextDropProposal>;
111
112        #[cfg(all(
113            feature = "UIPasteConfigurationSupporting",
114            feature = "UIResponder",
115            feature = "UITextInput",
116            feature = "UITextInputTraits",
117            feature = "UITextPasteConfigurationSupporting",
118            feature = "UIView"
119        ))]
120        /// # Safety
121        ///
122        /// `text_droppable_view` must implement UITextDroppable.
123        #[optional]
124        #[unsafe(method(textDroppableView:willPerformDrop:))]
125        #[unsafe(method_family = none)]
126        unsafe fn textDroppableView_willPerformDrop(
127            &self,
128            text_droppable_view: &UIView,
129            drop: &ProtocolObject<dyn UITextDropRequest>,
130        );
131
132        #[cfg(all(
133            feature = "UIPasteConfigurationSupporting",
134            feature = "UIResponder",
135            feature = "UITargetedDragPreview",
136            feature = "UITargetedPreview",
137            feature = "UITextInput",
138            feature = "UITextInputTraits",
139            feature = "UITextPasteConfigurationSupporting",
140            feature = "UIView"
141        ))]
142        /// # Safety
143        ///
144        /// `text_droppable_view` must implement UITextDroppable.
145        #[optional]
146        #[unsafe(method(textDroppableView:previewForDroppingAllItemsWithDefault:))]
147        #[unsafe(method_family = none)]
148        unsafe fn textDroppableView_previewForDroppingAllItemsWithDefault(
149            &self,
150            text_droppable_view: &UIView,
151            default_preview: &UITargetedDragPreview,
152        ) -> Option<Retained<UITargetedDragPreview>>;
153
154        #[cfg(all(
155            feature = "UIDragSession",
156            feature = "UIPasteConfigurationSupporting",
157            feature = "UIResponder",
158            feature = "UITextInput",
159            feature = "UITextInputTraits",
160            feature = "UITextPasteConfigurationSupporting",
161            feature = "UIView"
162        ))]
163        /// # Safety
164        ///
165        /// `text_droppable_view` must implement UITextDroppable.
166        #[optional]
167        #[unsafe(method(textDroppableView:dropSessionDidEnter:))]
168        #[unsafe(method_family = none)]
169        unsafe fn textDroppableView_dropSessionDidEnter(
170            &self,
171            text_droppable_view: &UIView,
172            session: &ProtocolObject<dyn UIDropSession>,
173        );
174
175        #[cfg(all(
176            feature = "UIDragSession",
177            feature = "UIPasteConfigurationSupporting",
178            feature = "UIResponder",
179            feature = "UITextInput",
180            feature = "UITextInputTraits",
181            feature = "UITextPasteConfigurationSupporting",
182            feature = "UIView"
183        ))]
184        /// # Safety
185        ///
186        /// `text_droppable_view` must implement UITextDroppable.
187        #[optional]
188        #[unsafe(method(textDroppableView:dropSessionDidUpdate:))]
189        #[unsafe(method_family = none)]
190        unsafe fn textDroppableView_dropSessionDidUpdate(
191            &self,
192            text_droppable_view: &UIView,
193            session: &ProtocolObject<dyn UIDropSession>,
194        );
195
196        #[cfg(all(
197            feature = "UIDragSession",
198            feature = "UIPasteConfigurationSupporting",
199            feature = "UIResponder",
200            feature = "UITextInput",
201            feature = "UITextInputTraits",
202            feature = "UITextPasteConfigurationSupporting",
203            feature = "UIView"
204        ))]
205        /// # Safety
206        ///
207        /// `text_droppable_view` must implement UITextDroppable.
208        #[optional]
209        #[unsafe(method(textDroppableView:dropSessionDidExit:))]
210        #[unsafe(method_family = none)]
211        unsafe fn textDroppableView_dropSessionDidExit(
212            &self,
213            text_droppable_view: &UIView,
214            session: &ProtocolObject<dyn UIDropSession>,
215        );
216
217        #[cfg(all(
218            feature = "UIDragSession",
219            feature = "UIPasteConfigurationSupporting",
220            feature = "UIResponder",
221            feature = "UITextInput",
222            feature = "UITextInputTraits",
223            feature = "UITextPasteConfigurationSupporting",
224            feature = "UIView"
225        ))]
226        /// # Safety
227        ///
228        /// `text_droppable_view` must implement UITextDroppable.
229        #[optional]
230        #[unsafe(method(textDroppableView:dropSessionDidEnd:))]
231        #[unsafe(method_family = none)]
232        unsafe fn textDroppableView_dropSessionDidEnd(
233            &self,
234            text_droppable_view: &UIView,
235            session: &ProtocolObject<dyn UIDropSession>,
236        );
237    }
238);
239
240extern_protocol!(
241    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdroprequest?language=objc)
242    pub unsafe trait UITextDropRequest: NSObjectProtocol + MainThreadOnly {
243        #[cfg(feature = "UITextInput")]
244        #[unsafe(method(dropPosition))]
245        #[unsafe(method_family = none)]
246        fn dropPosition(&self) -> Retained<UITextPosition>;
247
248        #[cfg(all(feature = "UIDropInteraction", feature = "UITextDropProposal"))]
249        #[unsafe(method(suggestedProposal))]
250        #[unsafe(method_family = none)]
251        fn suggestedProposal(&self) -> Retained<UITextDropProposal>;
252
253        #[unsafe(method(isSameView))]
254        #[unsafe(method_family = none)]
255        fn isSameView(&self) -> bool;
256
257        #[cfg(feature = "UIDragSession")]
258        #[unsafe(method(dropSession))]
259        #[unsafe(method_family = none)]
260        fn dropSession(&self) -> Retained<ProtocolObject<dyn UIDropSession>>;
261    }
262);