objc2_browser_engine_kit/generated/
BETextInteraction.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#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9use objc2_ui_kit::*;
10
11use crate::*;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/betextinteraction?language=objc)
15    #[unsafe(super(NSObject))]
16    #[thread_kind = MainThreadOnly]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct BETextInteraction;
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for BETextInteraction {}
23);
24
25extern_conformance!(
26    unsafe impl UIInteraction for BETextInteraction {}
27);
28
29impl BETextInteraction {
30    extern_methods!(
31        #[cfg(feature = "BETextInteractionDelegate")]
32        /// Assign a delegate to this object to receive callback information
33        #[unsafe(method(delegate))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn delegate(
36            &self,
37        ) -> Option<Retained<ProtocolObject<dyn BETextInteractionDelegate>>>;
38
39        #[cfg(feature = "BETextInteractionDelegate")]
40        /// Setter for [`delegate`][Self::delegate].
41        ///
42        /// This is a [weak property][objc2::topics::weak_property].
43        #[unsafe(method(setDelegate:))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn setDelegate(
46            &self,
47            delegate: Option<&ProtocolObject<dyn BETextInteractionDelegate>>,
48        );
49
50        #[cfg(feature = "objc2-core-foundation")]
51        /// Presents a sheet to add a text replacement shortcut to the keyboard dictionary
52        ///
53        /// Generally used for IME languages, such as Chinese/Japanese
54        #[unsafe(method(addShortcutForText:fromRect:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn addShortcutForText_fromRect(
57            &self,
58            text: &NSString,
59            presentation_rect: CGRect,
60        );
61
62        #[cfg(feature = "objc2-core-foundation")]
63        /// Presents a share sheet for the `text` positioned relative to the `presentationRect`
64        #[unsafe(method(shareText:fromRect:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn shareText_fromRect(&self, text: &NSString, presentation_rect: CGRect);
67
68        #[cfg(feature = "objc2-core-foundation")]
69        /// Presents a dictionary definition view for the `textWithContext` positioned relative to the `presentationRect`
70        #[unsafe(method(showDictionaryForTextInContext:definingTextInRange:fromRect:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn showDictionaryForTextInContext_definingTextInRange_fromRect(
73            &self,
74            text_with_context: &NSString,
75            range: NSRange,
76            presentation_rect: CGRect,
77        );
78
79        #[cfg(feature = "objc2-core-foundation")]
80        /// Presents a translation view for the `text` positioned relative to the `presentationRect`
81        #[unsafe(method(translateText:fromRect:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn translateText_fromRect(&self, text: &NSString, presentation_rect: CGRect);
84
85        /// Displays the inline text replacement UI for the current selection.
86        /// For example, inline text replacements are displayed in response to the "Replace..." option in the edit menu.
87        ///
88        /// Could be invoked when handling `promptForReplace:` action
89        #[unsafe(method(showReplacementsForText:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn showReplacementsForText(&self, text: &NSString);
92
93        /// Converts the text selection between traditional and simplified Chinese
94        ///
95        /// Could be invoked when handling `transliterateChinese` action
96        #[unsafe(method(transliterateChineseForText:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn transliterateChineseForText(&self, text: &NSString);
99
100        /// Presents an edit menu for the current text selection
101        #[unsafe(method(presentEditMenuForSelection))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn presentEditMenuForSelection(&self);
104
105        /// Dismisses an edit menu for the current text selection
106        #[unsafe(method(dismissEditMenuForSelection))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn dismissEditMenuForSelection(&self);
109
110        /// Tells the system that the document's editability status has changed.
111        ///
112        /// In response, the system refreshes the text interaction gestures, depending on the value of `isEditable`
113        #[unsafe(method(editabilityChanged))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn editabilityChanged(&self);
116
117        /// Tells the system to refresh the keyboard UI.
118        ///
119        /// This lightweight method refreshes the selection UI.  For example, this could be invoked in response to
120        /// programmatic text selection changes, independent of text interaction gestures
121        #[unsafe(method(refreshKeyboardUI))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn refreshKeyboardUI(&self);
124
125        #[cfg(all(feature = "BETextSelectionTypes", feature = "objc2-core-foundation"))]
126        /// Tells the system that the selection change has been handled for the given `point` and gesture.
127        ///
128        /// Should be invoked in response to:
129        /// -[BETextInput updateCurrentSelectionTo:fromGesture:inState:]
130        #[unsafe(method(selectionChangedWithGestureAtPoint:gesture:state:flags:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn selectionChangedWithGestureAtPoint_gesture_state_flags(
133            &self,
134            point: CGPoint,
135            gesture_type: BEGestureType,
136            gesture_state: UIGestureRecognizerState,
137            flags: BESelectionFlags,
138        );
139
140        #[cfg(all(feature = "BETextSelectionTypes", feature = "objc2-core-foundation"))]
141        /// Tells the system the selection adjustment has been handled for the given `point` and touch
142        ///
143        /// Should be invoked in response to:
144        /// -[BETextInput adjustSelectionBoundaryToPoint:touchPhase:baseIsStart:flags:]
145        #[unsafe(method(selectionBoundaryAdjustedToPoint:touchPhase:flags:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn selectionBoundaryAdjustedToPoint_touchPhase_flags(
148            &self,
149            point: CGPoint,
150            touch: BESelectionTouchPhase,
151            flags: BESelectionFlags,
152        );
153
154        /// Returns a UITextSelectionDisplayInteraction that manages selection UI
155        #[unsafe(method(textSelectionDisplayInteraction))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn textSelectionDisplayInteraction(
158            &self,
159        ) -> Retained<UITextSelectionDisplayInteraction>;
160
161        /// Set a delegate to receive callbacks for the context menu interaction
162        #[unsafe(method(contextMenuInteractionDelegate))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn contextMenuInteractionDelegate(
165            &self,
166        ) -> Option<Retained<ProtocolObject<dyn UIContextMenuInteractionDelegate>>>;
167
168        /// Setter for [`contextMenuInteractionDelegate`][Self::contextMenuInteractionDelegate].
169        ///
170        /// This is a [weak property][objc2::topics::weak_property].
171        #[unsafe(method(setContextMenuInteractionDelegate:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setContextMenuInteractionDelegate(
174            &self,
175            context_menu_interaction_delegate: Option<
176                &ProtocolObject<dyn UIContextMenuInteractionDelegate>,
177            >,
178        );
179
180        /// Returns a UIContextMenuInteraction object whose delegate methods will be invoked
181        /// on `contextMenuInteractionDelegate`
182        #[unsafe(method(contextMenuInteraction))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn contextMenuInteraction(&self) -> Retained<UIContextMenuInteraction>;
185    );
186}
187
188/// Methods declared on superclass `NSObject`.
189impl BETextInteraction {
190    extern_methods!(
191        #[unsafe(method(init))]
192        #[unsafe(method_family = init)]
193        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
194
195        #[unsafe(method(new))]
196        #[unsafe(method_family = new)]
197        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
198    );
199}