1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextDragOptions(pub NSInteger);
bitflags::bitflags! {
    impl UITextDragOptions: NSInteger {
        #[doc(alias = "UITextDragOptionsNone")]
        const None = 0;
        const UITextDragOptionStripTextColorFromPreviews = 1<<0;
    }
}

unsafe impl Encode for UITextDragOptions {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UITextDragOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    #[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
    pub unsafe trait UITextDraggable: UITextInput + IsMainThreadOnly {
        #[method_id(@__retain_semantics Other textDragDelegate)]
        unsafe fn textDragDelegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UITextDragDelegate>>>;

        #[method(setTextDragDelegate:)]
        unsafe fn setTextDragDelegate(
            &self,
            text_drag_delegate: Option<&ProtocolObject<dyn UITextDragDelegate>>,
        );

        #[cfg(feature = "UIDragInteraction")]
        #[method_id(@__retain_semantics Other textDragInteraction)]
        unsafe fn textDragInteraction(&self) -> Option<Retained<UIDragInteraction>>;

        #[method(isTextDragActive)]
        unsafe fn isTextDragActive(&self) -> bool;

        #[method(textDragOptions)]
        unsafe fn textDragOptions(&self) -> UITextDragOptions;

        #[method(setTextDragOptions:)]
        unsafe fn setTextDragOptions(&self, text_drag_options: UITextDragOptions);
    }

    #[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
    unsafe impl ProtocolType for dyn UITextDraggable {}
);

extern_protocol!(
    pub unsafe trait UITextDragDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(all(
            feature = "UIDragItem",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UIView"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other textDraggableView:itemsForDrag:)]
        unsafe fn textDraggableView_itemsForDrag(
            &self,
            text_draggable_view: &UIView,
            drag_request: &ProtocolObject<dyn UITextDragRequest>,
        ) -> Retained<NSArray<UIDragItem>>;

        #[cfg(all(
            feature = "UIDragItem",
            feature = "UIDragSession",
            feature = "UIResponder",
            feature = "UITargetedDragPreview",
            feature = "UITargetedPreview",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UIView"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other textDraggableView:dragPreviewForLiftingItem:session:)]
        unsafe fn textDraggableView_dragPreviewForLiftingItem_session(
            &self,
            text_draggable_view: &UIView,
            item: &UIDragItem,
            session: &ProtocolObject<dyn UIDragSession>,
        ) -> Option<Retained<UITargetedDragPreview>>;

        #[cfg(all(
            feature = "UIDragInteraction",
            feature = "UIDragSession",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UIView"
        ))]
        #[optional]
        #[method(textDraggableView:willAnimateLiftWithAnimator:session:)]
        unsafe fn textDraggableView_willAnimateLiftWithAnimator_session(
            &self,
            text_draggable_view: &UIView,
            animator: &ProtocolObject<dyn UIDragAnimating>,
            session: &ProtocolObject<dyn UIDragSession>,
        );

        #[cfg(all(
            feature = "UIDragSession",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UIView"
        ))]
        #[optional]
        #[method(textDraggableView:dragSessionWillBegin:)]
        unsafe fn textDraggableView_dragSessionWillBegin(
            &self,
            text_draggable_view: &UIView,
            session: &ProtocolObject<dyn UIDragSession>,
        );

        #[cfg(all(
            feature = "UIDragSession",
            feature = "UIDropInteraction",
            feature = "UIResponder",
            feature = "UITextInput",
            feature = "UITextInputTraits",
            feature = "UIView"
        ))]
        #[optional]
        #[method(textDraggableView:dragSessionDidEnd:withOperation:)]
        unsafe fn textDraggableView_dragSessionDidEnd_withOperation(
            &self,
            text_draggable_view: &UIView,
            session: &ProtocolObject<dyn UIDragSession>,
            operation: UIDropOperation,
        );
    }

    unsafe impl ProtocolType for dyn UITextDragDelegate {}
);

extern_protocol!(
    pub unsafe trait UITextDragRequest: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(feature = "UITextInput")]
        #[method_id(@__retain_semantics Other dragRange)]
        unsafe fn dragRange(&self) -> Retained<UITextRange>;

        #[cfg(feature = "UIDragItem")]
        #[method_id(@__retain_semantics Other suggestedItems)]
        unsafe fn suggestedItems(&self) -> Retained<NSArray<UIDragItem>>;

        #[cfg(feature = "UIDragItem")]
        #[method_id(@__retain_semantics Other existingItems)]
        unsafe fn existingItems(&self) -> Retained<NSArray<UIDragItem>>;

        #[method(isSelected)]
        unsafe fn isSelected(&self) -> bool;

        #[cfg(feature = "UIDragSession")]
        #[method_id(@__retain_semantics Other dragSession)]
        unsafe fn dragSession(&self) -> Retained<ProtocolObject<dyn UIDragSession>>;
    }

    unsafe impl ProtocolType for dyn UITextDragRequest {}
);