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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use objc2_ui_kit::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/betextinteraction?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct BETextInteraction;
);
extern_conformance!(
unsafe impl NSObjectProtocol for BETextInteraction {}
);
extern_conformance!(
unsafe impl UIInteraction for BETextInteraction {}
);
impl BETextInteraction {
extern_methods!(
#[cfg(feature = "BETextInteractionDelegate")]
/// Assign a delegate to this object to receive callback information
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn BETextInteractionDelegate>>>;
#[cfg(feature = "BETextInteractionDelegate")]
/// Setter for [`delegate`][Self::delegate].
///
/// This is a [weak property][objc2::topics::weak_property].
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn BETextInteractionDelegate>>,
);
#[cfg(feature = "objc2-core-foundation")]
/// Presents a sheet to add a text replacement shortcut to the keyboard dictionary
///
/// Generally used for IME languages, such as Chinese/Japanese
#[unsafe(method(addShortcutForText:fromRect:))]
#[unsafe(method_family = none)]
pub unsafe fn addShortcutForText_fromRect(
&self,
text: &NSString,
presentation_rect: CGRect,
);
#[cfg(feature = "objc2-core-foundation")]
/// Presents a share sheet for the `text` positioned relative to the `presentationRect`
#[unsafe(method(shareText:fromRect:))]
#[unsafe(method_family = none)]
pub unsafe fn shareText_fromRect(&self, text: &NSString, presentation_rect: CGRect);
#[cfg(feature = "objc2-core-foundation")]
/// Presents a dictionary definition view for the `textWithContext` positioned relative to the `presentationRect`
#[unsafe(method(showDictionaryForTextInContext:definingTextInRange:fromRect:))]
#[unsafe(method_family = none)]
pub unsafe fn showDictionaryForTextInContext_definingTextInRange_fromRect(
&self,
text_with_context: &NSString,
range: NSRange,
presentation_rect: CGRect,
);
#[cfg(feature = "objc2-core-foundation")]
/// Presents a translation view for the `text` positioned relative to the `presentationRect`
#[unsafe(method(translateText:fromRect:))]
#[unsafe(method_family = none)]
pub unsafe fn translateText_fromRect(&self, text: &NSString, presentation_rect: CGRect);
/// Displays the inline text replacement UI for the current selection.
/// For example, inline text replacements are displayed in response to the "Replace..." option in the edit menu.
///
/// Could be invoked when handling `promptForReplace:` action
#[unsafe(method(showReplacementsForText:))]
#[unsafe(method_family = none)]
pub unsafe fn showReplacementsForText(&self, text: &NSString);
/// Converts the text selection between traditional and simplified Chinese
///
/// Could be invoked when handling `transliterateChinese` action
#[unsafe(method(transliterateChineseForText:))]
#[unsafe(method_family = none)]
pub unsafe fn transliterateChineseForText(&self, text: &NSString);
/// Presents an edit menu for the current text selection
#[unsafe(method(presentEditMenuForSelection))]
#[unsafe(method_family = none)]
pub unsafe fn presentEditMenuForSelection(&self);
/// Dismisses an edit menu for the current text selection
#[unsafe(method(dismissEditMenuForSelection))]
#[unsafe(method_family = none)]
pub unsafe fn dismissEditMenuForSelection(&self);
/// Tells the system that the document's editability status has changed.
///
/// In response, the system refreshes the text interaction gestures, depending on the value of `isEditable`
#[unsafe(method(editabilityChanged))]
#[unsafe(method_family = none)]
pub unsafe fn editabilityChanged(&self);
/// Tells the system to refresh the keyboard UI.
///
/// This lightweight method refreshes the selection UI. For example, this could be invoked in response to
/// programmatic text selection changes, independent of text interaction gestures
#[unsafe(method(refreshKeyboardUI))]
#[unsafe(method_family = none)]
pub unsafe fn refreshKeyboardUI(&self);
#[cfg(all(feature = "BETextSelectionTypes", feature = "objc2-core-foundation"))]
/// Tells the system that the selection change has been handled for the given `point` and gesture.
///
/// Should be invoked in response to:
/// -[BETextInput updateCurrentSelectionTo:fromGesture:inState:]
#[unsafe(method(selectionChangedWithGestureAtPoint:gesture:state:flags:))]
#[unsafe(method_family = none)]
pub unsafe fn selectionChangedWithGestureAtPoint_gesture_state_flags(
&self,
point: CGPoint,
gesture_type: BEGestureType,
gesture_state: UIGestureRecognizerState,
flags: BESelectionFlags,
);
#[cfg(all(feature = "BETextSelectionTypes", feature = "objc2-core-foundation"))]
/// Tells the system the selection adjustment has been handled for the given `point` and touch
///
/// Should be invoked in response to:
/// -[BETextInput adjustSelectionBoundaryToPoint:touchPhase:baseIsStart:flags:]
#[unsafe(method(selectionBoundaryAdjustedToPoint:touchPhase:flags:))]
#[unsafe(method_family = none)]
pub unsafe fn selectionBoundaryAdjustedToPoint_touchPhase_flags(
&self,
point: CGPoint,
touch: BESelectionTouchPhase,
flags: BESelectionFlags,
);
/// Returns a UITextSelectionDisplayInteraction that manages selection UI
#[unsafe(method(textSelectionDisplayInteraction))]
#[unsafe(method_family = none)]
pub unsafe fn textSelectionDisplayInteraction(
&self,
) -> Retained<UITextSelectionDisplayInteraction>;
/// Set a delegate to receive callbacks for the context menu interaction
#[unsafe(method(contextMenuInteractionDelegate))]
#[unsafe(method_family = none)]
pub unsafe fn contextMenuInteractionDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UIContextMenuInteractionDelegate>>>;
/// Setter for [`contextMenuInteractionDelegate`][Self::contextMenuInteractionDelegate].
///
/// This is a [weak property][objc2::topics::weak_property].
#[unsafe(method(setContextMenuInteractionDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setContextMenuInteractionDelegate(
&self,
context_menu_interaction_delegate: Option<
&ProtocolObject<dyn UIContextMenuInteractionDelegate>,
>,
);
/// Returns a UIContextMenuInteraction object whose delegate methods will be invoked
/// on `contextMenuInteractionDelegate`
#[unsafe(method(contextMenuInteraction))]
#[unsafe(method_family = none)]
pub unsafe fn contextMenuInteraction(&self) -> Retained<UIContextMenuInteraction>;
);
}
/// Methods declared on superclass `NSObject`.
impl BETextInteraction {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}