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
//! 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::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/betextinputdelegate?language=objc)
pub unsafe trait BETextInputDelegate {
#[cfg(all(feature = "BEKeyEntryContext", feature = "BETextInput"))]
/// Defers the key event to the system and returns whether the key event was handled.
///
/// For example, the system will handle key events for character insertions, deletions, key commands, and more.
#[unsafe(method(shouldDeferEventHandlingToSystemForTextInput:context:))]
#[unsafe(method_family = none)]
unsafe fn shouldDeferEventHandlingToSystemForTextInput_context(
&self,
text_input: &ProtocolObject<dyn BETextInput>,
key_event_context: &BEKeyEntryContext,
) -> bool;
#[cfg(all(feature = "BETextInput", feature = "BETextSuggestion"))]
/// Provides text suggestions to the system.
///
/// For example, suggestions could include data list elements or AutoFill candidates.
#[unsafe(method(textInput:setCandidateSuggestions:))]
#[unsafe(method_family = none)]
unsafe fn textInput_setCandidateSuggestions(
&self,
text_input: &ProtocolObject<dyn BETextInput>,
suggestions: Option<&NSArray<BETextSuggestion>>,
);
#[cfg(feature = "BETextInput")]
/// Tells the system when the selection is about to change in the document.
#[unsafe(method(selectionWillChangeForTextInput:))]
#[unsafe(method_family = none)]
unsafe fn selectionWillChangeForTextInput(
&self,
text_input: &ProtocolObject<dyn BETextInput>,
);
#[cfg(feature = "BETextInput")]
/// Tells the system when the selection has changed in the document.
///
/// This method results in an document state refresh with an invocation to:
/// -[BETextInput requestTextContextForAutocorrectionWithCompletionHandler:]
#[unsafe(method(selectionDidChangeForTextInput:))]
#[unsafe(method_family = none)]
unsafe fn selectionDidChangeForTextInput(
&self,
text_input: &ProtocolObject<dyn BETextInput>,
);
#[cfg(feature = "BETextInput")]
/// Defers a replace text action to the ssytem.
///
/// When handling the replace: action, use this method to defer the replacement to the system.
///
/// For example, a replacement could be deferred after it is selected from the autocorrect replacements list.
///
/// # Safety
///
/// `sender` should be of the correct type.
#[unsafe(method(textInput:deferReplaceTextActionToSystem:))]
#[unsafe(method_family = none)]
unsafe fn textInput_deferReplaceTextActionToSystem(
&self,
text_input: &ProtocolObject<dyn BETextInput>,
sender: &AnyObject,
);
#[cfg(feature = "BETextInput")]
/// Tells the system the text entry context has changed and that text entry UI's need to be refreshed.
///
/// This is a costly operation and should only used with intention. For example, when switching focus
/// between different elements.
#[unsafe(method(invalidateTextEntryContextForTextInput:))]
#[unsafe(method_family = none)]
unsafe fn invalidateTextEntryContextForTextInput(
&self,
text_input: &ProtocolObject<dyn BETextInput>,
);
}
);