objc2_app_kit/generated/
NSTextView.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsselectiongranularity?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSSelectionGranularity(pub NSUInteger);
17impl NSSelectionGranularity {
18    #[doc(alias = "NSSelectByCharacter")]
19    pub const SelectByCharacter: Self = Self(0);
20    #[doc(alias = "NSSelectByWord")]
21    pub const SelectByWord: Self = Self(1);
22    #[doc(alias = "NSSelectByParagraph")]
23    pub const SelectByParagraph: Self = Self(2);
24}
25
26unsafe impl Encode for NSSelectionGranularity {
27    const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSSelectionGranularity {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsselectionaffinity?language=objc)
35// NS_ENUM
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct NSSelectionAffinity(pub NSUInteger);
39impl NSSelectionAffinity {
40    #[doc(alias = "NSSelectionAffinityUpstream")]
41    pub const Upstream: Self = Self(0);
42    #[doc(alias = "NSSelectionAffinityDownstream")]
43    pub const Downstream: Self = Self(1);
44}
45
46unsafe impl Encode for NSSelectionAffinity {
47    const ENCODING: Encoding = NSUInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSSelectionAffinity {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern "C" {
55    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsallromaninputsourceslocaleidentifier?language=objc)
56    pub static NSAllRomanInputSourcesLocaleIdentifier: &'static NSString;
57}
58
59extern_class!(
60    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextview?language=objc)
61    #[unsafe(super(NSText, NSView, NSResponder, NSObject))]
62    #[derive(Debug, PartialEq, Eq, Hash)]
63    #[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
64    pub struct NSTextView;
65);
66
67#[cfg(all(
68    feature = "NSAccessibilityProtocols",
69    feature = "NSResponder",
70    feature = "NSText",
71    feature = "NSView"
72))]
73extern_conformance!(
74    unsafe impl NSAccessibility for NSTextView {}
75);
76
77#[cfg(all(
78    feature = "NSAccessibilityProtocols",
79    feature = "NSResponder",
80    feature = "NSText",
81    feature = "NSView"
82))]
83extern_conformance!(
84    unsafe impl NSAccessibilityElementProtocol for NSTextView {}
85);
86
87#[cfg(all(
88    feature = "NSAccessibilityProtocols",
89    feature = "NSResponder",
90    feature = "NSText",
91    feature = "NSView"
92))]
93extern_conformance!(
94    unsafe impl NSAccessibilityNavigableStaticText for NSTextView {}
95);
96
97#[cfg(all(
98    feature = "NSAccessibilityProtocols",
99    feature = "NSResponder",
100    feature = "NSText",
101    feature = "NSView"
102))]
103extern_conformance!(
104    unsafe impl NSAccessibilityStaticText for NSTextView {}
105);
106
107#[cfg(all(
108    feature = "NSAnimation",
109    feature = "NSResponder",
110    feature = "NSText",
111    feature = "NSView"
112))]
113extern_conformance!(
114    unsafe impl NSAnimatablePropertyContainer for NSTextView {}
115);
116
117#[cfg(all(
118    feature = "NSAppearance",
119    feature = "NSResponder",
120    feature = "NSText",
121    feature = "NSView"
122))]
123extern_conformance!(
124    unsafe impl NSAppearanceCustomization for NSTextView {}
125);
126
127#[cfg(all(
128    feature = "NSResponder",
129    feature = "NSSpellProtocol",
130    feature = "NSText",
131    feature = "NSView"
132))]
133extern_conformance!(
134    unsafe impl NSChangeSpelling for NSTextView {}
135);
136
137#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
138extern_conformance!(
139    unsafe impl NSCoding for NSTextView {}
140);
141
142#[cfg(all(
143    feature = "NSColorPanel",
144    feature = "NSResponder",
145    feature = "NSText",
146    feature = "NSView"
147))]
148extern_conformance!(
149    unsafe impl NSColorChanging for NSTextView {}
150);
151
152#[cfg(all(
153    feature = "NSDragging",
154    feature = "NSResponder",
155    feature = "NSText",
156    feature = "NSView"
157))]
158extern_conformance!(
159    unsafe impl NSDraggingDestination for NSTextView {}
160);
161
162#[cfg(all(
163    feature = "NSDragging",
164    feature = "NSResponder",
165    feature = "NSText",
166    feature = "NSView"
167))]
168extern_conformance!(
169    unsafe impl NSDraggingSource for NSTextView {}
170);
171
172#[cfg(all(
173    feature = "NSResponder",
174    feature = "NSSpellProtocol",
175    feature = "NSText",
176    feature = "NSView"
177))]
178extern_conformance!(
179    unsafe impl NSIgnoreMisspelledWords for NSTextView {}
180);
181
182#[cfg(all(
183    feature = "NSMenu",
184    feature = "NSResponder",
185    feature = "NSText",
186    feature = "NSView"
187))]
188extern_conformance!(
189    unsafe impl NSMenuItemValidation for NSTextView {}
190);
191
192#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
193extern_conformance!(
194    unsafe impl NSObjectProtocol for NSTextView {}
195);
196
197#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
198extern_conformance!(
199    unsafe impl NSStandardKeyBindingResponding for NSTextView {}
200);
201
202#[cfg(all(
203    feature = "NSResponder",
204    feature = "NSText",
205    feature = "NSTextContent",
206    feature = "NSView"
207))]
208extern_conformance!(
209    unsafe impl NSTextContent for NSTextView {}
210);
211
212#[cfg(all(
213    feature = "NSInputManager",
214    feature = "NSResponder",
215    feature = "NSText",
216    feature = "NSView"
217))]
218extern_conformance!(
219    unsafe impl NSTextInput for NSTextView {}
220);
221
222#[cfg(all(
223    feature = "NSResponder",
224    feature = "NSText",
225    feature = "NSTextInputClient",
226    feature = "NSView"
227))]
228extern_conformance!(
229    unsafe impl NSTextInputClient for NSTextView {}
230);
231
232#[cfg(all(
233    feature = "NSLayoutManager",
234    feature = "NSResponder",
235    feature = "NSText",
236    feature = "NSView"
237))]
238extern_conformance!(
239    unsafe impl NSTextLayoutOrientationProvider for NSTextView {}
240);
241
242#[cfg(all(
243    feature = "NSResponder",
244    feature = "NSText",
245    feature = "NSUserInterfaceItemIdentification",
246    feature = "NSView"
247))]
248extern_conformance!(
249    unsafe impl NSUserInterfaceItemIdentification for NSTextView {}
250);
251
252#[cfg(all(
253    feature = "NSResponder",
254    feature = "NSText",
255    feature = "NSUserInterfaceValidation",
256    feature = "NSView"
257))]
258extern_conformance!(
259    unsafe impl NSUserInterfaceValidations for NSTextView {}
260);
261
262#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
263impl NSTextView {
264    extern_methods!(
265        #[cfg(feature = "NSTextContainer")]
266        /// ************************** Initializing ***************************
267        #[unsafe(method(initWithFrame:textContainer:))]
268        #[unsafe(method_family = init)]
269        pub fn initWithFrame_textContainer(
270            this: Allocated<Self>,
271            frame_rect: NSRect,
272            container: Option<&NSTextContainer>,
273        ) -> Retained<Self>;
274
275        /// # Safety
276        ///
277        /// `coder` possibly has further requirements.
278        #[unsafe(method(initWithCoder:))]
279        #[unsafe(method_family = init)]
280        pub unsafe fn initWithCoder(
281            this: Allocated<Self>,
282            coder: &NSCoder,
283        ) -> Option<Retained<Self>>;
284
285        #[unsafe(method(initWithFrame:))]
286        #[unsafe(method_family = init)]
287        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
288
289        #[unsafe(method(initUsingTextLayoutManager:))]
290        #[unsafe(method_family = init)]
291        pub fn initUsingTextLayoutManager(
292            this: Allocated<Self>,
293            using_text_layout_manager: bool,
294        ) -> Retained<Self>;
295
296        #[unsafe(method(textViewUsingTextLayoutManager:))]
297        #[unsafe(method_family = none)]
298        pub fn textViewUsingTextLayoutManager(
299            using_text_layout_manager: bool,
300            mtm: MainThreadMarker,
301        ) -> Retained<Self>;
302
303        #[cfg(feature = "NSTextContainer")]
304        /// *************** Get/Set the container and other stuff ****************
305        ///
306        /// # Safety
307        ///
308        /// This is not retained internally, you must ensure the object is still alive.
309        #[unsafe(method(textContainer))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn textContainer(&self) -> Option<Retained<NSTextContainer>>;
312
313        #[cfg(feature = "NSTextContainer")]
314        /// Setter for [`textContainer`][Self::textContainer].
315        ///
316        /// # Safety
317        ///
318        /// This is unretained, you must ensure the object is kept alive while in use.
319        #[unsafe(method(setTextContainer:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn setTextContainer(&self, text_container: Option<&NSTextContainer>);
322
323        #[cfg(feature = "NSTextContainer")]
324        #[unsafe(method(replaceTextContainer:))]
325        #[unsafe(method_family = none)]
326        pub fn replaceTextContainer(&self, new_container: &NSTextContainer);
327
328        #[unsafe(method(textContainerInset))]
329        #[unsafe(method_family = none)]
330        pub fn textContainerInset(&self) -> NSSize;
331
332        /// Setter for [`textContainerInset`][Self::textContainerInset].
333        #[unsafe(method(setTextContainerInset:))]
334        #[unsafe(method_family = none)]
335        pub fn setTextContainerInset(&self, text_container_inset: NSSize);
336
337        #[unsafe(method(textContainerOrigin))]
338        #[unsafe(method_family = none)]
339        pub fn textContainerOrigin(&self) -> NSPoint;
340
341        #[unsafe(method(invalidateTextContainerOrigin))]
342        #[unsafe(method_family = none)]
343        pub fn invalidateTextContainerOrigin(&self);
344
345        #[cfg(feature = "NSLayoutManager")]
346        /// # Safety
347        ///
348        /// This is not retained internally, you must ensure the object is still alive.
349        #[unsafe(method(layoutManager))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
352
353        #[cfg(feature = "NSTextStorage")]
354        /// # Safety
355        ///
356        /// This is not retained internally, you must ensure the object is still alive.
357        #[unsafe(method(textStorage))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn textStorage(&self) -> Option<Retained<NSTextStorage>>;
360
361        #[cfg(feature = "NSTextLayoutManager")]
362        #[unsafe(method(textLayoutManager))]
363        #[unsafe(method_family = none)]
364        pub fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
365
366        #[cfg(feature = "NSTextContentManager")]
367        #[unsafe(method(textContentStorage))]
368        #[unsafe(method_family = none)]
369        pub fn textContentStorage(&self) -> Option<Retained<NSTextContentStorage>>;
370
371        /// *********************** Key binding entry-point ************************
372        ///
373        /// # Safety
374        ///
375        /// `insert_string` should be of the correct type.
376        #[deprecated = "Use -insertText:replacementRange: from NSTextInputClient instead. Since the method is designed to be used solely by the input system, the message should never be sent to a text view from applications. Any content modifications should be via either NSTextStorage or NSText methods."]
377        #[unsafe(method(insertText:))]
378        #[unsafe(method_family = none)]
379        pub unsafe fn insertText(&self, insert_string: &AnyObject);
380
381        /// ************************* Sizing methods **************************
382        #[unsafe(method(setConstrainedFrameSize:))]
383        #[unsafe(method_family = none)]
384        pub fn setConstrainedFrameSize(&self, desired_size: NSSize);
385
386        #[unsafe(method(setAlignment:range:))]
387        #[unsafe(method_family = none)]
388        pub fn setAlignment_range(&self, alignment: NSTextAlignment, range: NSRange);
389
390        #[unsafe(method(setBaseWritingDirection:range:))]
391        #[unsafe(method_family = none)]
392        pub fn setBaseWritingDirection_range(
393            &self,
394            writing_direction: NSWritingDirection,
395            range: NSRange,
396        );
397
398        /// ************************* New Font menu commands **************************
399        ///
400        /// # Safety
401        ///
402        /// `sender` should be of the correct type.
403        #[unsafe(method(turnOffKerning:))]
404        #[unsafe(method_family = none)]
405        pub unsafe fn turnOffKerning(&self, sender: Option<&AnyObject>);
406
407        /// # Safety
408        ///
409        /// `sender` should be of the correct type.
410        #[unsafe(method(tightenKerning:))]
411        #[unsafe(method_family = none)]
412        pub unsafe fn tightenKerning(&self, sender: Option<&AnyObject>);
413
414        /// # Safety
415        ///
416        /// `sender` should be of the correct type.
417        #[unsafe(method(loosenKerning:))]
418        #[unsafe(method_family = none)]
419        pub unsafe fn loosenKerning(&self, sender: Option<&AnyObject>);
420
421        /// # Safety
422        ///
423        /// `sender` should be of the correct type.
424        #[unsafe(method(useStandardKerning:))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn useStandardKerning(&self, sender: Option<&AnyObject>);
427
428        /// # Safety
429        ///
430        /// `sender` should be of the correct type.
431        #[unsafe(method(turnOffLigatures:))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn turnOffLigatures(&self, sender: Option<&AnyObject>);
434
435        /// # Safety
436        ///
437        /// `sender` should be of the correct type.
438        #[unsafe(method(useStandardLigatures:))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn useStandardLigatures(&self, sender: Option<&AnyObject>);
441
442        /// # Safety
443        ///
444        /// `sender` should be of the correct type.
445        #[unsafe(method(useAllLigatures:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn useAllLigatures(&self, sender: Option<&AnyObject>);
448
449        /// # Safety
450        ///
451        /// `sender` should be of the correct type.
452        #[unsafe(method(raiseBaseline:))]
453        #[unsafe(method_family = none)]
454        pub unsafe fn raiseBaseline(&self, sender: Option<&AnyObject>);
455
456        /// # Safety
457        ///
458        /// `sender` should be of the correct type.
459        #[unsafe(method(lowerBaseline:))]
460        #[unsafe(method_family = none)]
461        pub unsafe fn lowerBaseline(&self, sender: Option<&AnyObject>);
462
463        /// # Safety
464        ///
465        /// `sender` should be of the correct type.
466        #[deprecated = "Use the traditional shaped characters encoded in the Unicode standard. Access the characters via the character palette."]
467        #[unsafe(method(toggleTraditionalCharacterShape:))]
468        #[unsafe(method_family = none)]
469        pub unsafe fn toggleTraditionalCharacterShape(&self, sender: Option<&AnyObject>);
470
471        /// # Safety
472        ///
473        /// `sender` should be of the correct type.
474        #[unsafe(method(outline:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn outline(&self, sender: Option<&AnyObject>);
477
478        /// ************************* Find menu commands **************************
479        ///
480        /// # Safety
481        ///
482        /// `sender` should be of the correct type.
483        #[unsafe(method(performFindPanelAction:))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn performFindPanelAction(&self, sender: Option<&AnyObject>);
486
487        /// ************************* New Text commands **************************
488        ///
489        /// # Safety
490        ///
491        /// `sender` should be of the correct type.
492        #[unsafe(method(alignJustified:))]
493        #[unsafe(method_family = none)]
494        pub unsafe fn alignJustified(&self, sender: Option<&AnyObject>);
495
496        /// # Safety
497        ///
498        /// `sender` should be of the correct type.
499        #[unsafe(method(changeColor:))]
500        #[unsafe(method_family = none)]
501        pub unsafe fn changeColor(&self, sender: Option<&AnyObject>);
502
503        /// # Safety
504        ///
505        /// `sender` should be of the correct type.
506        #[unsafe(method(changeAttributes:))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn changeAttributes(&self, sender: Option<&AnyObject>);
509
510        /// # Safety
511        ///
512        /// `sender` should be of the correct type.
513        #[unsafe(method(changeDocumentBackgroundColor:))]
514        #[unsafe(method_family = none)]
515        pub unsafe fn changeDocumentBackgroundColor(&self, sender: Option<&AnyObject>);
516
517        /// # Safety
518        ///
519        /// `sender` should be of the correct type.
520        #[unsafe(method(orderFrontSpacingPanel:))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn orderFrontSpacingPanel(&self, sender: Option<&AnyObject>);
523
524        /// # Safety
525        ///
526        /// `sender` should be of the correct type.
527        #[unsafe(method(orderFrontLinkPanel:))]
528        #[unsafe(method_family = none)]
529        pub unsafe fn orderFrontLinkPanel(&self, sender: Option<&AnyObject>);
530
531        /// # Safety
532        ///
533        /// `sender` should be of the correct type.
534        #[unsafe(method(orderFrontListPanel:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn orderFrontListPanel(&self, sender: Option<&AnyObject>);
537
538        /// # Safety
539        ///
540        /// `sender` should be of the correct type.
541        #[unsafe(method(orderFrontTablePanel:))]
542        #[unsafe(method_family = none)]
543        pub unsafe fn orderFrontTablePanel(&self, sender: Option<&AnyObject>);
544
545        #[cfg(all(feature = "NSRulerMarker", feature = "NSRulerView"))]
546        /// ************************* Ruler support **************************
547        #[unsafe(method(rulerView:didMoveMarker:))]
548        #[unsafe(method_family = none)]
549        pub fn rulerView_didMoveMarker(&self, ruler: &NSRulerView, marker: &NSRulerMarker);
550
551        #[cfg(all(feature = "NSRulerMarker", feature = "NSRulerView"))]
552        #[unsafe(method(rulerView:didRemoveMarker:))]
553        #[unsafe(method_family = none)]
554        pub fn rulerView_didRemoveMarker(&self, ruler: &NSRulerView, marker: &NSRulerMarker);
555
556        #[cfg(all(feature = "NSRulerMarker", feature = "NSRulerView"))]
557        #[unsafe(method(rulerView:didAddMarker:))]
558        #[unsafe(method_family = none)]
559        pub fn rulerView_didAddMarker(&self, ruler: &NSRulerView, marker: &NSRulerMarker);
560
561        #[cfg(all(feature = "NSRulerMarker", feature = "NSRulerView"))]
562        #[unsafe(method(rulerView:shouldMoveMarker:))]
563        #[unsafe(method_family = none)]
564        pub fn rulerView_shouldMoveMarker(
565            &self,
566            ruler: &NSRulerView,
567            marker: &NSRulerMarker,
568        ) -> bool;
569
570        #[cfg(all(feature = "NSRulerMarker", feature = "NSRulerView"))]
571        #[unsafe(method(rulerView:shouldAddMarker:))]
572        #[unsafe(method_family = none)]
573        pub fn rulerView_shouldAddMarker(
574            &self,
575            ruler: &NSRulerView,
576            marker: &NSRulerMarker,
577        ) -> bool;
578
579        #[cfg(all(
580            feature = "NSRulerMarker",
581            feature = "NSRulerView",
582            feature = "objc2-core-foundation"
583        ))]
584        #[unsafe(method(rulerView:willMoveMarker:toLocation:))]
585        #[unsafe(method_family = none)]
586        pub fn rulerView_willMoveMarker_toLocation(
587            &self,
588            ruler: &NSRulerView,
589            marker: &NSRulerMarker,
590            location: CGFloat,
591        ) -> CGFloat;
592
593        #[cfg(all(feature = "NSRulerMarker", feature = "NSRulerView"))]
594        #[unsafe(method(rulerView:shouldRemoveMarker:))]
595        #[unsafe(method_family = none)]
596        pub fn rulerView_shouldRemoveMarker(
597            &self,
598            ruler: &NSRulerView,
599            marker: &NSRulerMarker,
600        ) -> bool;
601
602        #[cfg(all(
603            feature = "NSRulerMarker",
604            feature = "NSRulerView",
605            feature = "objc2-core-foundation"
606        ))]
607        #[unsafe(method(rulerView:willAddMarker:atLocation:))]
608        #[unsafe(method_family = none)]
609        pub fn rulerView_willAddMarker_atLocation(
610            &self,
611            ruler: &NSRulerView,
612            marker: &NSRulerMarker,
613            location: CGFloat,
614        ) -> CGFloat;
615
616        #[cfg(all(feature = "NSEvent", feature = "NSRulerView"))]
617        #[unsafe(method(rulerView:handleMouseDown:))]
618        #[unsafe(method_family = none)]
619        pub fn rulerView_handleMouseDown(&self, ruler: &NSRulerView, event: &NSEvent);
620
621        /// ************************* Fine display control **************************
622        #[unsafe(method(setNeedsDisplayInRect:avoidAdditionalLayout:))]
623        #[unsafe(method_family = none)]
624        pub fn setNeedsDisplayInRect_avoidAdditionalLayout(&self, rect: NSRect, flag: bool);
625
626        #[unsafe(method(shouldDrawInsertionPoint))]
627        #[unsafe(method_family = none)]
628        pub fn shouldDrawInsertionPoint(&self) -> bool;
629
630        #[cfg(feature = "NSColor")]
631        #[unsafe(method(drawInsertionPointInRect:color:turnedOn:))]
632        #[unsafe(method_family = none)]
633        pub fn drawInsertionPointInRect_color_turnedOn(
634            &self,
635            rect: NSRect,
636            color: &NSColor,
637            flag: bool,
638        );
639
640        #[unsafe(method(drawViewBackgroundInRect:))]
641        #[unsafe(method_family = none)]
642        pub fn drawViewBackgroundInRect(&self, rect: NSRect);
643
644        /// ************************* Especially for subclassers **************************
645        #[unsafe(method(updateRuler))]
646        #[unsafe(method_family = none)]
647        pub fn updateRuler(&self);
648
649        #[unsafe(method(updateFontPanel))]
650        #[unsafe(method_family = none)]
651        pub fn updateFontPanel(&self);
652
653        #[unsafe(method(updateDragTypeRegistration))]
654        #[unsafe(method_family = none)]
655        pub fn updateDragTypeRegistration(&self);
656
657        #[unsafe(method(selectionRangeForProposedRange:granularity:))]
658        #[unsafe(method_family = none)]
659        pub fn selectionRangeForProposedRange_granularity(
660            &self,
661            proposed_char_range: NSRange,
662            granularity: NSSelectionGranularity,
663        ) -> NSRange;
664
665        /// ************************* Especially for subclassers **************************
666        ///
667        /// # Safety
668        ///
669        /// `link` should be of the correct type.
670        #[unsafe(method(clickedOnLink:atIndex:))]
671        #[unsafe(method_family = none)]
672        pub unsafe fn clickedOnLink_atIndex(&self, link: &AnyObject, char_index: NSUInteger);
673
674        /// *********************** Speech support ************************
675        ///
676        /// # Safety
677        ///
678        /// `sender` should be of the correct type.
679        #[unsafe(method(startSpeaking:))]
680        #[unsafe(method_family = none)]
681        pub unsafe fn startSpeaking(&self, sender: Option<&AnyObject>);
682
683        /// # Safety
684        ///
685        /// `sender` should be of the correct type.
686        #[unsafe(method(stopSpeaking:))]
687        #[unsafe(method_family = none)]
688        pub unsafe fn stopSpeaking(&self, sender: Option<&AnyObject>);
689
690        #[cfg(feature = "NSLayoutManager")]
691        #[unsafe(method(setLayoutOrientation:))]
692        #[unsafe(method_family = none)]
693        pub fn setLayoutOrientation(&self, orientation: NSTextLayoutOrientation);
694
695        /// # Safety
696        ///
697        /// `sender` should be of the correct type.
698        #[unsafe(method(changeLayoutOrientation:))]
699        #[unsafe(method_family = none)]
700        pub unsafe fn changeLayoutOrientation(&self, sender: Option<&AnyObject>);
701
702        /// *********************** Helper for subclassers ************************
703        #[unsafe(method(characterIndexForInsertionAtPoint:))]
704        #[unsafe(method_family = none)]
705        pub fn characterIndexForInsertionAtPoint(&self, point: NSPoint) -> NSUInteger;
706
707        /// ************************** Ownership policy ***************************
708        #[unsafe(method(stronglyReferencesTextStorage))]
709        #[unsafe(method_family = none)]
710        pub fn stronglyReferencesTextStorage(mtm: MainThreadMarker) -> bool;
711
712        #[unsafe(method(performValidatedReplacementInRange:withAttributedString:))]
713        #[unsafe(method_family = none)]
714        pub fn performValidatedReplacementInRange_withAttributedString(
715            &self,
716            range: NSRange,
717            attributed_string: &NSAttributedString,
718        ) -> bool;
719
720        #[unsafe(method(usesAdaptiveColorMappingForDarkAppearance))]
721        #[unsafe(method_family = none)]
722        pub fn usesAdaptiveColorMappingForDarkAppearance(&self) -> bool;
723
724        /// Setter for [`usesAdaptiveColorMappingForDarkAppearance`][Self::usesAdaptiveColorMappingForDarkAppearance].
725        #[unsafe(method(setUsesAdaptiveColorMappingForDarkAppearance:))]
726        #[unsafe(method_family = none)]
727        pub fn setUsesAdaptiveColorMappingForDarkAppearance(
728            &self,
729            uses_adaptive_color_mapping_for_dark_appearance: bool,
730        );
731    );
732}
733
734/// Methods declared on superclass `NSResponder`.
735#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
736impl NSTextView {
737    extern_methods!(
738        #[unsafe(method(init))]
739        #[unsafe(method_family = init)]
740        pub fn init(this: Allocated<Self>) -> Retained<Self>;
741    );
742}
743
744/// Methods declared on superclass `NSObject`.
745#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
746impl NSTextView {
747    extern_methods!(
748        #[unsafe(method(new))]
749        #[unsafe(method_family = new)]
750        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
751    );
752}
753
754/// NSCompletion.
755#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
756impl NSTextView {
757    extern_methods!(
758        /// *********************** Completion support ********************
759        ///
760        /// # Safety
761        ///
762        /// `sender` should be of the correct type.
763        #[unsafe(method(complete:))]
764        #[unsafe(method_family = none)]
765        pub unsafe fn complete(&self, sender: Option<&AnyObject>);
766
767        #[unsafe(method(rangeForUserCompletion))]
768        #[unsafe(method_family = none)]
769        pub fn rangeForUserCompletion(&self) -> NSRange;
770
771        /// # Safety
772        ///
773        /// `index` must be a valid pointer.
774        #[unsafe(method(completionsForPartialWordRange:indexOfSelectedItem:))]
775        #[unsafe(method_family = none)]
776        pub unsafe fn completionsForPartialWordRange_indexOfSelectedItem(
777            &self,
778            char_range: NSRange,
779            index: NonNull<NSInteger>,
780        ) -> Option<Retained<NSArray<NSString>>>;
781
782        #[unsafe(method(insertCompletion:forPartialWordRange:movement:isFinal:))]
783        #[unsafe(method_family = none)]
784        pub fn insertCompletion_forPartialWordRange_movement_isFinal(
785            &self,
786            word: &NSString,
787            char_range: NSRange,
788            movement: NSInteger,
789            flag: bool,
790        );
791    );
792}
793
794/// NSPasteboard.
795#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
796impl NSTextView {
797    extern_methods!(
798        #[cfg(feature = "NSPasteboard")]
799        /// ***************** Pasteboard support (mainly for subclassers) ******************
800        #[unsafe(method(writablePasteboardTypes))]
801        #[unsafe(method_family = none)]
802        pub fn writablePasteboardTypes(&self) -> Retained<NSArray<NSPasteboardType>>;
803
804        #[cfg(feature = "NSPasteboard")]
805        #[unsafe(method(writeSelectionToPasteboard:type:))]
806        #[unsafe(method_family = none)]
807        pub fn writeSelectionToPasteboard_type(
808            &self,
809            pboard: &NSPasteboard,
810            r#type: &NSPasteboardType,
811        ) -> bool;
812
813        #[cfg(feature = "NSPasteboard")]
814        #[unsafe(method(writeSelectionToPasteboard:types:))]
815        #[unsafe(method_family = none)]
816        pub fn writeSelectionToPasteboard_types(
817            &self,
818            pboard: &NSPasteboard,
819            types: &NSArray<NSPasteboardType>,
820        ) -> bool;
821
822        #[cfg(feature = "NSPasteboard")]
823        #[unsafe(method(readablePasteboardTypes))]
824        #[unsafe(method_family = none)]
825        pub fn readablePasteboardTypes(&self) -> Retained<NSArray<NSPasteboardType>>;
826
827        #[cfg(feature = "NSPasteboard")]
828        #[unsafe(method(preferredPasteboardTypeFromArray:restrictedToTypesFromArray:))]
829        #[unsafe(method_family = none)]
830        pub fn preferredPasteboardTypeFromArray_restrictedToTypesFromArray(
831            &self,
832            available_types: &NSArray<NSPasteboardType>,
833            allowed_types: Option<&NSArray<NSPasteboardType>>,
834        ) -> Option<Retained<NSPasteboardType>>;
835
836        #[cfg(feature = "NSPasteboard")]
837        #[unsafe(method(readSelectionFromPasteboard:type:))]
838        #[unsafe(method_family = none)]
839        pub fn readSelectionFromPasteboard_type(
840            &self,
841            pboard: &NSPasteboard,
842            r#type: &NSPasteboardType,
843        ) -> bool;
844
845        #[cfg(feature = "NSPasteboard")]
846        #[unsafe(method(readSelectionFromPasteboard:))]
847        #[unsafe(method_family = none)]
848        pub fn readSelectionFromPasteboard(&self, pboard: &NSPasteboard) -> bool;
849
850        #[unsafe(method(registerForServices))]
851        #[unsafe(method_family = none)]
852        pub fn registerForServices(mtm: MainThreadMarker);
853
854        #[cfg(feature = "NSPasteboard")]
855        #[unsafe(method(validRequestorForSendType:returnType:))]
856        #[unsafe(method_family = none)]
857        pub fn validRequestorForSendType_returnType(
858            &self,
859            send_type: Option<&NSPasteboardType>,
860            return_type: Option<&NSPasteboardType>,
861        ) -> Option<Retained<AnyObject>>;
862
863        /// # Safety
864        ///
865        /// `sender` should be of the correct type.
866        #[unsafe(method(pasteAsPlainText:))]
867        #[unsafe(method_family = none)]
868        pub unsafe fn pasteAsPlainText(&self, sender: Option<&AnyObject>);
869
870        /// # Safety
871        ///
872        /// `sender` should be of the correct type.
873        #[unsafe(method(pasteAsRichText:))]
874        #[unsafe(method_family = none)]
875        pub unsafe fn pasteAsRichText(&self, sender: Option<&AnyObject>);
876    );
877}
878
879/// NSDragging.
880#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
881impl NSTextView {
882    extern_methods!(
883        #[cfg(feature = "NSEvent")]
884        #[unsafe(method(dragSelectionWithEvent:offset:slideBack:))]
885        #[unsafe(method_family = none)]
886        pub fn dragSelectionWithEvent_offset_slideBack(
887            &self,
888            event: &NSEvent,
889            mouse_offset: NSSize,
890            slide_back: bool,
891        ) -> bool;
892
893        #[cfg(all(feature = "NSEvent", feature = "NSImage"))]
894        /// # Safety
895        ///
896        /// `origin` must be a valid pointer or null.
897        #[unsafe(method(dragImageForSelectionWithEvent:origin:))]
898        #[unsafe(method_family = none)]
899        pub unsafe fn dragImageForSelectionWithEvent_origin(
900            &self,
901            event: &NSEvent,
902            origin: NSPointPointer,
903        ) -> Option<Retained<NSImage>>;
904
905        #[cfg(feature = "NSPasteboard")]
906        #[unsafe(method(acceptableDragTypes))]
907        #[unsafe(method_family = none)]
908        pub fn acceptableDragTypes(&self) -> Retained<NSArray<NSPasteboardType>>;
909
910        #[cfg(all(feature = "NSDragging", feature = "NSPasteboard"))]
911        #[unsafe(method(dragOperationForDraggingInfo:type:))]
912        #[unsafe(method_family = none)]
913        pub fn dragOperationForDraggingInfo_type(
914            &self,
915            drag_info: &ProtocolObject<dyn NSDraggingInfo>,
916            r#type: &NSPasteboardType,
917        ) -> NSDragOperation;
918
919        #[unsafe(method(cleanUpAfterDragOperation))]
920        #[unsafe(method_family = none)]
921        pub fn cleanUpAfterDragOperation(&self);
922    );
923}
924
925/// NSSharing.
926#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
927impl NSTextView {
928    extern_methods!(
929        /// ************************* Selected/Marked range **************************
930        #[unsafe(method(selectedRanges))]
931        #[unsafe(method_family = none)]
932        pub fn selectedRanges(&self) -> Retained<NSArray<NSValue>>;
933
934        /// Setter for [`selectedRanges`][Self::selectedRanges].
935        ///
936        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
937        #[unsafe(method(setSelectedRanges:))]
938        #[unsafe(method_family = none)]
939        pub fn setSelectedRanges(&self, selected_ranges: &NSArray<NSValue>);
940
941        #[unsafe(method(setSelectedRanges:affinity:stillSelecting:))]
942        #[unsafe(method_family = none)]
943        pub fn setSelectedRanges_affinity_stillSelecting(
944            &self,
945            ranges: &NSArray<NSValue>,
946            affinity: NSSelectionAffinity,
947            still_selecting_flag: bool,
948        );
949
950        #[unsafe(method(setSelectedRange:affinity:stillSelecting:))]
951        #[unsafe(method_family = none)]
952        pub fn setSelectedRange_affinity_stillSelecting(
953            &self,
954            char_range: NSRange,
955            affinity: NSSelectionAffinity,
956            still_selecting_flag: bool,
957        );
958
959        #[unsafe(method(selectionAffinity))]
960        #[unsafe(method_family = none)]
961        pub fn selectionAffinity(&self) -> NSSelectionAffinity;
962
963        #[unsafe(method(selectionGranularity))]
964        #[unsafe(method_family = none)]
965        pub fn selectionGranularity(&self) -> NSSelectionGranularity;
966
967        /// Setter for [`selectionGranularity`][Self::selectionGranularity].
968        #[unsafe(method(setSelectionGranularity:))]
969        #[unsafe(method_family = none)]
970        pub fn setSelectionGranularity(&self, selection_granularity: NSSelectionGranularity);
971
972        #[unsafe(method(selectedTextAttributes))]
973        #[unsafe(method_family = none)]
974        pub fn selectedTextAttributes(
975            &self,
976        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
977
978        /// Setter for [`selectedTextAttributes`][Self::selectedTextAttributes].
979        ///
980        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
981        ///
982        /// # Safety
983        ///
984        /// `selected_text_attributes` generic should be of the correct type.
985        #[unsafe(method(setSelectedTextAttributes:))]
986        #[unsafe(method_family = none)]
987        pub unsafe fn setSelectedTextAttributes(
988            &self,
989            selected_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
990        );
991
992        #[cfg(feature = "NSColor")]
993        #[unsafe(method(insertionPointColor))]
994        #[unsafe(method_family = none)]
995        pub fn insertionPointColor(&self) -> Retained<NSColor>;
996
997        #[cfg(feature = "NSColor")]
998        /// Setter for [`insertionPointColor`][Self::insertionPointColor].
999        ///
1000        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1001        #[unsafe(method(setInsertionPointColor:))]
1002        #[unsafe(method_family = none)]
1003        pub fn setInsertionPointColor(&self, insertion_point_color: Option<&NSColor>);
1004
1005        #[unsafe(method(updateInsertionPointStateAndRestartTimer:))]
1006        #[unsafe(method_family = none)]
1007        pub fn updateInsertionPointStateAndRestartTimer(&self, restart_flag: bool);
1008
1009        #[unsafe(method(markedTextAttributes))]
1010        #[unsafe(method_family = none)]
1011        pub fn markedTextAttributes(
1012            &self,
1013        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
1014
1015        /// Setter for [`markedTextAttributes`][Self::markedTextAttributes].
1016        ///
1017        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1018        ///
1019        /// # Safety
1020        ///
1021        /// `marked_text_attributes` generic should be of the correct type.
1022        #[unsafe(method(setMarkedTextAttributes:))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn setMarkedTextAttributes(
1025            &self,
1026            marked_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
1027        );
1028
1029        #[unsafe(method(linkTextAttributes))]
1030        #[unsafe(method_family = none)]
1031        pub fn linkTextAttributes(
1032            &self,
1033        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
1034
1035        /// Setter for [`linkTextAttributes`][Self::linkTextAttributes].
1036        ///
1037        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1038        ///
1039        /// # Safety
1040        ///
1041        /// `link_text_attributes` generic should be of the correct type.
1042        #[unsafe(method(setLinkTextAttributes:))]
1043        #[unsafe(method_family = none)]
1044        pub unsafe fn setLinkTextAttributes(
1045            &self,
1046            link_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
1047        );
1048
1049        #[unsafe(method(displaysLinkToolTips))]
1050        #[unsafe(method_family = none)]
1051        pub fn displaysLinkToolTips(&self) -> bool;
1052
1053        /// Setter for [`displaysLinkToolTips`][Self::displaysLinkToolTips].
1054        #[unsafe(method(setDisplaysLinkToolTips:))]
1055        #[unsafe(method_family = none)]
1056        pub fn setDisplaysLinkToolTips(&self, displays_link_tool_tips: bool);
1057
1058        /// *********************** Glyph info support ************************
1059        #[unsafe(method(acceptsGlyphInfo))]
1060        #[unsafe(method_family = none)]
1061        pub fn acceptsGlyphInfo(&self) -> bool;
1062
1063        /// Setter for [`acceptsGlyphInfo`][Self::acceptsGlyphInfo].
1064        #[unsafe(method(setAcceptsGlyphInfo:))]
1065        #[unsafe(method_family = none)]
1066        pub fn setAcceptsGlyphInfo(&self, accepts_glyph_info: bool);
1067
1068        /// ************************* Other NSTextView methods **************************
1069        #[unsafe(method(usesRuler))]
1070        #[unsafe(method_family = none)]
1071        pub fn usesRuler(&self) -> bool;
1072
1073        /// Setter for [`usesRuler`][Self::usesRuler].
1074        #[unsafe(method(setUsesRuler:))]
1075        #[unsafe(method_family = none)]
1076        pub fn setUsesRuler(&self, uses_ruler: bool);
1077
1078        #[unsafe(method(usesInspectorBar))]
1079        #[unsafe(method_family = none)]
1080        pub fn usesInspectorBar(&self) -> bool;
1081
1082        /// Setter for [`usesInspectorBar`][Self::usesInspectorBar].
1083        #[unsafe(method(setUsesInspectorBar:))]
1084        #[unsafe(method_family = none)]
1085        pub fn setUsesInspectorBar(&self, uses_inspector_bar: bool);
1086
1087        #[unsafe(method(isContinuousSpellCheckingEnabled))]
1088        #[unsafe(method_family = none)]
1089        pub fn isContinuousSpellCheckingEnabled(&self) -> bool;
1090
1091        /// Setter for [`isContinuousSpellCheckingEnabled`][Self::isContinuousSpellCheckingEnabled].
1092        #[unsafe(method(setContinuousSpellCheckingEnabled:))]
1093        #[unsafe(method_family = none)]
1094        pub fn setContinuousSpellCheckingEnabled(&self, continuous_spell_checking_enabled: bool);
1095
1096        /// # Safety
1097        ///
1098        /// `sender` should be of the correct type.
1099        #[unsafe(method(toggleContinuousSpellChecking:))]
1100        #[unsafe(method_family = none)]
1101        pub unsafe fn toggleContinuousSpellChecking(&self, sender: Option<&AnyObject>);
1102
1103        #[unsafe(method(spellCheckerDocumentTag))]
1104        #[unsafe(method_family = none)]
1105        pub fn spellCheckerDocumentTag(&self) -> NSInteger;
1106
1107        #[unsafe(method(isGrammarCheckingEnabled))]
1108        #[unsafe(method_family = none)]
1109        pub fn isGrammarCheckingEnabled(&self) -> bool;
1110
1111        /// Setter for [`isGrammarCheckingEnabled`][Self::isGrammarCheckingEnabled].
1112        #[unsafe(method(setGrammarCheckingEnabled:))]
1113        #[unsafe(method_family = none)]
1114        pub fn setGrammarCheckingEnabled(&self, grammar_checking_enabled: bool);
1115
1116        /// # Safety
1117        ///
1118        /// `sender` should be of the correct type.
1119        #[unsafe(method(toggleGrammarChecking:))]
1120        #[unsafe(method_family = none)]
1121        pub unsafe fn toggleGrammarChecking(&self, sender: Option<&AnyObject>);
1122
1123        #[unsafe(method(setSpellingState:range:))]
1124        #[unsafe(method_family = none)]
1125        pub fn setSpellingState_range(&self, value: NSInteger, char_range: NSRange);
1126
1127        #[unsafe(method(typingAttributes))]
1128        #[unsafe(method_family = none)]
1129        pub fn typingAttributes(&self) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
1130
1131        /// Setter for [`typingAttributes`][Self::typingAttributes].
1132        ///
1133        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1134        ///
1135        /// # Safety
1136        ///
1137        /// `typing_attributes` generic should be of the correct type.
1138        #[unsafe(method(setTypingAttributes:))]
1139        #[unsafe(method_family = none)]
1140        pub unsafe fn setTypingAttributes(
1141            &self,
1142            typing_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
1143        );
1144
1145        #[unsafe(method(shouldChangeTextInRanges:replacementStrings:))]
1146        #[unsafe(method_family = none)]
1147        pub fn shouldChangeTextInRanges_replacementStrings(
1148            &self,
1149            affected_ranges: &NSArray<NSValue>,
1150            replacement_strings: Option<&NSArray<NSString>>,
1151        ) -> bool;
1152
1153        #[unsafe(method(rangesForUserTextChange))]
1154        #[unsafe(method_family = none)]
1155        pub fn rangesForUserTextChange(&self) -> Option<Retained<NSArray<NSValue>>>;
1156
1157        #[unsafe(method(rangesForUserCharacterAttributeChange))]
1158        #[unsafe(method_family = none)]
1159        pub fn rangesForUserCharacterAttributeChange(&self) -> Option<Retained<NSArray<NSValue>>>;
1160
1161        #[unsafe(method(rangesForUserParagraphAttributeChange))]
1162        #[unsafe(method_family = none)]
1163        pub fn rangesForUserParagraphAttributeChange(&self) -> Option<Retained<NSArray<NSValue>>>;
1164
1165        #[unsafe(method(shouldChangeTextInRange:replacementString:))]
1166        #[unsafe(method_family = none)]
1167        pub fn shouldChangeTextInRange_replacementString(
1168            &self,
1169            affected_char_range: NSRange,
1170            replacement_string: Option<&NSString>,
1171        ) -> bool;
1172
1173        #[unsafe(method(didChangeText))]
1174        #[unsafe(method_family = none)]
1175        pub fn didChangeText(&self);
1176
1177        #[unsafe(method(rangeForUserTextChange))]
1178        #[unsafe(method_family = none)]
1179        pub fn rangeForUserTextChange(&self) -> NSRange;
1180
1181        #[unsafe(method(rangeForUserCharacterAttributeChange))]
1182        #[unsafe(method_family = none)]
1183        pub fn rangeForUserCharacterAttributeChange(&self) -> NSRange;
1184
1185        #[unsafe(method(rangeForUserParagraphAttributeChange))]
1186        #[unsafe(method_family = none)]
1187        pub fn rangeForUserParagraphAttributeChange(&self) -> NSRange;
1188
1189        #[unsafe(method(allowsDocumentBackgroundColorChange))]
1190        #[unsafe(method_family = none)]
1191        pub fn allowsDocumentBackgroundColorChange(&self) -> bool;
1192
1193        /// Setter for [`allowsDocumentBackgroundColorChange`][Self::allowsDocumentBackgroundColorChange].
1194        #[unsafe(method(setAllowsDocumentBackgroundColorChange:))]
1195        #[unsafe(method_family = none)]
1196        pub fn setAllowsDocumentBackgroundColorChange(
1197            &self,
1198            allows_document_background_color_change: bool,
1199        );
1200
1201        #[cfg(feature = "NSParagraphStyle")]
1202        #[unsafe(method(defaultParagraphStyle))]
1203        #[unsafe(method_family = none)]
1204        pub fn defaultParagraphStyle(&self) -> Option<Retained<NSParagraphStyle>>;
1205
1206        #[cfg(feature = "NSParagraphStyle")]
1207        /// Setter for [`defaultParagraphStyle`][Self::defaultParagraphStyle].
1208        ///
1209        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1210        #[unsafe(method(setDefaultParagraphStyle:))]
1211        #[unsafe(method_family = none)]
1212        pub fn setDefaultParagraphStyle(&self, default_paragraph_style: Option<&NSParagraphStyle>);
1213
1214        #[unsafe(method(allowsUndo))]
1215        #[unsafe(method_family = none)]
1216        pub fn allowsUndo(&self) -> bool;
1217
1218        /// Setter for [`allowsUndo`][Self::allowsUndo].
1219        #[unsafe(method(setAllowsUndo:))]
1220        #[unsafe(method_family = none)]
1221        pub fn setAllowsUndo(&self, allows_undo: bool);
1222
1223        #[unsafe(method(breakUndoCoalescing))]
1224        #[unsafe(method_family = none)]
1225        pub fn breakUndoCoalescing(&self);
1226
1227        #[unsafe(method(isCoalescingUndo))]
1228        #[unsafe(method_family = none)]
1229        pub fn isCoalescingUndo(&self) -> bool;
1230
1231        #[unsafe(method(allowsImageEditing))]
1232        #[unsafe(method_family = none)]
1233        pub fn allowsImageEditing(&self) -> bool;
1234
1235        /// Setter for [`allowsImageEditing`][Self::allowsImageEditing].
1236        #[unsafe(method(setAllowsImageEditing:))]
1237        #[unsafe(method_family = none)]
1238        pub fn setAllowsImageEditing(&self, allows_image_editing: bool);
1239
1240        #[unsafe(method(showFindIndicatorForRange:))]
1241        #[unsafe(method_family = none)]
1242        pub fn showFindIndicatorForRange(&self, char_range: NSRange);
1243
1244        #[unsafe(method(usesRolloverButtonForSelection))]
1245        #[unsafe(method_family = none)]
1246        pub fn usesRolloverButtonForSelection(&self) -> bool;
1247
1248        /// Setter for [`usesRolloverButtonForSelection`][Self::usesRolloverButtonForSelection].
1249        #[unsafe(method(setUsesRolloverButtonForSelection:))]
1250        #[unsafe(method_family = none)]
1251        pub fn setUsesRolloverButtonForSelection(&self, uses_rollover_button_for_selection: bool);
1252
1253        /// ************************* NSText methods **************************
1254        #[unsafe(method(delegate))]
1255        #[unsafe(method_family = none)]
1256        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSTextViewDelegate>>>;
1257
1258        /// Setter for [`delegate`][Self::delegate].
1259        ///
1260        /// This is a [weak property][objc2::topics::weak_property].
1261        #[unsafe(method(setDelegate:))]
1262        #[unsafe(method_family = none)]
1263        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSTextViewDelegate>>);
1264
1265        #[unsafe(method(isEditable))]
1266        #[unsafe(method_family = none)]
1267        pub fn isEditable(&self) -> bool;
1268
1269        /// Setter for [`isEditable`][Self::isEditable].
1270        #[unsafe(method(setEditable:))]
1271        #[unsafe(method_family = none)]
1272        pub fn setEditable(&self, editable: bool);
1273
1274        #[unsafe(method(isSelectable))]
1275        #[unsafe(method_family = none)]
1276        pub fn isSelectable(&self) -> bool;
1277
1278        /// Setter for [`isSelectable`][Self::isSelectable].
1279        #[unsafe(method(setSelectable:))]
1280        #[unsafe(method_family = none)]
1281        pub fn setSelectable(&self, selectable: bool);
1282
1283        #[unsafe(method(isRichText))]
1284        #[unsafe(method_family = none)]
1285        pub fn isRichText(&self) -> bool;
1286
1287        /// Setter for [`isRichText`][Self::isRichText].
1288        #[unsafe(method(setRichText:))]
1289        #[unsafe(method_family = none)]
1290        pub fn setRichText(&self, rich_text: bool);
1291
1292        #[unsafe(method(importsGraphics))]
1293        #[unsafe(method_family = none)]
1294        pub fn importsGraphics(&self) -> bool;
1295
1296        /// Setter for [`importsGraphics`][Self::importsGraphics].
1297        #[unsafe(method(setImportsGraphics:))]
1298        #[unsafe(method_family = none)]
1299        pub fn setImportsGraphics(&self, imports_graphics: bool);
1300
1301        #[unsafe(method(drawsBackground))]
1302        #[unsafe(method_family = none)]
1303        pub fn drawsBackground(&self) -> bool;
1304
1305        /// Setter for [`drawsBackground`][Self::drawsBackground].
1306        #[unsafe(method(setDrawsBackground:))]
1307        #[unsafe(method_family = none)]
1308        pub fn setDrawsBackground(&self, draws_background: bool);
1309
1310        #[cfg(feature = "NSColor")]
1311        #[unsafe(method(backgroundColor))]
1312        #[unsafe(method_family = none)]
1313        pub fn backgroundColor(&self) -> Retained<NSColor>;
1314
1315        #[cfg(feature = "NSColor")]
1316        /// Setter for [`backgroundColor`][Self::backgroundColor].
1317        ///
1318        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1319        #[unsafe(method(setBackgroundColor:))]
1320        #[unsafe(method_family = none)]
1321        pub fn setBackgroundColor(&self, background_color: &NSColor);
1322
1323        #[unsafe(method(isFieldEditor))]
1324        #[unsafe(method_family = none)]
1325        pub fn isFieldEditor(&self) -> bool;
1326
1327        /// Setter for [`isFieldEditor`][Self::isFieldEditor].
1328        #[unsafe(method(setFieldEditor:))]
1329        #[unsafe(method_family = none)]
1330        pub fn setFieldEditor(&self, field_editor: bool);
1331
1332        #[unsafe(method(usesFontPanel))]
1333        #[unsafe(method_family = none)]
1334        pub fn usesFontPanel(&self) -> bool;
1335
1336        /// Setter for [`usesFontPanel`][Self::usesFontPanel].
1337        #[unsafe(method(setUsesFontPanel:))]
1338        #[unsafe(method_family = none)]
1339        pub fn setUsesFontPanel(&self, uses_font_panel: bool);
1340
1341        #[unsafe(method(isRulerVisible))]
1342        #[unsafe(method_family = none)]
1343        pub fn isRulerVisible(&self) -> bool;
1344
1345        /// Setter for [`isRulerVisible`][Self::isRulerVisible].
1346        #[unsafe(method(setRulerVisible:))]
1347        #[unsafe(method_family = none)]
1348        pub fn setRulerVisible(&self, ruler_visible: bool);
1349
1350        #[unsafe(method(setSelectedRange:))]
1351        #[unsafe(method_family = none)]
1352        pub fn setSelectedRange(&self, char_range: NSRange);
1353
1354        /// ************************* Input Source support **************************
1355        #[unsafe(method(allowedInputSourceLocales))]
1356        #[unsafe(method_family = none)]
1357        pub fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
1358
1359        /// Setter for [`allowedInputSourceLocales`][Self::allowedInputSourceLocales].
1360        ///
1361        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1362        #[unsafe(method(setAllowedInputSourceLocales:))]
1363        #[unsafe(method_family = none)]
1364        pub fn setAllowedInputSourceLocales(
1365            &self,
1366            allowed_input_source_locales: Option<&NSArray<NSString>>,
1367        );
1368
1369        #[unsafe(method(isWritingToolsActive))]
1370        #[unsafe(method_family = none)]
1371        pub fn isWritingToolsActive(&self) -> bool;
1372
1373        #[cfg(feature = "NSTextCheckingClient")]
1374        #[unsafe(method(writingToolsBehavior))]
1375        #[unsafe(method_family = none)]
1376        pub fn writingToolsBehavior(&self) -> NSWritingToolsBehavior;
1377
1378        #[cfg(feature = "NSTextCheckingClient")]
1379        /// Setter for [`writingToolsBehavior`][Self::writingToolsBehavior].
1380        #[unsafe(method(setWritingToolsBehavior:))]
1381        #[unsafe(method_family = none)]
1382        pub fn setWritingToolsBehavior(&self, writing_tools_behavior: NSWritingToolsBehavior);
1383
1384        #[cfg(feature = "NSTextCheckingClient")]
1385        #[unsafe(method(allowedWritingToolsResultOptions))]
1386        #[unsafe(method_family = none)]
1387        pub fn allowedWritingToolsResultOptions(&self) -> NSWritingToolsResultOptions;
1388
1389        #[cfg(feature = "NSTextCheckingClient")]
1390        /// Setter for [`allowedWritingToolsResultOptions`][Self::allowedWritingToolsResultOptions].
1391        #[unsafe(method(setAllowedWritingToolsResultOptions:))]
1392        #[unsafe(method_family = none)]
1393        pub fn setAllowedWritingToolsResultOptions(
1394            &self,
1395            allowed_writing_tools_result_options: NSWritingToolsResultOptions,
1396        );
1397    );
1398}
1399
1400/// NSTextChecking.
1401#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1402impl NSTextView {
1403    extern_methods!(
1404        /// ************************* Smart copy/paste/delete/substitution support **************************
1405        #[unsafe(method(smartInsertDeleteEnabled))]
1406        #[unsafe(method_family = none)]
1407        pub fn smartInsertDeleteEnabled(&self) -> bool;
1408
1409        /// Setter for [`smartInsertDeleteEnabled`][Self::smartInsertDeleteEnabled].
1410        #[unsafe(method(setSmartInsertDeleteEnabled:))]
1411        #[unsafe(method_family = none)]
1412        pub fn setSmartInsertDeleteEnabled(&self, smart_insert_delete_enabled: bool);
1413
1414        #[unsafe(method(smartDeleteRangeForProposedRange:))]
1415        #[unsafe(method_family = none)]
1416        pub fn smartDeleteRangeForProposedRange(&self, proposed_char_range: NSRange) -> NSRange;
1417
1418        /// # Safety
1419        ///
1420        /// `sender` should be of the correct type.
1421        #[unsafe(method(toggleSmartInsertDelete:))]
1422        #[unsafe(method_family = none)]
1423        pub unsafe fn toggleSmartInsertDelete(&self, sender: Option<&AnyObject>);
1424
1425        #[unsafe(method(smartInsertForString:replacingRange:beforeString:afterString:))]
1426        #[unsafe(method_family = none)]
1427        pub fn smartInsertForString_replacingRange_beforeString_afterString(
1428            &self,
1429            paste_string: &NSString,
1430            char_range_to_replace: NSRange,
1431            before_string: Option<&mut Option<Retained<NSString>>>,
1432            after_string: Option<&mut Option<Retained<NSString>>>,
1433        );
1434
1435        #[unsafe(method(smartInsertBeforeStringForString:replacingRange:))]
1436        #[unsafe(method_family = none)]
1437        pub fn smartInsertBeforeStringForString_replacingRange(
1438            &self,
1439            paste_string: &NSString,
1440            char_range_to_replace: NSRange,
1441        ) -> Option<Retained<NSString>>;
1442
1443        #[unsafe(method(smartInsertAfterStringForString:replacingRange:))]
1444        #[unsafe(method_family = none)]
1445        pub fn smartInsertAfterStringForString_replacingRange(
1446            &self,
1447            paste_string: &NSString,
1448            char_range_to_replace: NSRange,
1449        ) -> Option<Retained<NSString>>;
1450
1451        #[unsafe(method(isAutomaticQuoteSubstitutionEnabled))]
1452        #[unsafe(method_family = none)]
1453        pub fn isAutomaticQuoteSubstitutionEnabled(&self) -> bool;
1454
1455        /// Setter for [`isAutomaticQuoteSubstitutionEnabled`][Self::isAutomaticQuoteSubstitutionEnabled].
1456        #[unsafe(method(setAutomaticQuoteSubstitutionEnabled:))]
1457        #[unsafe(method_family = none)]
1458        pub fn setAutomaticQuoteSubstitutionEnabled(
1459            &self,
1460            automatic_quote_substitution_enabled: bool,
1461        );
1462
1463        /// # Safety
1464        ///
1465        /// `sender` should be of the correct type.
1466        #[unsafe(method(toggleAutomaticQuoteSubstitution:))]
1467        #[unsafe(method_family = none)]
1468        pub unsafe fn toggleAutomaticQuoteSubstitution(&self, sender: Option<&AnyObject>);
1469
1470        #[unsafe(method(isAutomaticLinkDetectionEnabled))]
1471        #[unsafe(method_family = none)]
1472        pub fn isAutomaticLinkDetectionEnabled(&self) -> bool;
1473
1474        /// Setter for [`isAutomaticLinkDetectionEnabled`][Self::isAutomaticLinkDetectionEnabled].
1475        #[unsafe(method(setAutomaticLinkDetectionEnabled:))]
1476        #[unsafe(method_family = none)]
1477        pub fn setAutomaticLinkDetectionEnabled(&self, automatic_link_detection_enabled: bool);
1478
1479        /// # Safety
1480        ///
1481        /// `sender` should be of the correct type.
1482        #[unsafe(method(toggleAutomaticLinkDetection:))]
1483        #[unsafe(method_family = none)]
1484        pub unsafe fn toggleAutomaticLinkDetection(&self, sender: Option<&AnyObject>);
1485
1486        #[unsafe(method(isAutomaticDataDetectionEnabled))]
1487        #[unsafe(method_family = none)]
1488        pub fn isAutomaticDataDetectionEnabled(&self) -> bool;
1489
1490        /// Setter for [`isAutomaticDataDetectionEnabled`][Self::isAutomaticDataDetectionEnabled].
1491        #[unsafe(method(setAutomaticDataDetectionEnabled:))]
1492        #[unsafe(method_family = none)]
1493        pub fn setAutomaticDataDetectionEnabled(&self, automatic_data_detection_enabled: bool);
1494
1495        /// # Safety
1496        ///
1497        /// `sender` should be of the correct type.
1498        #[unsafe(method(toggleAutomaticDataDetection:))]
1499        #[unsafe(method_family = none)]
1500        pub unsafe fn toggleAutomaticDataDetection(&self, sender: Option<&AnyObject>);
1501
1502        #[unsafe(method(isAutomaticDashSubstitutionEnabled))]
1503        #[unsafe(method_family = none)]
1504        pub fn isAutomaticDashSubstitutionEnabled(&self) -> bool;
1505
1506        /// Setter for [`isAutomaticDashSubstitutionEnabled`][Self::isAutomaticDashSubstitutionEnabled].
1507        #[unsafe(method(setAutomaticDashSubstitutionEnabled:))]
1508        #[unsafe(method_family = none)]
1509        pub fn setAutomaticDashSubstitutionEnabled(
1510            &self,
1511            automatic_dash_substitution_enabled: bool,
1512        );
1513
1514        /// # Safety
1515        ///
1516        /// `sender` should be of the correct type.
1517        #[unsafe(method(toggleAutomaticDashSubstitution:))]
1518        #[unsafe(method_family = none)]
1519        pub unsafe fn toggleAutomaticDashSubstitution(&self, sender: Option<&AnyObject>);
1520
1521        #[unsafe(method(isAutomaticTextReplacementEnabled))]
1522        #[unsafe(method_family = none)]
1523        pub fn isAutomaticTextReplacementEnabled(&self) -> bool;
1524
1525        /// Setter for [`isAutomaticTextReplacementEnabled`][Self::isAutomaticTextReplacementEnabled].
1526        #[unsafe(method(setAutomaticTextReplacementEnabled:))]
1527        #[unsafe(method_family = none)]
1528        pub fn setAutomaticTextReplacementEnabled(&self, automatic_text_replacement_enabled: bool);
1529
1530        /// # Safety
1531        ///
1532        /// `sender` should be of the correct type.
1533        #[unsafe(method(toggleAutomaticTextReplacement:))]
1534        #[unsafe(method_family = none)]
1535        pub unsafe fn toggleAutomaticTextReplacement(&self, sender: Option<&AnyObject>);
1536
1537        #[unsafe(method(isAutomaticSpellingCorrectionEnabled))]
1538        #[unsafe(method_family = none)]
1539        pub fn isAutomaticSpellingCorrectionEnabled(&self) -> bool;
1540
1541        /// Setter for [`isAutomaticSpellingCorrectionEnabled`][Self::isAutomaticSpellingCorrectionEnabled].
1542        #[unsafe(method(setAutomaticSpellingCorrectionEnabled:))]
1543        #[unsafe(method_family = none)]
1544        pub fn setAutomaticSpellingCorrectionEnabled(
1545            &self,
1546            automatic_spelling_correction_enabled: bool,
1547        );
1548
1549        /// # Safety
1550        ///
1551        /// `sender` should be of the correct type.
1552        #[unsafe(method(toggleAutomaticSpellingCorrection:))]
1553        #[unsafe(method_family = none)]
1554        pub unsafe fn toggleAutomaticSpellingCorrection(&self, sender: Option<&AnyObject>);
1555
1556        #[unsafe(method(enabledTextCheckingTypes))]
1557        #[unsafe(method_family = none)]
1558        pub fn enabledTextCheckingTypes(&self) -> NSTextCheckingTypes;
1559
1560        /// Setter for [`enabledTextCheckingTypes`][Self::enabledTextCheckingTypes].
1561        #[unsafe(method(setEnabledTextCheckingTypes:))]
1562        #[unsafe(method_family = none)]
1563        pub fn setEnabledTextCheckingTypes(&self, enabled_text_checking_types: NSTextCheckingTypes);
1564
1565        #[cfg(feature = "NSSpellChecker")]
1566        /// # Safety
1567        ///
1568        /// `options` generic should be of the correct type.
1569        #[unsafe(method(checkTextInRange:types:options:))]
1570        #[unsafe(method_family = none)]
1571        pub unsafe fn checkTextInRange_types_options(
1572            &self,
1573            range: NSRange,
1574            checking_types: NSTextCheckingTypes,
1575            options: &NSDictionary<NSTextCheckingOptionKey, AnyObject>,
1576        );
1577
1578        #[cfg(feature = "NSSpellChecker")]
1579        /// # Safety
1580        ///
1581        /// `options` generic should be of the correct type.
1582        #[unsafe(method(handleTextCheckingResults:forRange:types:options:orthography:wordCount:))]
1583        #[unsafe(method_family = none)]
1584        pub unsafe fn handleTextCheckingResults_forRange_types_options_orthography_wordCount(
1585            &self,
1586            results: &NSArray<NSTextCheckingResult>,
1587            range: NSRange,
1588            checking_types: NSTextCheckingTypes,
1589            options: &NSDictionary<NSTextCheckingOptionKey, AnyObject>,
1590            orthography: &NSOrthography,
1591            word_count: NSInteger,
1592        );
1593
1594        /// # Safety
1595        ///
1596        /// `sender` should be of the correct type.
1597        #[unsafe(method(orderFrontSubstitutionsPanel:))]
1598        #[unsafe(method_family = none)]
1599        pub unsafe fn orderFrontSubstitutionsPanel(&self, sender: Option<&AnyObject>);
1600
1601        /// # Safety
1602        ///
1603        /// `sender` should be of the correct type.
1604        #[unsafe(method(checkTextInSelection:))]
1605        #[unsafe(method_family = none)]
1606        pub unsafe fn checkTextInSelection(&self, sender: Option<&AnyObject>);
1607
1608        /// # Safety
1609        ///
1610        /// `sender` should be of the correct type.
1611        #[unsafe(method(checkTextInDocument:))]
1612        #[unsafe(method_family = none)]
1613        pub unsafe fn checkTextInDocument(&self, sender: Option<&AnyObject>);
1614
1615        #[unsafe(method(usesFindPanel))]
1616        #[unsafe(method_family = none)]
1617        pub fn usesFindPanel(&self) -> bool;
1618
1619        /// Setter for [`usesFindPanel`][Self::usesFindPanel].
1620        #[unsafe(method(setUsesFindPanel:))]
1621        #[unsafe(method_family = none)]
1622        pub fn setUsesFindPanel(&self, uses_find_panel: bool);
1623
1624        #[unsafe(method(usesFindBar))]
1625        #[unsafe(method_family = none)]
1626        pub fn usesFindBar(&self) -> bool;
1627
1628        /// Setter for [`usesFindBar`][Self::usesFindBar].
1629        #[unsafe(method(setUsesFindBar:))]
1630        #[unsafe(method_family = none)]
1631        pub fn setUsesFindBar(&self, uses_find_bar: bool);
1632
1633        #[unsafe(method(isIncrementalSearchingEnabled))]
1634        #[unsafe(method_family = none)]
1635        pub fn isIncrementalSearchingEnabled(&self) -> bool;
1636
1637        /// Setter for [`isIncrementalSearchingEnabled`][Self::isIncrementalSearchingEnabled].
1638        #[unsafe(method(setIncrementalSearchingEnabled:))]
1639        #[unsafe(method_family = none)]
1640        pub fn setIncrementalSearchingEnabled(&self, incremental_searching_enabled: bool);
1641
1642        #[cfg(feature = "NSTextCheckingClient")]
1643        #[unsafe(method(inlinePredictionType))]
1644        #[unsafe(method_family = none)]
1645        pub fn inlinePredictionType(&self) -> NSTextInputTraitType;
1646
1647        #[cfg(feature = "NSTextCheckingClient")]
1648        /// Setter for [`inlinePredictionType`][Self::inlinePredictionType].
1649        #[unsafe(method(setInlinePredictionType:))]
1650        #[unsafe(method_family = none)]
1651        pub fn setInlinePredictionType(&self, inline_prediction_type: NSTextInputTraitType);
1652
1653        #[cfg(feature = "NSTextCheckingClient")]
1654        #[unsafe(method(mathExpressionCompletionType))]
1655        #[unsafe(method_family = none)]
1656        pub fn mathExpressionCompletionType(&self) -> NSTextInputTraitType;
1657
1658        #[cfg(feature = "NSTextCheckingClient")]
1659        /// Setter for [`mathExpressionCompletionType`][Self::mathExpressionCompletionType].
1660        #[unsafe(method(setMathExpressionCompletionType:))]
1661        #[unsafe(method_family = none)]
1662        pub fn setMathExpressionCompletionType(
1663            &self,
1664            math_expression_completion_type: NSTextInputTraitType,
1665        );
1666    );
1667}
1668
1669/// NSQuickLookPreview.
1670#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1671impl NSTextView {
1672    extern_methods!(
1673        /// ************************* Quick Look support **************************
1674        ///
1675        /// # Safety
1676        ///
1677        /// `sender` should be of the correct type.
1678        #[unsafe(method(toggleQuickLookPreviewPanel:))]
1679        #[unsafe(method_family = none)]
1680        pub unsafe fn toggleQuickLookPreviewPanel(&self, sender: Option<&AnyObject>);
1681
1682        #[unsafe(method(updateQuickLookPreviewPanel))]
1683        #[unsafe(method_family = none)]
1684        pub fn updateQuickLookPreviewPanel(&self);
1685    );
1686}
1687
1688/// NSTextView_SharingService.
1689#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1690impl NSTextView {
1691    extern_methods!(
1692        /// ************************* NSSharingService support **************************
1693        ///
1694        /// # Safety
1695        ///
1696        /// `sender` should be of the correct type.
1697        #[unsafe(method(orderFrontSharingServicePicker:))]
1698        #[unsafe(method_family = none)]
1699        pub unsafe fn orderFrontSharingServicePicker(&self, sender: Option<&AnyObject>);
1700    );
1701}
1702
1703/// NSTextView_TouchBar.
1704#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1705impl NSTextView {
1706    extern_methods!(
1707        #[unsafe(method(isAutomaticTextCompletionEnabled))]
1708        #[unsafe(method_family = none)]
1709        pub fn isAutomaticTextCompletionEnabled(&self) -> bool;
1710
1711        /// Setter for [`isAutomaticTextCompletionEnabled`][Self::isAutomaticTextCompletionEnabled].
1712        #[unsafe(method(setAutomaticTextCompletionEnabled:))]
1713        #[unsafe(method_family = none)]
1714        pub fn setAutomaticTextCompletionEnabled(&self, automatic_text_completion_enabled: bool);
1715
1716        /// # Safety
1717        ///
1718        /// `sender` should be of the correct type.
1719        #[unsafe(method(toggleAutomaticTextCompletion:))]
1720        #[unsafe(method_family = none)]
1721        pub unsafe fn toggleAutomaticTextCompletion(&self, sender: Option<&AnyObject>);
1722
1723        #[unsafe(method(allowsCharacterPickerTouchBarItem))]
1724        #[unsafe(method_family = none)]
1725        pub fn allowsCharacterPickerTouchBarItem(&self) -> bool;
1726
1727        /// Setter for [`allowsCharacterPickerTouchBarItem`][Self::allowsCharacterPickerTouchBarItem].
1728        #[unsafe(method(setAllowsCharacterPickerTouchBarItem:))]
1729        #[unsafe(method_family = none)]
1730        pub fn setAllowsCharacterPickerTouchBarItem(
1731            &self,
1732            allows_character_picker_touch_bar_item: bool,
1733        );
1734
1735        #[unsafe(method(updateTouchBarItemIdentifiers))]
1736        #[unsafe(method_family = none)]
1737        pub fn updateTouchBarItemIdentifiers(&self);
1738
1739        #[unsafe(method(updateTextTouchBarItems))]
1740        #[unsafe(method_family = none)]
1741        pub fn updateTextTouchBarItems(&self);
1742
1743        #[unsafe(method(updateCandidates))]
1744        #[unsafe(method_family = none)]
1745        pub fn updateCandidates(&self);
1746
1747        #[cfg(all(feature = "NSCandidateListTouchBarItem", feature = "NSTouchBarItem"))]
1748        #[unsafe(method(candidateListTouchBarItem))]
1749        #[unsafe(method_family = none)]
1750        pub fn candidateListTouchBarItem(&self) -> Option<Retained<NSCandidateListTouchBarItem>>;
1751    );
1752}
1753
1754#[cfg(all(
1755    feature = "NSCandidateListTouchBarItem",
1756    feature = "NSResponder",
1757    feature = "NSText",
1758    feature = "NSView"
1759))]
1760extern_conformance!(
1761    unsafe impl NSCandidateListTouchBarItemDelegate for NSTextView {}
1762);
1763
1764#[cfg(all(
1765    feature = "NSResponder",
1766    feature = "NSText",
1767    feature = "NSTouchBar",
1768    feature = "NSView"
1769))]
1770extern_conformance!(
1771    unsafe impl NSTouchBarDelegate for NSTextView {}
1772);
1773
1774/// NSTextView_Factory.
1775#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1776impl NSTextView {
1777    extern_methods!(
1778        #[cfg(feature = "NSScrollView")]
1779        #[unsafe(method(scrollableTextView))]
1780        #[unsafe(method_family = none)]
1781        pub fn scrollableTextView(mtm: MainThreadMarker) -> Retained<NSScrollView>;
1782
1783        #[unsafe(method(fieldEditor))]
1784        #[unsafe(method_family = none)]
1785        pub fn fieldEditor(mtm: MainThreadMarker) -> Retained<Self>;
1786
1787        #[cfg(feature = "NSScrollView")]
1788        #[unsafe(method(scrollableDocumentContentTextView))]
1789        #[unsafe(method_family = none)]
1790        pub fn scrollableDocumentContentTextView(mtm: MainThreadMarker) -> Retained<NSScrollView>;
1791
1792        #[cfg(feature = "NSScrollView")]
1793        #[unsafe(method(scrollablePlainDocumentContentTextView))]
1794        #[unsafe(method_family = none)]
1795        pub fn scrollablePlainDocumentContentTextView(
1796            mtm: MainThreadMarker,
1797        ) -> Retained<NSScrollView>;
1798    );
1799}
1800
1801/// NSTextView_TextHighlight.
1802#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1803impl NSTextView {
1804    extern_methods!(
1805        /// ************************* Text Highlight  support **************************
1806        #[unsafe(method(textHighlightAttributes))]
1807        #[unsafe(method_family = none)]
1808        pub fn textHighlightAttributes(
1809            &self,
1810        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
1811
1812        /// Setter for [`textHighlightAttributes`][Self::textHighlightAttributes].
1813        ///
1814        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1815        ///
1816        /// # Safety
1817        ///
1818        /// `text_highlight_attributes` generic should be of the correct type.
1819        #[unsafe(method(setTextHighlightAttributes:))]
1820        #[unsafe(method_family = none)]
1821        pub unsafe fn setTextHighlightAttributes(
1822            &self,
1823            text_highlight_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
1824        );
1825
1826        #[cfg(feature = "NSTextRange")]
1827        #[unsafe(method(drawTextHighlightBackgroundForTextRange:origin:))]
1828        #[unsafe(method_family = none)]
1829        pub fn drawTextHighlightBackgroundForTextRange_origin(
1830            &self,
1831            text_range: &NSTextRange,
1832            origin: NSPoint,
1833        );
1834
1835        /// An action for toggling `NSTextHighlightStyleAttributeName` in the receiver’s selected range.
1836        /// The sender should be a menu item with a `representedObject` of type (`NSTextHighlightColorScheme`).
1837        ///
1838        /// # Safety
1839        ///
1840        /// `sender` should be of the correct type.
1841        #[unsafe(method(highlight:))]
1842        #[unsafe(method_family = none)]
1843        pub unsafe fn highlight(&self, sender: Option<&AnyObject>);
1844    );
1845}
1846
1847/// NSDeprecated.
1848#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
1849impl NSTextView {
1850    extern_methods!(
1851        /// # Safety
1852        ///
1853        /// `sender` should be of the correct type.
1854        #[deprecated = "Use NSResponder's makeBaseWritingDirectionNatural:, makeBaseWritingDirectionLeftToRight:, and makeBaseWritingDirectionRightToLeft: instead"]
1855        #[unsafe(method(toggleBaseWritingDirection:))]
1856        #[unsafe(method_family = none)]
1857        pub unsafe fn toggleBaseWritingDirection(&self, sender: Option<&AnyObject>);
1858    );
1859}
1860
1861extern_protocol!(
1862    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewdelegate?language=objc)
1863    #[cfg(feature = "NSText")]
1864    pub unsafe trait NSTextViewDelegate: NSTextDelegate {
1865        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1866        /// # Safety
1867        ///
1868        /// `link` should be of the correct type.
1869        #[optional]
1870        #[unsafe(method(textView:clickedOnLink:atIndex:))]
1871        #[unsafe(method_family = none)]
1872        unsafe fn textView_clickedOnLink_atIndex(
1873            &self,
1874            text_view: &NSTextView,
1875            link: &AnyObject,
1876            char_index: NSUInteger,
1877        ) -> bool;
1878
1879        #[cfg(all(
1880            feature = "NSResponder",
1881            feature = "NSTextAttachmentCell",
1882            feature = "NSView"
1883        ))]
1884        #[optional]
1885        #[unsafe(method(textView:clickedOnCell:inRect:atIndex:))]
1886        #[unsafe(method_family = none)]
1887        fn textView_clickedOnCell_inRect_atIndex(
1888            &self,
1889            text_view: &NSTextView,
1890            cell: &ProtocolObject<dyn NSTextAttachmentCellProtocol>,
1891            cell_frame: NSRect,
1892            char_index: NSUInteger,
1893        );
1894
1895        #[cfg(all(
1896            feature = "NSResponder",
1897            feature = "NSTextAttachmentCell",
1898            feature = "NSView"
1899        ))]
1900        #[optional]
1901        #[unsafe(method(textView:doubleClickedOnCell:inRect:atIndex:))]
1902        #[unsafe(method_family = none)]
1903        fn textView_doubleClickedOnCell_inRect_atIndex(
1904            &self,
1905            text_view: &NSTextView,
1906            cell: &ProtocolObject<dyn NSTextAttachmentCellProtocol>,
1907            cell_frame: NSRect,
1908            char_index: NSUInteger,
1909        );
1910
1911        #[cfg(all(
1912            feature = "NSEvent",
1913            feature = "NSResponder",
1914            feature = "NSTextAttachmentCell",
1915            feature = "NSView"
1916        ))]
1917        #[optional]
1918        #[unsafe(method(textView:draggedCell:inRect:event:atIndex:))]
1919        #[unsafe(method_family = none)]
1920        fn textView_draggedCell_inRect_event_atIndex(
1921            &self,
1922            view: &NSTextView,
1923            cell: &ProtocolObject<dyn NSTextAttachmentCellProtocol>,
1924            rect: NSRect,
1925            event: &NSEvent,
1926            char_index: NSUInteger,
1927        );
1928
1929        #[cfg(all(
1930            feature = "NSPasteboard",
1931            feature = "NSResponder",
1932            feature = "NSTextAttachmentCell",
1933            feature = "NSView"
1934        ))]
1935        #[optional]
1936        #[unsafe(method(textView:writablePasteboardTypesForCell:atIndex:))]
1937        #[unsafe(method_family = none)]
1938        fn textView_writablePasteboardTypesForCell_atIndex(
1939            &self,
1940            view: &NSTextView,
1941            cell: &ProtocolObject<dyn NSTextAttachmentCellProtocol>,
1942            char_index: NSUInteger,
1943        ) -> Retained<NSArray<NSPasteboardType>>;
1944
1945        #[cfg(all(
1946            feature = "NSPasteboard",
1947            feature = "NSResponder",
1948            feature = "NSTextAttachmentCell",
1949            feature = "NSView"
1950        ))]
1951        #[optional]
1952        #[unsafe(method(textView:writeCell:atIndex:toPasteboard:type:))]
1953        #[unsafe(method_family = none)]
1954        fn textView_writeCell_atIndex_toPasteboard_type(
1955            &self,
1956            view: &NSTextView,
1957            cell: &ProtocolObject<dyn NSTextAttachmentCellProtocol>,
1958            char_index: NSUInteger,
1959            pboard: &NSPasteboard,
1960            r#type: &NSPasteboardType,
1961        ) -> bool;
1962
1963        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1964        #[optional]
1965        #[unsafe(method(textView:willChangeSelectionFromCharacterRange:toCharacterRange:))]
1966        #[unsafe(method_family = none)]
1967        fn textView_willChangeSelectionFromCharacterRange_toCharacterRange(
1968            &self,
1969            text_view: &NSTextView,
1970            old_selected_char_range: NSRange,
1971            new_selected_char_range: NSRange,
1972        ) -> NSRange;
1973
1974        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1975        #[optional]
1976        #[unsafe(method(textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:))]
1977        #[unsafe(method_family = none)]
1978        fn textView_willChangeSelectionFromCharacterRanges_toCharacterRanges(
1979            &self,
1980            text_view: &NSTextView,
1981            old_selected_char_ranges: &NSArray<NSValue>,
1982            new_selected_char_ranges: &NSArray<NSValue>,
1983        ) -> Retained<NSArray<NSValue>>;
1984
1985        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1986        #[optional]
1987        #[unsafe(method(textView:shouldChangeTextInRanges:replacementStrings:))]
1988        #[unsafe(method_family = none)]
1989        fn textView_shouldChangeTextInRanges_replacementStrings(
1990            &self,
1991            text_view: &NSTextView,
1992            affected_ranges: &NSArray<NSValue>,
1993            replacement_strings: Option<&NSArray<NSString>>,
1994        ) -> bool;
1995
1996        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
1997        /// # Safety
1998        ///
1999        /// - `old_typing_attributes` generic should be of the correct type.
2000        /// - `new_typing_attributes` generic should be of the correct type.
2001        #[optional]
2002        #[unsafe(method(textView:shouldChangeTypingAttributes:toAttributes:))]
2003        #[unsafe(method_family = none)]
2004        unsafe fn textView_shouldChangeTypingAttributes_toAttributes(
2005            &self,
2006            text_view: &NSTextView,
2007            old_typing_attributes: &NSDictionary<NSString, AnyObject>,
2008            new_typing_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
2009        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
2010
2011        #[optional]
2012        #[unsafe(method(textViewDidChangeSelection:))]
2013        #[unsafe(method_family = none)]
2014        fn textViewDidChangeSelection(&self, notification: &NSNotification);
2015
2016        #[optional]
2017        #[unsafe(method(textViewDidChangeTypingAttributes:))]
2018        #[unsafe(method_family = none)]
2019        fn textViewDidChangeTypingAttributes(&self, notification: &NSNotification);
2020
2021        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2022        #[optional]
2023        #[unsafe(method(textView:willDisplayToolTip:forCharacterAtIndex:))]
2024        #[unsafe(method_family = none)]
2025        fn textView_willDisplayToolTip_forCharacterAtIndex(
2026            &self,
2027            text_view: &NSTextView,
2028            tooltip: &NSString,
2029            character_index: NSUInteger,
2030        ) -> Option<Retained<NSString>>;
2031
2032        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2033        /// # Safety
2034        ///
2035        /// `index` must be a valid pointer or null.
2036        #[optional]
2037        #[unsafe(method(textView:completions:forPartialWordRange:indexOfSelectedItem:))]
2038        #[unsafe(method_family = none)]
2039        unsafe fn textView_completions_forPartialWordRange_indexOfSelectedItem(
2040            &self,
2041            text_view: &NSTextView,
2042            words: &NSArray<NSString>,
2043            char_range: NSRange,
2044            index: *mut NSInteger,
2045        ) -> Retained<NSArray<NSString>>;
2046
2047        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2048        #[optional]
2049        #[unsafe(method(textView:shouldChangeTextInRange:replacementString:))]
2050        #[unsafe(method_family = none)]
2051        fn textView_shouldChangeTextInRange_replacementString(
2052            &self,
2053            text_view: &NSTextView,
2054            affected_char_range: NSRange,
2055            replacement_string: Option<&NSString>,
2056        ) -> bool;
2057
2058        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2059        /// # Safety
2060        ///
2061        /// `command_selector` must be a valid selector.
2062        #[optional]
2063        #[unsafe(method(textView:doCommandBySelector:))]
2064        #[unsafe(method_family = none)]
2065        unsafe fn textView_doCommandBySelector(
2066            &self,
2067            text_view: &NSTextView,
2068            command_selector: Sel,
2069        ) -> bool;
2070
2071        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2072        #[optional]
2073        #[unsafe(method(textView:shouldSetSpellingState:range:))]
2074        #[unsafe(method_family = none)]
2075        fn textView_shouldSetSpellingState_range(
2076            &self,
2077            text_view: &NSTextView,
2078            value: NSInteger,
2079            affected_char_range: NSRange,
2080        ) -> NSInteger;
2081
2082        #[cfg(all(
2083            feature = "NSEvent",
2084            feature = "NSMenu",
2085            feature = "NSResponder",
2086            feature = "NSView"
2087        ))]
2088        #[optional]
2089        #[unsafe(method(textView:menu:forEvent:atIndex:))]
2090        #[unsafe(method_family = none)]
2091        fn textView_menu_forEvent_atIndex(
2092            &self,
2093            view: &NSTextView,
2094            menu: &NSMenu,
2095            event: &NSEvent,
2096            char_index: NSUInteger,
2097        ) -> Option<Retained<NSMenu>>;
2098
2099        #[cfg(all(
2100            feature = "NSResponder",
2101            feature = "NSSpellChecker",
2102            feature = "NSView"
2103        ))]
2104        /// # Safety
2105        ///
2106        /// - `options` generic should be of the correct type.
2107        /// - `checking_types` must be a valid pointer.
2108        #[optional]
2109        #[unsafe(method(textView:willCheckTextInRange:options:types:))]
2110        #[unsafe(method_family = none)]
2111        unsafe fn textView_willCheckTextInRange_options_types(
2112            &self,
2113            view: &NSTextView,
2114            range: NSRange,
2115            options: &NSDictionary<NSTextCheckingOptionKey, AnyObject>,
2116            checking_types: NonNull<NSTextCheckingTypes>,
2117        ) -> Retained<NSDictionary<NSTextCheckingOptionKey, AnyObject>>;
2118
2119        #[cfg(all(
2120            feature = "NSResponder",
2121            feature = "NSSpellChecker",
2122            feature = "NSView"
2123        ))]
2124        /// # Safety
2125        ///
2126        /// `options` generic should be of the correct type.
2127        #[optional]
2128        #[unsafe(method(textView:didCheckTextInRange:types:options:results:orthography:wordCount:))]
2129        #[unsafe(method_family = none)]
2130        unsafe fn textView_didCheckTextInRange_types_options_results_orthography_wordCount(
2131            &self,
2132            view: &NSTextView,
2133            range: NSRange,
2134            checking_types: NSTextCheckingTypes,
2135            options: &NSDictionary<NSTextCheckingOptionKey, AnyObject>,
2136            results: &NSArray<NSTextCheckingResult>,
2137            orthography: &NSOrthography,
2138            word_count: NSInteger,
2139        ) -> Retained<NSArray<NSTextCheckingResult>>;
2140
2141        #[cfg(all(
2142            feature = "NSResponder",
2143            feature = "NSTextAttachment",
2144            feature = "NSView"
2145        ))]
2146        #[optional]
2147        #[unsafe(method(textView:URLForContentsOfTextAttachment:atIndex:))]
2148        #[unsafe(method_family = none)]
2149        fn textView_URLForContentsOfTextAttachment_atIndex(
2150            &self,
2151            text_view: &NSTextView,
2152            text_attachment: &NSTextAttachment,
2153            char_index: NSUInteger,
2154        ) -> Option<Retained<NSURL>>;
2155
2156        #[cfg(all(
2157            feature = "NSResponder",
2158            feature = "NSSharingService",
2159            feature = "NSView"
2160        ))]
2161        /// # Safety
2162        ///
2163        /// `items` generic should be of the correct type.
2164        #[optional]
2165        #[unsafe(method(textView:willShowSharingServicePicker:forItems:))]
2166        #[unsafe(method_family = none)]
2167        unsafe fn textView_willShowSharingServicePicker_forItems(
2168            &self,
2169            text_view: &NSTextView,
2170            service_picker: &NSSharingServicePicker,
2171            items: &NSArray,
2172        ) -> Option<Retained<NSSharingServicePicker>>;
2173
2174        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2175        #[optional]
2176        #[unsafe(method(undoManagerForTextView:))]
2177        #[unsafe(method_family = none)]
2178        fn undoManagerForTextView(&self, view: &NSTextView) -> Option<Retained<NSUndoManager>>;
2179
2180        #[cfg(all(
2181            feature = "NSResponder",
2182            feature = "NSTouchBarItem",
2183            feature = "NSView"
2184        ))]
2185        #[optional]
2186        #[unsafe(method(textView:shouldUpdateTouchBarItemIdentifiers:))]
2187        #[unsafe(method_family = none)]
2188        fn textView_shouldUpdateTouchBarItemIdentifiers(
2189            &self,
2190            text_view: &NSTextView,
2191            identifiers: &NSArray<NSTouchBarItemIdentifier>,
2192        ) -> Retained<NSArray<NSTouchBarItemIdentifier>>;
2193
2194        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2195        #[optional]
2196        #[unsafe(method(textView:candidatesForSelectedRange:))]
2197        #[unsafe(method_family = none)]
2198        fn textView_candidatesForSelectedRange(
2199            &self,
2200            text_view: &NSTextView,
2201            selected_range: NSRange,
2202        ) -> Option<Retained<NSArray>>;
2203
2204        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2205        #[optional]
2206        #[unsafe(method(textView:candidates:forSelectedRange:))]
2207        #[unsafe(method_family = none)]
2208        fn textView_candidates_forSelectedRange(
2209            &self,
2210            text_view: &NSTextView,
2211            candidates: &NSArray<NSTextCheckingResult>,
2212            selected_range: NSRange,
2213        ) -> Retained<NSArray<NSTextCheckingResult>>;
2214
2215        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2216        #[optional]
2217        #[unsafe(method(textView:shouldSelectCandidateAtIndex:))]
2218        #[unsafe(method_family = none)]
2219        fn textView_shouldSelectCandidateAtIndex(
2220            &self,
2221            text_view: &NSTextView,
2222            index: NSUInteger,
2223        ) -> bool;
2224
2225        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2226        #[optional]
2227        #[unsafe(method(textViewWritingToolsWillBegin:))]
2228        #[unsafe(method_family = none)]
2229        fn textViewWritingToolsWillBegin(&self, text_view: &NSTextView);
2230
2231        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2232        #[optional]
2233        #[unsafe(method(textViewWritingToolsDidEnd:))]
2234        #[unsafe(method_family = none)]
2235        fn textViewWritingToolsDidEnd(&self, text_view: &NSTextView);
2236
2237        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2238        #[optional]
2239        #[unsafe(method(textView:writingToolsIgnoredRangesInEnclosingRange:))]
2240        #[unsafe(method_family = none)]
2241        fn textView_writingToolsIgnoredRangesInEnclosingRange(
2242            &self,
2243            text_view: &NSTextView,
2244            enclosing_range: NSRange,
2245        ) -> Retained<NSArray<NSValue>>;
2246
2247        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
2248        /// # Safety
2249        ///
2250        /// - `link` should be of the correct type.
2251        /// - `link` might not allow `None`.
2252        #[deprecated = "Use -textView:clickedOnLink:atIndex: instead"]
2253        #[optional]
2254        #[unsafe(method(textView:clickedOnLink:))]
2255        #[unsafe(method_family = none)]
2256        unsafe fn textView_clickedOnLink(
2257            &self,
2258            text_view: &NSTextView,
2259            link: Option<&AnyObject>,
2260        ) -> bool;
2261
2262        #[cfg(all(
2263            feature = "NSResponder",
2264            feature = "NSTextAttachmentCell",
2265            feature = "NSView"
2266        ))]
2267        /// # Safety
2268        ///
2269        /// `cell` might not allow `None`.
2270        #[deprecated = "Use -textView:clickedOnCell:inRect:atIndex: instead"]
2271        #[optional]
2272        #[unsafe(method(textView:clickedOnCell:inRect:))]
2273        #[unsafe(method_family = none)]
2274        unsafe fn textView_clickedOnCell_inRect(
2275            &self,
2276            text_view: &NSTextView,
2277            cell: Option<&ProtocolObject<dyn NSTextAttachmentCellProtocol>>,
2278            cell_frame: NSRect,
2279        );
2280
2281        #[cfg(all(
2282            feature = "NSResponder",
2283            feature = "NSTextAttachmentCell",
2284            feature = "NSView"
2285        ))]
2286        /// # Safety
2287        ///
2288        /// `cell` might not allow `None`.
2289        #[deprecated = "Use -textView:doubleClickedOnCell:inRect:atIndex: instead"]
2290        #[optional]
2291        #[unsafe(method(textView:doubleClickedOnCell:inRect:))]
2292        #[unsafe(method_family = none)]
2293        unsafe fn textView_doubleClickedOnCell_inRect(
2294            &self,
2295            text_view: &NSTextView,
2296            cell: Option<&ProtocolObject<dyn NSTextAttachmentCellProtocol>>,
2297            cell_frame: NSRect,
2298        );
2299
2300        #[cfg(all(
2301            feature = "NSEvent",
2302            feature = "NSResponder",
2303            feature = "NSTextAttachmentCell",
2304            feature = "NSView"
2305        ))]
2306        /// # Safety
2307        ///
2308        /// - `cell` might not allow `None`.
2309        /// - `event` might not allow `None`.
2310        #[deprecated = "Use -textView:draggedCell:inRect:event:atIndex: instead"]
2311        #[optional]
2312        #[unsafe(method(textView:draggedCell:inRect:event:))]
2313        #[unsafe(method_family = none)]
2314        unsafe fn textView_draggedCell_inRect_event(
2315            &self,
2316            view: &NSTextView,
2317            cell: Option<&ProtocolObject<dyn NSTextAttachmentCellProtocol>>,
2318            rect: NSRect,
2319            event: Option<&NSEvent>,
2320        );
2321    }
2322);
2323
2324extern "C" {
2325    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifiercharacterpicker?language=objc)
2326    #[cfg(feature = "NSTouchBarItem")]
2327    pub static NSTouchBarItemIdentifierCharacterPicker: &'static NSTouchBarItemIdentifier;
2328}
2329
2330extern "C" {
2331    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifiertextcolorpicker?language=objc)
2332    #[cfg(feature = "NSTouchBarItem")]
2333    pub static NSTouchBarItemIdentifierTextColorPicker: &'static NSTouchBarItemIdentifier;
2334}
2335
2336extern "C" {
2337    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifiertextstyle?language=objc)
2338    #[cfg(feature = "NSTouchBarItem")]
2339    pub static NSTouchBarItemIdentifierTextStyle: &'static NSTouchBarItemIdentifier;
2340}
2341
2342extern "C" {
2343    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifiertextalignment?language=objc)
2344    #[cfg(feature = "NSTouchBarItem")]
2345    pub static NSTouchBarItemIdentifierTextAlignment: &'static NSTouchBarItemIdentifier;
2346}
2347
2348extern "C" {
2349    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifiertextlist?language=objc)
2350    #[cfg(feature = "NSTouchBarItem")]
2351    pub static NSTouchBarItemIdentifierTextList: &'static NSTouchBarItemIdentifier;
2352}
2353
2354extern "C" {
2355    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstouchbaritemidentifiertextformat?language=objc)
2356    #[cfg(feature = "NSTouchBarItem")]
2357    pub static NSTouchBarItemIdentifierTextFormat: &'static NSTouchBarItemIdentifier;
2358}
2359
2360extern "C" {
2361    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewwillchangenotifyingtextviewnotification?language=objc)
2362    pub static NSTextViewWillChangeNotifyingTextViewNotification: &'static NSNotificationName;
2363}
2364
2365extern "C" {
2366    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewdidchangeselectionnotification?language=objc)
2367    pub static NSTextViewDidChangeSelectionNotification: &'static NSNotificationName;
2368}
2369
2370extern "C" {
2371    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewdidchangetypingattributesnotification?language=objc)
2372    pub static NSTextViewDidChangeTypingAttributesNotification: &'static NSNotificationName;
2373}
2374
2375extern "C" {
2376    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewwillswitchtonslayoutmanagernotification?language=objc)
2377    pub static NSTextViewWillSwitchToNSLayoutManagerNotification: &'static NSNotificationName;
2378}
2379
2380extern "C" {
2381    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewdidswitchtonslayoutmanagernotification?language=objc)
2382    pub static NSTextViewDidSwitchToNSLayoutManagerNotification: &'static NSNotificationName;
2383}
2384
2385/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindpanelaction?language=objc)
2386// NS_ENUM
2387#[repr(transparent)]
2388#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2389pub struct NSFindPanelAction(pub NSUInteger);
2390impl NSFindPanelAction {
2391    #[doc(alias = "NSFindPanelActionShowFindPanel")]
2392    pub const ShowFindPanel: Self = Self(1);
2393    #[doc(alias = "NSFindPanelActionNext")]
2394    pub const Next: Self = Self(2);
2395    #[doc(alias = "NSFindPanelActionPrevious")]
2396    pub const Previous: Self = Self(3);
2397    #[doc(alias = "NSFindPanelActionReplaceAll")]
2398    pub const ReplaceAll: Self = Self(4);
2399    #[doc(alias = "NSFindPanelActionReplace")]
2400    pub const Replace: Self = Self(5);
2401    #[doc(alias = "NSFindPanelActionReplaceAndFind")]
2402    pub const ReplaceAndFind: Self = Self(6);
2403    #[doc(alias = "NSFindPanelActionSetFindString")]
2404    pub const SetFindString: Self = Self(7);
2405    #[doc(alias = "NSFindPanelActionReplaceAllInSelection")]
2406    pub const ReplaceAllInSelection: Self = Self(8);
2407    #[doc(alias = "NSFindPanelActionSelectAll")]
2408    pub const SelectAll: Self = Self(9);
2409    #[doc(alias = "NSFindPanelActionSelectAllInSelection")]
2410    pub const SelectAllInSelection: Self = Self(10);
2411}
2412
2413unsafe impl Encode for NSFindPanelAction {
2414    const ENCODING: Encoding = NSUInteger::ENCODING;
2415}
2416
2417unsafe impl RefEncode for NSFindPanelAction {
2418    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2419}
2420
2421extern "C" {
2422    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindpanelsearchoptionspboardtype?language=objc)
2423    #[cfg(feature = "NSPasteboard")]
2424    pub static NSFindPanelSearchOptionsPboardType: &'static NSPasteboardType;
2425}
2426
2427/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspasteboardtypefindpanelsearchoptionkey?language=objc)
2428// NS_TYPED_ENUM
2429pub type NSPasteboardTypeFindPanelSearchOptionKey = NSString;
2430
2431extern "C" {
2432    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindpanelcaseinsensitivesearch?language=objc)
2433    pub static NSFindPanelCaseInsensitiveSearch: &'static NSPasteboardTypeFindPanelSearchOptionKey;
2434}
2435
2436extern "C" {
2437    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindpanelsubstringmatch?language=objc)
2438    pub static NSFindPanelSubstringMatch: &'static NSPasteboardTypeFindPanelSearchOptionKey;
2439}
2440
2441/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindpanelsubstringmatchtype?language=objc)
2442// NS_ENUM
2443#[repr(transparent)]
2444#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2445pub struct NSFindPanelSubstringMatchType(pub NSUInteger);
2446impl NSFindPanelSubstringMatchType {
2447    #[doc(alias = "NSFindPanelSubstringMatchTypeContains")]
2448    pub const Contains: Self = Self(0);
2449    #[doc(alias = "NSFindPanelSubstringMatchTypeStartsWith")]
2450    pub const StartsWith: Self = Self(1);
2451    #[doc(alias = "NSFindPanelSubstringMatchTypeFullWord")]
2452    pub const FullWord: Self = Self(2);
2453    #[doc(alias = "NSFindPanelSubstringMatchTypeEndsWith")]
2454    pub const EndsWith: Self = Self(3);
2455}
2456
2457unsafe impl Encode for NSFindPanelSubstringMatchType {
2458    const ENCODING: Encoding = NSUInteger::ENCODING;
2459}
2460
2461unsafe impl RefEncode for NSFindPanelSubstringMatchType {
2462    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2463}