icrate 0.0.1

Bindings to Apple's frameworks
Documentation
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

typed_enum!(
    pub type NSTextCheckingOptionKey = NSString;
);

extern_static!(NSTextCheckingOrthographyKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingQuotesKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingReplacementsKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingReferenceDateKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingReferenceTimeZoneKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingDocumentURLKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingDocumentTitleKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingDocumentAuthorKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingRegularExpressionsKey: &'static NSTextCheckingOptionKey);

extern_static!(NSTextCheckingSelectedRangeKey: &'static NSTextCheckingOptionKey);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSCorrectionResponse {
        NSCorrectionResponseNone = 0,
        NSCorrectionResponseAccepted = 1,
        NSCorrectionResponseRejected = 2,
        NSCorrectionResponseIgnored = 3,
        NSCorrectionResponseEdited = 4,
        NSCorrectionResponseReverted = 5,
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum NSCorrectionIndicatorType {
        NSCorrectionIndicatorTypeDefault = 0,
        NSCorrectionIndicatorTypeReversion = 1,
        NSCorrectionIndicatorTypeGuesses = 2,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSSpellChecker;

    unsafe impl ClassType for NSSpellChecker {
        type Super = NSObject;
    }
);

extern_methods!(
    unsafe impl NSSpellChecker {
        #[method_id(@__retain_semantics Other sharedSpellChecker)]
        pub unsafe fn sharedSpellChecker() -> Id<NSSpellChecker, Shared>;

        #[method(sharedSpellCheckerExists)]
        pub unsafe fn sharedSpellCheckerExists() -> bool;

        #[method(uniqueSpellDocumentTag)]
        pub unsafe fn uniqueSpellDocumentTag() -> NSInteger;

        #[method(checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:)]
        pub unsafe fn checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount(
            &self,
            stringToCheck: &NSString,
            startingOffset: NSInteger,
            language: Option<&NSString>,
            wrapFlag: bool,
            tag: NSInteger,
            wordCount: *mut NSInteger,
        ) -> NSRange;

        #[method(checkSpellingOfString:startingAt:)]
        pub unsafe fn checkSpellingOfString_startingAt(
            &self,
            stringToCheck: &NSString,
            startingOffset: NSInteger,
        ) -> NSRange;

        #[method(countWordsInString:language:)]
        pub unsafe fn countWordsInString_language(
            &self,
            stringToCount: &NSString,
            language: Option<&NSString>,
        ) -> NSInteger;

        #[method(checkGrammarOfString:startingAt:language:wrap:inSpellDocumentWithTag:details:)]
        pub unsafe fn checkGrammarOfString_startingAt_language_wrap_inSpellDocumentWithTag_details(
            &self,
            stringToCheck: &NSString,
            startingOffset: NSInteger,
            language: Option<&NSString>,
            wrapFlag: bool,
            tag: NSInteger,
            details: *mut *mut NSArray<NSDictionary<NSString, Object>>,
        ) -> NSRange;

        #[method_id(@__retain_semantics Other checkString:range:types:options:inSpellDocumentWithTag:orthography:wordCount:)]
        pub unsafe fn checkString_range_types_options_inSpellDocumentWithTag_orthography_wordCount(
            &self,
            stringToCheck: &NSString,
            range: NSRange,
            checkingTypes: NSTextCheckingTypes,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, Object>>,
            tag: NSInteger,
            orthography: *mut *mut NSOrthography,
            wordCount: *mut NSInteger,
        ) -> Id<NSArray<NSTextCheckingResult>, Shared>;

        #[method(requestCheckingOfString:range:types:options:inSpellDocumentWithTag:completionHandler:)]
        pub unsafe fn requestCheckingOfString_range_types_options_inSpellDocumentWithTag_completionHandler(
            &self,
            stringToCheck: &NSString,
            range: NSRange,
            checkingTypes: NSTextCheckingTypes,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, Object>>,
            tag: NSInteger,
            completionHandler: Option<
                &Block<
                    (
                        NSInteger,
                        NonNull<NSArray<NSTextCheckingResult>>,
                        NonNull<NSOrthography>,
                        NSInteger,
                    ),
                    (),
                >,
            >,
        ) -> NSInteger;

        #[method(requestCandidatesForSelectedRange:inString:types:options:inSpellDocumentWithTag:completionHandler:)]
        pub unsafe fn requestCandidatesForSelectedRange_inString_types_options_inSpellDocumentWithTag_completionHandler(
            &self,
            selectedRange: NSRange,
            stringToCheck: &NSString,
            checkingTypes: NSTextCheckingTypes,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, Object>>,
            tag: NSInteger,
            completionHandler: Option<
                &Block<(NSInteger, NonNull<NSArray<NSTextCheckingResult>>), ()>,
            >,
        ) -> NSInteger;

        #[method_id(@__retain_semantics Other menuForResult:string:options:atLocation:inView:)]
        pub unsafe fn menuForResult_string_options_atLocation_inView(
            &self,
            result: &NSTextCheckingResult,
            checkedString: &NSString,
            options: Option<&NSDictionary<NSTextCheckingOptionKey, Object>>,
            location: NSPoint,
            view: &NSView,
        ) -> Option<Id<NSMenu, Shared>>;

        #[method_id(@__retain_semantics Other userQuotesArrayForLanguage:)]
        pub unsafe fn userQuotesArrayForLanguage(
            &self,
            language: &NSString,
        ) -> Id<NSArray<NSString>, Shared>;

        #[method_id(@__retain_semantics Other userReplacementsDictionary)]
        pub unsafe fn userReplacementsDictionary(
            &self,
        ) -> Id<NSDictionary<NSString, NSString>, Shared>;

        #[method(updateSpellingPanelWithMisspelledWord:)]
        pub unsafe fn updateSpellingPanelWithMisspelledWord(&self, word: &NSString);

        #[method(updateSpellingPanelWithGrammarString:detail:)]
        pub unsafe fn updateSpellingPanelWithGrammarString_detail(
            &self,
            string: &NSString,
            detail: &NSDictionary<NSString, Object>,
        );

        #[method_id(@__retain_semantics Other spellingPanel)]
        pub unsafe fn spellingPanel(&self) -> Id<NSPanel, Shared>;

        #[method_id(@__retain_semantics Other accessoryView)]
        pub unsafe fn accessoryView(&self) -> Option<Id<NSView, Shared>>;

        #[method(setAccessoryView:)]
        pub unsafe fn setAccessoryView(&self, accessoryView: Option<&NSView>);

        #[method_id(@__retain_semantics Other substitutionsPanel)]
        pub unsafe fn substitutionsPanel(&self) -> Id<NSPanel, Shared>;

        #[method_id(@__retain_semantics Other substitutionsPanelAccessoryViewController)]
        pub unsafe fn substitutionsPanelAccessoryViewController(
            &self,
        ) -> Option<Id<NSViewController, Shared>>;

        #[method(setSubstitutionsPanelAccessoryViewController:)]
        pub unsafe fn setSubstitutionsPanelAccessoryViewController(
            &self,
            substitutionsPanelAccessoryViewController: Option<&NSViewController>,
        );

        #[method(updatePanels)]
        pub unsafe fn updatePanels(&self);

        #[method(ignoreWord:inSpellDocumentWithTag:)]
        pub unsafe fn ignoreWord_inSpellDocumentWithTag(
            &self,
            wordToIgnore: &NSString,
            tag: NSInteger,
        );

        #[method_id(@__retain_semantics Other ignoredWordsInSpellDocumentWithTag:)]
        pub unsafe fn ignoredWordsInSpellDocumentWithTag(
            &self,
            tag: NSInteger,
        ) -> Option<Id<NSArray<NSString>, Shared>>;

        #[method(setIgnoredWords:inSpellDocumentWithTag:)]
        pub unsafe fn setIgnoredWords_inSpellDocumentWithTag(
            &self,
            words: &NSArray<NSString>,
            tag: NSInteger,
        );

        #[method_id(@__retain_semantics Other guessesForWordRange:inString:language:inSpellDocumentWithTag:)]
        pub unsafe fn guessesForWordRange_inString_language_inSpellDocumentWithTag(
            &self,
            range: NSRange,
            string: &NSString,
            language: Option<&NSString>,
            tag: NSInteger,
        ) -> Option<Id<NSArray<NSString>, Shared>>;

        #[method_id(@__retain_semantics Other correctionForWordRange:inString:language:inSpellDocumentWithTag:)]
        pub unsafe fn correctionForWordRange_inString_language_inSpellDocumentWithTag(
            &self,
            range: NSRange,
            string: &NSString,
            language: &NSString,
            tag: NSInteger,
        ) -> Option<Id<NSString, Shared>>;

        #[method_id(@__retain_semantics Other completionsForPartialWordRange:inString:language:inSpellDocumentWithTag:)]
        pub unsafe fn completionsForPartialWordRange_inString_language_inSpellDocumentWithTag(
            &self,
            range: NSRange,
            string: &NSString,
            language: Option<&NSString>,
            tag: NSInteger,
        ) -> Option<Id<NSArray<NSString>, Shared>>;

        #[method_id(@__retain_semantics Other languageForWordRange:inString:orthography:)]
        pub unsafe fn languageForWordRange_inString_orthography(
            &self,
            range: NSRange,
            string: &NSString,
            orthography: Option<&NSOrthography>,
        ) -> Option<Id<NSString, Shared>>;

        #[method(closeSpellDocumentWithTag:)]
        pub unsafe fn closeSpellDocumentWithTag(&self, tag: NSInteger);

        #[method(recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:)]
        pub unsafe fn recordResponse_toCorrection_forWord_language_inSpellDocumentWithTag(
            &self,
            response: NSCorrectionResponse,
            correction: &NSString,
            word: &NSString,
            language: Option<&NSString>,
            tag: NSInteger,
        );

        #[method(showCorrectionIndicatorOfType:primaryString:alternativeStrings:forStringInRect:view:completionHandler:)]
        pub unsafe fn showCorrectionIndicatorOfType_primaryString_alternativeStrings_forStringInRect_view_completionHandler(
            &self,
            type_: NSCorrectionIndicatorType,
            primaryString: &NSString,
            alternativeStrings: &NSArray<NSString>,
            rectOfTypedString: NSRect,
            view: &NSView,
            completionBlock: Option<&Block<(*mut NSString,), ()>>,
        );

        #[method(dismissCorrectionIndicatorForView:)]
        pub unsafe fn dismissCorrectionIndicatorForView(&self, view: &NSView);

        #[method(preventsAutocorrectionBeforeString:language:)]
        pub unsafe fn preventsAutocorrectionBeforeString_language(
            &self,
            string: &NSString,
            language: Option<&NSString>,
        ) -> bool;

        #[method(deletesAutospaceBetweenString:andString:language:)]
        pub unsafe fn deletesAutospaceBetweenString_andString_language(
            &self,
            precedingString: &NSString,
            followingString: &NSString,
            language: Option<&NSString>,
        ) -> bool;

        #[method_id(@__retain_semantics Other availableLanguages)]
        pub unsafe fn availableLanguages(&self) -> Id<NSArray<NSString>, Shared>;

        #[method_id(@__retain_semantics Other userPreferredLanguages)]
        pub unsafe fn userPreferredLanguages(&self) -> Id<NSArray<NSString>, Shared>;

        #[method(automaticallyIdentifiesLanguages)]
        pub unsafe fn automaticallyIdentifiesLanguages(&self) -> bool;

        #[method(setAutomaticallyIdentifiesLanguages:)]
        pub unsafe fn setAutomaticallyIdentifiesLanguages(
            &self,
            automaticallyIdentifiesLanguages: bool,
        );

        #[method(setWordFieldStringValue:)]
        pub unsafe fn setWordFieldStringValue(&self, string: &NSString);

        #[method(learnWord:)]
        pub unsafe fn learnWord(&self, word: &NSString);

        #[method(hasLearnedWord:)]
        pub unsafe fn hasLearnedWord(&self, word: &NSString) -> bool;

        #[method(unlearnWord:)]
        pub unsafe fn unlearnWord(&self, word: &NSString);

        #[method(isAutomaticTextReplacementEnabled)]
        pub unsafe fn isAutomaticTextReplacementEnabled() -> bool;

        #[method(isAutomaticSpellingCorrectionEnabled)]
        pub unsafe fn isAutomaticSpellingCorrectionEnabled() -> bool;

        #[method(isAutomaticQuoteSubstitutionEnabled)]
        pub unsafe fn isAutomaticQuoteSubstitutionEnabled() -> bool;

        #[method(isAutomaticDashSubstitutionEnabled)]
        pub unsafe fn isAutomaticDashSubstitutionEnabled() -> bool;

        #[method(isAutomaticCapitalizationEnabled)]
        pub unsafe fn isAutomaticCapitalizationEnabled() -> bool;

        #[method(isAutomaticPeriodSubstitutionEnabled)]
        pub unsafe fn isAutomaticPeriodSubstitutionEnabled() -> bool;

        #[method(isAutomaticTextCompletionEnabled)]
        pub unsafe fn isAutomaticTextCompletionEnabled() -> bool;

        #[method_id(@__retain_semantics Other language)]
        pub unsafe fn language(&self) -> Id<NSString, Shared>;

        #[method(setLanguage:)]
        pub unsafe fn setLanguage(&self, language: &NSString) -> bool;
    }
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticSpellingCorrectionNotification: &'static NSNotificationName
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticTextReplacementNotification: &'static NSNotificationName
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticQuoteSubstitutionNotification: &'static NSNotificationName
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticDashSubstitutionNotification: &'static NSNotificationName
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticCapitalizationNotification: &'static NSNotificationName
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticPeriodSubstitutionNotification: &'static NSNotificationName
);

extern_static!(
    NSSpellCheckerDidChangeAutomaticTextCompletionNotification: &'static NSNotificationName
);

extern_methods!(
    /// NSDeprecated
    unsafe impl NSSpellChecker {
        #[method_id(@__retain_semantics Other guessesForWord:)]
        pub unsafe fn guessesForWord(&self, word: Option<&NSString>)
            -> Option<Id<NSArray, Shared>>;

        #[method(forgetWord:)]
        pub unsafe fn forgetWord(&self, word: Option<&NSString>);
    }
);