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 unsafe fn textDragDelegate(
39 &self,
40 ) -> Option<Retained<ProtocolObject<dyn UITextDragDelegate>>>;
41
42 #[unsafe(method(setTextDragDelegate:))]
45 #[unsafe(method_family = none)]
46 unsafe fn setTextDragDelegate(
47 &self,
48 text_drag_delegate: Option<&ProtocolObject<dyn UITextDragDelegate>>,
49 );
50
51 #[cfg(feature = "UIDragInteraction")]
52 #[unsafe(method(textDragInteraction))]
53 #[unsafe(method_family = none)]
54 unsafe fn textDragInteraction(&self) -> Option<Retained<UIDragInteraction>>;
55
56 #[unsafe(method(isTextDragActive))]
57 #[unsafe(method_family = none)]
58 unsafe fn isTextDragActive(&self) -> bool;
59
60 #[unsafe(method(textDragOptions))]
61 #[unsafe(method_family = none)]
62 unsafe fn textDragOptions(&self) -> UITextDragOptions;
63
64 #[unsafe(method(setTextDragOptions:))]
66 #[unsafe(method_family = none)]
67 unsafe fn setTextDragOptions(&self, text_drag_options: UITextDragOptions);
68 }
69);
70
71extern_protocol!(
72 pub unsafe trait UITextDragDelegate: NSObjectProtocol + MainThreadOnly {
74 #[cfg(all(
75 feature = "UIDragItem",
76 feature = "UIResponder",
77 feature = "UITextInput",
78 feature = "UITextInputTraits",
79 feature = "UIView"
80 ))]
81 #[optional]
82 #[unsafe(method(textDraggableView:itemsForDrag:))]
83 #[unsafe(method_family = none)]
84 unsafe fn textDraggableView_itemsForDrag(
85 &self,
86 text_draggable_view: &UIView,
87 drag_request: &ProtocolObject<dyn UITextDragRequest>,
88 ) -> Retained<NSArray<UIDragItem>>;
89
90 #[cfg(all(
91 feature = "UIDragItem",
92 feature = "UIDragSession",
93 feature = "UIResponder",
94 feature = "UITargetedDragPreview",
95 feature = "UITargetedPreview",
96 feature = "UITextInput",
97 feature = "UITextInputTraits",
98 feature = "UIView"
99 ))]
100 #[optional]
101 #[unsafe(method(textDraggableView:dragPreviewForLiftingItem:session:))]
102 #[unsafe(method_family = none)]
103 unsafe fn textDraggableView_dragPreviewForLiftingItem_session(
104 &self,
105 text_draggable_view: &UIView,
106 item: &UIDragItem,
107 session: &ProtocolObject<dyn UIDragSession>,
108 ) -> Option<Retained<UITargetedDragPreview>>;
109
110 #[cfg(all(
111 feature = "UIDragInteraction",
112 feature = "UIDragSession",
113 feature = "UIResponder",
114 feature = "UITextInput",
115 feature = "UITextInputTraits",
116 feature = "UIView"
117 ))]
118 #[optional]
119 #[unsafe(method(textDraggableView:willAnimateLiftWithAnimator:session:))]
120 #[unsafe(method_family = none)]
121 unsafe fn textDraggableView_willAnimateLiftWithAnimator_session(
122 &self,
123 text_draggable_view: &UIView,
124 animator: &ProtocolObject<dyn UIDragAnimating>,
125 session: &ProtocolObject<dyn UIDragSession>,
126 );
127
128 #[cfg(all(
129 feature = "UIDragSession",
130 feature = "UIResponder",
131 feature = "UITextInput",
132 feature = "UITextInputTraits",
133 feature = "UIView"
134 ))]
135 #[optional]
136 #[unsafe(method(textDraggableView:dragSessionWillBegin:))]
137 #[unsafe(method_family = none)]
138 unsafe fn textDraggableView_dragSessionWillBegin(
139 &self,
140 text_draggable_view: &UIView,
141 session: &ProtocolObject<dyn UIDragSession>,
142 );
143
144 #[cfg(all(
145 feature = "UIDragSession",
146 feature = "UIDropInteraction",
147 feature = "UIResponder",
148 feature = "UITextInput",
149 feature = "UITextInputTraits",
150 feature = "UIView"
151 ))]
152 #[optional]
153 #[unsafe(method(textDraggableView:dragSessionDidEnd:withOperation:))]
154 #[unsafe(method_family = none)]
155 unsafe fn textDraggableView_dragSessionDidEnd_withOperation(
156 &self,
157 text_draggable_view: &UIView,
158 session: &ProtocolObject<dyn UIDragSession>,
159 operation: UIDropOperation,
160 );
161 }
162);
163
164extern_protocol!(
165 pub unsafe trait UITextDragRequest: NSObjectProtocol + MainThreadOnly {
167 #[cfg(feature = "UITextInput")]
168 #[unsafe(method(dragRange))]
169 #[unsafe(method_family = none)]
170 unsafe fn dragRange(&self) -> Retained<UITextRange>;
171
172 #[cfg(feature = "UIDragItem")]
173 #[unsafe(method(suggestedItems))]
174 #[unsafe(method_family = none)]
175 unsafe fn suggestedItems(&self) -> Retained<NSArray<UIDragItem>>;
176
177 #[cfg(feature = "UIDragItem")]
178 #[unsafe(method(existingItems))]
179 #[unsafe(method_family = none)]
180 unsafe fn existingItems(&self) -> Retained<NSArray<UIDragItem>>;
181
182 #[unsafe(method(isSelected))]
183 #[unsafe(method_family = none)]
184 unsafe fn isSelected(&self) -> bool;
185
186 #[cfg(feature = "UIDragSession")]
187 #[unsafe(method(dragSession))]
188 #[unsafe(method_family = none)]
189 unsafe fn dragSession(&self) -> Retained<ProtocolObject<dyn UIDragSession>>;
190 }
191);