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