objc2_app_kit/generated/
NSTextCheckingClient.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputtraittype?language=objc)
11// NS_ENUM
12#[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/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswritingtoolsbehavior?language=objc)
33// NS_ENUM
34#[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/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswritingtoolsresultoptions?language=objc)
57// NS_OPTIONS
58#[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        #[doc(alias = "NSWritingToolsResultPresentationIntent")]
74        const PresentationIntent = 1<<4;
75    }
76}
77
78unsafe impl Encode for NSWritingToolsResultOptions {
79    const ENCODING: Encoding = NSUInteger::ENCODING;
80}
81
82unsafe impl RefEncode for NSWritingToolsResultOptions {
83    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
84}
85
86extern_protocol!(
87    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputtraits?language=objc)
88    pub unsafe trait NSTextInputTraits {
89        #[optional]
90        #[unsafe(method(autocorrectionType))]
91        #[unsafe(method_family = none)]
92        fn autocorrectionType(&self) -> NSTextInputTraitType;
93
94        /// Setter for [`autocorrectionType`][Self::autocorrectionType].
95        #[optional]
96        #[unsafe(method(setAutocorrectionType:))]
97        #[unsafe(method_family = none)]
98        fn setAutocorrectionType(&self, autocorrection_type: NSTextInputTraitType);
99
100        #[optional]
101        #[unsafe(method(spellCheckingType))]
102        #[unsafe(method_family = none)]
103        fn spellCheckingType(&self) -> NSTextInputTraitType;
104
105        /// Setter for [`spellCheckingType`][Self::spellCheckingType].
106        #[optional]
107        #[unsafe(method(setSpellCheckingType:))]
108        #[unsafe(method_family = none)]
109        fn setSpellCheckingType(&self, spell_checking_type: NSTextInputTraitType);
110
111        #[optional]
112        #[unsafe(method(grammarCheckingType))]
113        #[unsafe(method_family = none)]
114        fn grammarCheckingType(&self) -> NSTextInputTraitType;
115
116        /// Setter for [`grammarCheckingType`][Self::grammarCheckingType].
117        #[optional]
118        #[unsafe(method(setGrammarCheckingType:))]
119        #[unsafe(method_family = none)]
120        fn setGrammarCheckingType(&self, grammar_checking_type: NSTextInputTraitType);
121
122        #[optional]
123        #[unsafe(method(smartQuotesType))]
124        #[unsafe(method_family = none)]
125        fn smartQuotesType(&self) -> NSTextInputTraitType;
126
127        /// Setter for [`smartQuotesType`][Self::smartQuotesType].
128        #[optional]
129        #[unsafe(method(setSmartQuotesType:))]
130        #[unsafe(method_family = none)]
131        fn setSmartQuotesType(&self, smart_quotes_type: NSTextInputTraitType);
132
133        #[optional]
134        #[unsafe(method(smartDashesType))]
135        #[unsafe(method_family = none)]
136        fn smartDashesType(&self) -> NSTextInputTraitType;
137
138        /// Setter for [`smartDashesType`][Self::smartDashesType].
139        #[optional]
140        #[unsafe(method(setSmartDashesType:))]
141        #[unsafe(method_family = none)]
142        fn setSmartDashesType(&self, smart_dashes_type: NSTextInputTraitType);
143
144        #[optional]
145        #[unsafe(method(smartInsertDeleteType))]
146        #[unsafe(method_family = none)]
147        fn smartInsertDeleteType(&self) -> NSTextInputTraitType;
148
149        /// Setter for [`smartInsertDeleteType`][Self::smartInsertDeleteType].
150        #[optional]
151        #[unsafe(method(setSmartInsertDeleteType:))]
152        #[unsafe(method_family = none)]
153        fn setSmartInsertDeleteType(&self, smart_insert_delete_type: NSTextInputTraitType);
154
155        #[optional]
156        #[unsafe(method(textReplacementType))]
157        #[unsafe(method_family = none)]
158        fn textReplacementType(&self) -> NSTextInputTraitType;
159
160        /// Setter for [`textReplacementType`][Self::textReplacementType].
161        #[optional]
162        #[unsafe(method(setTextReplacementType:))]
163        #[unsafe(method_family = none)]
164        fn setTextReplacementType(&self, text_replacement_type: NSTextInputTraitType);
165
166        #[optional]
167        #[unsafe(method(dataDetectionType))]
168        #[unsafe(method_family = none)]
169        fn dataDetectionType(&self) -> NSTextInputTraitType;
170
171        /// Setter for [`dataDetectionType`][Self::dataDetectionType].
172        #[optional]
173        #[unsafe(method(setDataDetectionType:))]
174        #[unsafe(method_family = none)]
175        fn setDataDetectionType(&self, data_detection_type: NSTextInputTraitType);
176
177        #[optional]
178        #[unsafe(method(linkDetectionType))]
179        #[unsafe(method_family = none)]
180        fn linkDetectionType(&self) -> NSTextInputTraitType;
181
182        /// Setter for [`linkDetectionType`][Self::linkDetectionType].
183        #[optional]
184        #[unsafe(method(setLinkDetectionType:))]
185        #[unsafe(method_family = none)]
186        fn setLinkDetectionType(&self, link_detection_type: NSTextInputTraitType);
187
188        #[optional]
189        #[unsafe(method(textCompletionType))]
190        #[unsafe(method_family = none)]
191        fn textCompletionType(&self) -> NSTextInputTraitType;
192
193        /// Setter for [`textCompletionType`][Self::textCompletionType].
194        #[optional]
195        #[unsafe(method(setTextCompletionType:))]
196        #[unsafe(method_family = none)]
197        fn setTextCompletionType(&self, text_completion_type: NSTextInputTraitType);
198
199        #[optional]
200        #[unsafe(method(inlinePredictionType))]
201        #[unsafe(method_family = none)]
202        fn inlinePredictionType(&self) -> NSTextInputTraitType;
203
204        /// Setter for [`inlinePredictionType`][Self::inlinePredictionType].
205        #[optional]
206        #[unsafe(method(setInlinePredictionType:))]
207        #[unsafe(method_family = none)]
208        fn setInlinePredictionType(&self, inline_prediction_type: NSTextInputTraitType);
209
210        #[optional]
211        #[unsafe(method(mathExpressionCompletionType))]
212        #[unsafe(method_family = none)]
213        fn mathExpressionCompletionType(&self) -> NSTextInputTraitType;
214
215        /// Setter for [`mathExpressionCompletionType`][Self::mathExpressionCompletionType].
216        #[optional]
217        #[unsafe(method(setMathExpressionCompletionType:))]
218        #[unsafe(method_family = none)]
219        fn setMathExpressionCompletionType(
220            &self,
221            math_expression_completion_type: NSTextInputTraitType,
222        );
223
224        #[optional]
225        #[unsafe(method(writingToolsBehavior))]
226        #[unsafe(method_family = none)]
227        fn writingToolsBehavior(&self) -> NSWritingToolsBehavior;
228
229        /// Setter for [`writingToolsBehavior`][Self::writingToolsBehavior].
230        #[optional]
231        #[unsafe(method(setWritingToolsBehavior:))]
232        #[unsafe(method_family = none)]
233        fn setWritingToolsBehavior(&self, writing_tools_behavior: NSWritingToolsBehavior);
234
235        #[optional]
236        #[unsafe(method(allowedWritingToolsResultOptions))]
237        #[unsafe(method_family = none)]
238        fn allowedWritingToolsResultOptions(&self) -> NSWritingToolsResultOptions;
239
240        /// Setter for [`allowedWritingToolsResultOptions`][Self::allowedWritingToolsResultOptions].
241        #[optional]
242        #[unsafe(method(setAllowedWritingToolsResultOptions:))]
243        #[unsafe(method_family = none)]
244        fn setAllowedWritingToolsResultOptions(
245            &self,
246            allowed_writing_tools_result_options: NSWritingToolsResultOptions,
247        );
248    }
249);
250
251extern_protocol!(
252    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingclient?language=objc)
253    #[cfg(feature = "NSTextInputClient")]
254    pub unsafe trait NSTextCheckingClient: NSTextInputClient + NSTextInputTraits {
255        /// # Safety
256        ///
257        /// `actual_range` must be a valid pointer or null.
258        #[unsafe(method(annotatedSubstringForProposedRange:actualRange:))]
259        #[unsafe(method_family = none)]
260        unsafe fn annotatedSubstringForProposedRange_actualRange(
261            &self,
262            range: NSRange,
263            actual_range: NSRangePointer,
264        ) -> Option<Retained<NSAttributedString>>;
265
266        #[unsafe(method(setAnnotations:range:))]
267        #[unsafe(method_family = none)]
268        fn setAnnotations_range(
269            &self,
270            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
271            range: NSRange,
272        );
273
274        #[unsafe(method(addAnnotations:range:))]
275        #[unsafe(method_family = none)]
276        fn addAnnotations_range(
277            &self,
278            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
279            range: NSRange,
280        );
281
282        #[unsafe(method(removeAnnotation:range:))]
283        #[unsafe(method_family = none)]
284        fn removeAnnotation_range(&self, annotation_name: &NSAttributedStringKey, range: NSRange);
285
286        #[unsafe(method(replaceCharactersInRange:withAnnotatedString:))]
287        #[unsafe(method_family = none)]
288        fn replaceCharactersInRange_withAnnotatedString(
289            &self,
290            range: NSRange,
291            annotated_string: &NSAttributedString,
292        );
293
294        #[unsafe(method(selectAndShowRange:))]
295        #[unsafe(method_family = none)]
296        fn selectAndShowRange(&self, range: NSRange);
297
298        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
299        /// # Safety
300        ///
301        /// - `first_rect` must be a valid pointer or null.
302        /// - `actual_range` must be a valid pointer or null.
303        #[unsafe(method(viewForRange:firstRect:actualRange:))]
304        #[unsafe(method_family = none)]
305        unsafe fn viewForRange_firstRect_actualRange(
306            &self,
307            range: NSRange,
308            first_rect: NSRectPointer,
309            actual_range: NSRangePointer,
310            mtm: MainThreadMarker,
311        ) -> Option<Retained<NSView>>;
312
313        #[cfg(all(feature = "NSCandidateListTouchBarItem", feature = "NSTouchBarItem"))]
314        #[unsafe(method(candidateListTouchBarItem))]
315        #[unsafe(method_family = none)]
316        fn candidateListTouchBarItem(
317            &self,
318            mtm: MainThreadMarker,
319        ) -> Option<Retained<NSCandidateListTouchBarItem>>;
320    }
321);