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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextInputTraitType(pub NSInteger);
impl NSTextInputTraitType {
    #[doc(alias = "NSTextInputTraitTypeDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "NSTextInputTraitTypeNo")]
    pub const No: Self = Self(1);
    #[doc(alias = "NSTextInputTraitTypeYes")]
    pub const Yes: Self = Self(2);
}

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

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

extern_protocol!(
    pub unsafe trait NSTextInputTraits {
        #[optional]
        #[method(autocorrectionType)]
        unsafe fn autocorrectionType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setAutocorrectionType:)]
        unsafe fn setAutocorrectionType(&self, autocorrection_type: NSTextInputTraitType);

        #[optional]
        #[method(spellCheckingType)]
        unsafe fn spellCheckingType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setSpellCheckingType:)]
        unsafe fn setSpellCheckingType(&self, spell_checking_type: NSTextInputTraitType);

        #[optional]
        #[method(grammarCheckingType)]
        unsafe fn grammarCheckingType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setGrammarCheckingType:)]
        unsafe fn setGrammarCheckingType(&self, grammar_checking_type: NSTextInputTraitType);

        #[optional]
        #[method(smartQuotesType)]
        unsafe fn smartQuotesType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setSmartQuotesType:)]
        unsafe fn setSmartQuotesType(&self, smart_quotes_type: NSTextInputTraitType);

        #[optional]
        #[method(smartDashesType)]
        unsafe fn smartDashesType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setSmartDashesType:)]
        unsafe fn setSmartDashesType(&self, smart_dashes_type: NSTextInputTraitType);

        #[optional]
        #[method(smartInsertDeleteType)]
        unsafe fn smartInsertDeleteType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setSmartInsertDeleteType:)]
        unsafe fn setSmartInsertDeleteType(&self, smart_insert_delete_type: NSTextInputTraitType);

        #[optional]
        #[method(textReplacementType)]
        unsafe fn textReplacementType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setTextReplacementType:)]
        unsafe fn setTextReplacementType(&self, text_replacement_type: NSTextInputTraitType);

        #[optional]
        #[method(dataDetectionType)]
        unsafe fn dataDetectionType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setDataDetectionType:)]
        unsafe fn setDataDetectionType(&self, data_detection_type: NSTextInputTraitType);

        #[optional]
        #[method(linkDetectionType)]
        unsafe fn linkDetectionType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setLinkDetectionType:)]
        unsafe fn setLinkDetectionType(&self, link_detection_type: NSTextInputTraitType);

        #[optional]
        #[method(textCompletionType)]
        unsafe fn textCompletionType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setTextCompletionType:)]
        unsafe fn setTextCompletionType(&self, text_completion_type: NSTextInputTraitType);

        #[optional]
        #[method(inlinePredictionType)]
        unsafe fn inlinePredictionType(&self) -> NSTextInputTraitType;

        #[optional]
        #[method(setInlinePredictionType:)]
        unsafe fn setInlinePredictionType(&self, inline_prediction_type: NSTextInputTraitType);
    }

    unsafe impl ProtocolType for dyn NSTextInputTraits {}
);

extern_protocol!(
    #[cfg(feature = "NSTextInputClient")]
    pub unsafe trait NSTextCheckingClient: NSTextInputClient + NSTextInputTraits {
        #[method_id(@__retain_semantics Other annotatedSubstringForProposedRange:actualRange:)]
        unsafe fn annotatedSubstringForProposedRange_actualRange(
            &self,
            range: NSRange,
            actual_range: NSRangePointer,
        ) -> Option<Retained<NSAttributedString>>;

        #[method(setAnnotations:range:)]
        unsafe fn setAnnotations_range(
            &self,
            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
            range: NSRange,
        );

        #[method(addAnnotations:range:)]
        unsafe fn addAnnotations_range(
            &self,
            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
            range: NSRange,
        );

        #[method(removeAnnotation:range:)]
        unsafe fn removeAnnotation_range(
            &self,
            annotation_name: &NSAttributedStringKey,
            range: NSRange,
        );

        #[method(replaceCharactersInRange:withAnnotatedString:)]
        unsafe fn replaceCharactersInRange_withAnnotatedString(
            &self,
            range: NSRange,
            annotated_string: &NSAttributedString,
        );

        #[method(selectAndShowRange:)]
        unsafe fn selectAndShowRange(&self, range: NSRange);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[method_id(@__retain_semantics Other viewForRange:firstRect:actualRange:)]
        unsafe fn viewForRange_firstRect_actualRange(
            &self,
            range: NSRange,
            first_rect: NSRectPointer,
            actual_range: NSRangePointer,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSView>>;

        #[cfg(all(feature = "NSCandidateListTouchBarItem", feature = "NSTouchBarItem"))]
        #[method_id(@__retain_semantics Other candidateListTouchBarItem)]
        unsafe fn candidateListTouchBarItem(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSCandidateListTouchBarItem>>;
    }

    #[cfg(feature = "NSTextInputClient")]
    unsafe impl ProtocolType for dyn NSTextCheckingClient {}
);