objc2_app_kit/generated/
NSTextCheckingClient.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSTextInputTraitType(pub NSInteger);
15impl NSTextInputTraitType {
16 #[doc(alias = "NSTextInputTraitTypeDefault")]
17 pub const Default: Self = Self(0);
18 #[doc(alias = "NSTextInputTraitTypeNo")]
19 pub const No: Self = Self(1);
20 #[doc(alias = "NSTextInputTraitTypeYes")]
21 pub const Yes: Self = Self(2);
22}
23
24unsafe impl Encode for NSTextInputTraitType {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSTextInputTraitType {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSWritingToolsBehavior(pub NSInteger);
37impl NSWritingToolsBehavior {
38 #[doc(alias = "NSWritingToolsBehaviorNone")]
39 pub const None: Self = Self(-1);
40 #[doc(alias = "NSWritingToolsBehaviorDefault")]
41 pub const Default: Self = Self(0);
42 #[doc(alias = "NSWritingToolsBehaviorComplete")]
43 pub const Complete: Self = Self(1);
44 #[doc(alias = "NSWritingToolsBehaviorLimited")]
45 pub const Limited: Self = Self(2);
46}
47
48unsafe impl Encode for NSWritingToolsBehavior {
49 const ENCODING: Encoding = NSInteger::ENCODING;
50}
51
52unsafe impl RefEncode for NSWritingToolsBehavior {
53 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56#[repr(transparent)]
59#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
60pub struct NSWritingToolsResultOptions(pub NSUInteger);
61bitflags::bitflags! {
62 impl NSWritingToolsResultOptions: NSUInteger {
63 #[doc(alias = "NSWritingToolsResultDefault")]
64 const Default = 0;
65 #[doc(alias = "NSWritingToolsResultPlainText")]
66 const PlainText = 1<<0;
67 #[doc(alias = "NSWritingToolsResultRichText")]
68 const RichText = 1<<1;
69 #[doc(alias = "NSWritingToolsResultList")]
70 const List = 1<<2;
71 #[doc(alias = "NSWritingToolsResultTable")]
72 const Table = 1<<3;
73 }
74}
75
76unsafe impl Encode for NSWritingToolsResultOptions {
77 const ENCODING: Encoding = NSUInteger::ENCODING;
78}
79
80unsafe impl RefEncode for NSWritingToolsResultOptions {
81 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84extern_protocol!(
85 pub unsafe trait NSTextInputTraits {
87 #[optional]
88 #[unsafe(method(autocorrectionType))]
89 #[unsafe(method_family = none)]
90 unsafe fn autocorrectionType(&self) -> NSTextInputTraitType;
91
92 #[optional]
94 #[unsafe(method(setAutocorrectionType:))]
95 #[unsafe(method_family = none)]
96 unsafe fn setAutocorrectionType(&self, autocorrection_type: NSTextInputTraitType);
97
98 #[optional]
99 #[unsafe(method(spellCheckingType))]
100 #[unsafe(method_family = none)]
101 unsafe fn spellCheckingType(&self) -> NSTextInputTraitType;
102
103 #[optional]
105 #[unsafe(method(setSpellCheckingType:))]
106 #[unsafe(method_family = none)]
107 unsafe fn setSpellCheckingType(&self, spell_checking_type: NSTextInputTraitType);
108
109 #[optional]
110 #[unsafe(method(grammarCheckingType))]
111 #[unsafe(method_family = none)]
112 unsafe fn grammarCheckingType(&self) -> NSTextInputTraitType;
113
114 #[optional]
116 #[unsafe(method(setGrammarCheckingType:))]
117 #[unsafe(method_family = none)]
118 unsafe fn setGrammarCheckingType(&self, grammar_checking_type: NSTextInputTraitType);
119
120 #[optional]
121 #[unsafe(method(smartQuotesType))]
122 #[unsafe(method_family = none)]
123 unsafe fn smartQuotesType(&self) -> NSTextInputTraitType;
124
125 #[optional]
127 #[unsafe(method(setSmartQuotesType:))]
128 #[unsafe(method_family = none)]
129 unsafe fn setSmartQuotesType(&self, smart_quotes_type: NSTextInputTraitType);
130
131 #[optional]
132 #[unsafe(method(smartDashesType))]
133 #[unsafe(method_family = none)]
134 unsafe fn smartDashesType(&self) -> NSTextInputTraitType;
135
136 #[optional]
138 #[unsafe(method(setSmartDashesType:))]
139 #[unsafe(method_family = none)]
140 unsafe fn setSmartDashesType(&self, smart_dashes_type: NSTextInputTraitType);
141
142 #[optional]
143 #[unsafe(method(smartInsertDeleteType))]
144 #[unsafe(method_family = none)]
145 unsafe fn smartInsertDeleteType(&self) -> NSTextInputTraitType;
146
147 #[optional]
149 #[unsafe(method(setSmartInsertDeleteType:))]
150 #[unsafe(method_family = none)]
151 unsafe fn setSmartInsertDeleteType(&self, smart_insert_delete_type: NSTextInputTraitType);
152
153 #[optional]
154 #[unsafe(method(textReplacementType))]
155 #[unsafe(method_family = none)]
156 unsafe fn textReplacementType(&self) -> NSTextInputTraitType;
157
158 #[optional]
160 #[unsafe(method(setTextReplacementType:))]
161 #[unsafe(method_family = none)]
162 unsafe fn setTextReplacementType(&self, text_replacement_type: NSTextInputTraitType);
163
164 #[optional]
165 #[unsafe(method(dataDetectionType))]
166 #[unsafe(method_family = none)]
167 unsafe fn dataDetectionType(&self) -> NSTextInputTraitType;
168
169 #[optional]
171 #[unsafe(method(setDataDetectionType:))]
172 #[unsafe(method_family = none)]
173 unsafe fn setDataDetectionType(&self, data_detection_type: NSTextInputTraitType);
174
175 #[optional]
176 #[unsafe(method(linkDetectionType))]
177 #[unsafe(method_family = none)]
178 unsafe fn linkDetectionType(&self) -> NSTextInputTraitType;
179
180 #[optional]
182 #[unsafe(method(setLinkDetectionType:))]
183 #[unsafe(method_family = none)]
184 unsafe fn setLinkDetectionType(&self, link_detection_type: NSTextInputTraitType);
185
186 #[optional]
187 #[unsafe(method(textCompletionType))]
188 #[unsafe(method_family = none)]
189 unsafe fn textCompletionType(&self) -> NSTextInputTraitType;
190
191 #[optional]
193 #[unsafe(method(setTextCompletionType:))]
194 #[unsafe(method_family = none)]
195 unsafe fn setTextCompletionType(&self, text_completion_type: NSTextInputTraitType);
196
197 #[optional]
198 #[unsafe(method(inlinePredictionType))]
199 #[unsafe(method_family = none)]
200 unsafe fn inlinePredictionType(&self) -> NSTextInputTraitType;
201
202 #[optional]
204 #[unsafe(method(setInlinePredictionType:))]
205 #[unsafe(method_family = none)]
206 unsafe fn setInlinePredictionType(&self, inline_prediction_type: NSTextInputTraitType);
207
208 #[optional]
209 #[unsafe(method(mathExpressionCompletionType))]
210 #[unsafe(method_family = none)]
211 unsafe fn mathExpressionCompletionType(&self) -> NSTextInputTraitType;
212
213 #[optional]
215 #[unsafe(method(setMathExpressionCompletionType:))]
216 #[unsafe(method_family = none)]
217 unsafe fn setMathExpressionCompletionType(
218 &self,
219 math_expression_completion_type: NSTextInputTraitType,
220 );
221
222 #[optional]
223 #[unsafe(method(writingToolsBehavior))]
224 #[unsafe(method_family = none)]
225 unsafe fn writingToolsBehavior(&self) -> NSWritingToolsBehavior;
226
227 #[optional]
229 #[unsafe(method(setWritingToolsBehavior:))]
230 #[unsafe(method_family = none)]
231 unsafe fn setWritingToolsBehavior(&self, writing_tools_behavior: NSWritingToolsBehavior);
232
233 #[optional]
234 #[unsafe(method(allowedWritingToolsResultOptions))]
235 #[unsafe(method_family = none)]
236 unsafe fn allowedWritingToolsResultOptions(&self) -> NSWritingToolsResultOptions;
237
238 #[optional]
240 #[unsafe(method(setAllowedWritingToolsResultOptions:))]
241 #[unsafe(method_family = none)]
242 unsafe fn setAllowedWritingToolsResultOptions(
243 &self,
244 allowed_writing_tools_result_options: NSWritingToolsResultOptions,
245 );
246 }
247);
248
249extern_protocol!(
250 #[cfg(feature = "NSTextInputClient")]
252 pub unsafe trait NSTextCheckingClient: NSTextInputClient + NSTextInputTraits {
253 #[unsafe(method(annotatedSubstringForProposedRange:actualRange:))]
254 #[unsafe(method_family = none)]
255 unsafe fn annotatedSubstringForProposedRange_actualRange(
256 &self,
257 range: NSRange,
258 actual_range: NSRangePointer,
259 ) -> Option<Retained<NSAttributedString>>;
260
261 #[unsafe(method(setAnnotations:range:))]
262 #[unsafe(method_family = none)]
263 unsafe fn setAnnotations_range(
264 &self,
265 annotations: &NSDictionary<NSAttributedStringKey, NSString>,
266 range: NSRange,
267 );
268
269 #[unsafe(method(addAnnotations:range:))]
270 #[unsafe(method_family = none)]
271 unsafe fn addAnnotations_range(
272 &self,
273 annotations: &NSDictionary<NSAttributedStringKey, NSString>,
274 range: NSRange,
275 );
276
277 #[unsafe(method(removeAnnotation:range:))]
278 #[unsafe(method_family = none)]
279 unsafe fn removeAnnotation_range(
280 &self,
281 annotation_name: &NSAttributedStringKey,
282 range: NSRange,
283 );
284
285 #[unsafe(method(replaceCharactersInRange:withAnnotatedString:))]
286 #[unsafe(method_family = none)]
287 unsafe fn replaceCharactersInRange_withAnnotatedString(
288 &self,
289 range: NSRange,
290 annotated_string: &NSAttributedString,
291 );
292
293 #[unsafe(method(selectAndShowRange:))]
294 #[unsafe(method_family = none)]
295 unsafe fn selectAndShowRange(&self, range: NSRange);
296
297 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
298 #[unsafe(method(viewForRange:firstRect:actualRange:))]
299 #[unsafe(method_family = none)]
300 unsafe fn viewForRange_firstRect_actualRange(
301 &self,
302 range: NSRange,
303 first_rect: NSRectPointer,
304 actual_range: NSRangePointer,
305 mtm: MainThreadMarker,
306 ) -> Option<Retained<NSView>>;
307
308 #[cfg(all(feature = "NSCandidateListTouchBarItem", feature = "NSTouchBarItem"))]
309 #[unsafe(method(candidateListTouchBarItem))]
310 #[unsafe(method_family = none)]
311 unsafe fn candidateListTouchBarItem(
312 &self,
313 mtm: MainThreadMarker,
314 ) -> Option<Retained<NSCandidateListTouchBarItem>>;
315 }
316);