objc2_ui_kit/generated/
UITextDragging.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UITextDragOptions(pub NSInteger);
15bitflags::bitflags! {
16 impl UITextDragOptions: NSInteger {
17 #[doc(alias = "UITextDragOptionsNone")]
18 const OptionsNone = 0;
19 #[doc(alias = "UITextDragOptionStripTextColorFromPreviews")]
20 const OptionStripTextColorFromPreviews = 1<<0;
21 }
22}
23
24unsafe impl Encode for UITextDragOptions {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UITextDragOptions {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_protocol!(
33 #[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
35 pub unsafe trait UITextDraggable: UITextInput + MainThreadOnly {
36 #[unsafe(method(textDragDelegate))]
37 #[unsafe(method_family = none)]
38 fn textDragDelegate(&self) -> Option<Retained<ProtocolObject<dyn UITextDragDelegate>>>;
39
40 #[unsafe(method(setTextDragDelegate:))]
44 #[unsafe(method_family = none)]
45 fn setTextDragDelegate(
46 &self,
47 text_drag_delegate: Option<&ProtocolObject<dyn UITextDragDelegate>>,
48 );
49
50 #[cfg(feature = "UIDragInteraction")]
51 #[unsafe(method(textDragInteraction))]
52 #[unsafe(method_family = none)]
53 fn textDragInteraction(&self) -> Option<Retained<UIDragInteraction>>;
54
55 #[unsafe(method(isTextDragActive))]
56 #[unsafe(method_family = none)]
57 fn isTextDragActive(&self) -> bool;
58
59 #[unsafe(method(textDragOptions))]
60 #[unsafe(method_family = none)]
61 fn textDragOptions(&self) -> UITextDragOptions;
62
63 #[unsafe(method(setTextDragOptions:))]
65 #[unsafe(method_family = none)]
66 fn setTextDragOptions(&self, text_drag_options: UITextDragOptions);
67 }
68);
69
70extern_protocol!(
71 pub unsafe trait UITextDragDelegate: NSObjectProtocol + MainThreadOnly {
73 #[cfg(all(
74 feature = "UIDragItem",
75 feature = "UIResponder",
76 feature = "UITextInput",
77 feature = "UITextInputTraits",
78 feature = "UIView"
79 ))]
80 #[optional]
84 #[unsafe(method(textDraggableView:itemsForDrag:))]
85 #[unsafe(method_family = none)]
86 unsafe fn textDraggableView_itemsForDrag(
87 &self,
88 text_draggable_view: &UIView,
89 drag_request: &ProtocolObject<dyn UITextDragRequest>,
90 ) -> Retained<NSArray<UIDragItem>>;
91
92 #[cfg(all(
93 feature = "UIDragItem",
94 feature = "UIDragSession",
95 feature = "UIResponder",
96 feature = "UITargetedDragPreview",
97 feature = "UITargetedPreview",
98 feature = "UITextInput",
99 feature = "UITextInputTraits",
100 feature = "UIView"
101 ))]
102 #[optional]
106 #[unsafe(method(textDraggableView:dragPreviewForLiftingItem:session:))]
107 #[unsafe(method_family = none)]
108 unsafe fn textDraggableView_dragPreviewForLiftingItem_session(
109 &self,
110 text_draggable_view: &UIView,
111 item: &UIDragItem,
112 session: &ProtocolObject<dyn UIDragSession>,
113 ) -> Option<Retained<UITargetedDragPreview>>;
114
115 #[cfg(all(
116 feature = "UIDragInteraction",
117 feature = "UIDragSession",
118 feature = "UIResponder",
119 feature = "UITextInput",
120 feature = "UITextInputTraits",
121 feature = "UIView"
122 ))]
123 #[optional]
127 #[unsafe(method(textDraggableView:willAnimateLiftWithAnimator:session:))]
128 #[unsafe(method_family = none)]
129 unsafe fn textDraggableView_willAnimateLiftWithAnimator_session(
130 &self,
131 text_draggable_view: &UIView,
132 animator: &ProtocolObject<dyn UIDragAnimating>,
133 session: &ProtocolObject<dyn UIDragSession>,
134 );
135
136 #[cfg(all(
137 feature = "UIDragSession",
138 feature = "UIResponder",
139 feature = "UITextInput",
140 feature = "UITextInputTraits",
141 feature = "UIView"
142 ))]
143 #[optional]
147 #[unsafe(method(textDraggableView:dragSessionWillBegin:))]
148 #[unsafe(method_family = none)]
149 unsafe fn textDraggableView_dragSessionWillBegin(
150 &self,
151 text_draggable_view: &UIView,
152 session: &ProtocolObject<dyn UIDragSession>,
153 );
154
155 #[cfg(all(
156 feature = "UIDragSession",
157 feature = "UIDropInteraction",
158 feature = "UIResponder",
159 feature = "UITextInput",
160 feature = "UITextInputTraits",
161 feature = "UIView"
162 ))]
163 #[optional]
167 #[unsafe(method(textDraggableView:dragSessionDidEnd:withOperation:))]
168 #[unsafe(method_family = none)]
169 unsafe fn textDraggableView_dragSessionDidEnd_withOperation(
170 &self,
171 text_draggable_view: &UIView,
172 session: &ProtocolObject<dyn UIDragSession>,
173 operation: UIDropOperation,
174 );
175 }
176);
177
178extern_protocol!(
179 pub unsafe trait UITextDragRequest: NSObjectProtocol + MainThreadOnly {
181 #[cfg(feature = "UITextInput")]
182 #[unsafe(method(dragRange))]
183 #[unsafe(method_family = none)]
184 fn dragRange(&self) -> Retained<UITextRange>;
185
186 #[cfg(feature = "UIDragItem")]
187 #[unsafe(method(suggestedItems))]
188 #[unsafe(method_family = none)]
189 fn suggestedItems(&self) -> Retained<NSArray<UIDragItem>>;
190
191 #[cfg(feature = "UIDragItem")]
192 #[unsafe(method(existingItems))]
193 #[unsafe(method_family = none)]
194 fn existingItems(&self) -> Retained<NSArray<UIDragItem>>;
195
196 #[unsafe(method(isSelected))]
197 #[unsafe(method_family = none)]
198 fn isSelected(&self) -> bool;
199
200 #[cfg(feature = "UIDragSession")]
201 #[unsafe(method(dragSession))]
202 #[unsafe(method_family = none)]
203 fn dragSession(&self) -> Retained<ProtocolObject<dyn UIDragSession>>;
204 }
205);