objc2_app_kit/generated/
NSText.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswritingdirection?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSWritingDirection(pub NSInteger);
15impl NSWritingDirection {
16    #[doc(alias = "NSWritingDirectionNatural")]
17    pub const Natural: Self = Self(-1);
18    #[doc(alias = "NSWritingDirectionLeftToRight")]
19    pub const LeftToRight: Self = Self(0);
20    #[doc(alias = "NSWritingDirectionRightToLeft")]
21    pub const RightToLeft: Self = Self(1);
22}
23
24unsafe impl Encode for NSWritingDirection {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSWritingDirection {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextalignment?language=objc)
33// NS_ENUM
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSTextAlignment(pub NSInteger);
37impl NSTextAlignment {
38    #[doc(alias = "NSTextAlignmentLeft")]
39    pub const Left: Self = Self(0);
40    #[doc(alias = "NSTextAlignmentJustified")]
41    pub const Justified: Self = Self(3);
42    /// Resolved to either ``left`` or ``right`` based on the natural alignment resolution type active in the associated component.
43    ///
44    /// There are two types of natural alignment resolution behavior. The natural alignment is resolved based on either the UI language or the base writing direction.
45    /// The behavior is selected by the ``resolvesNaturalAlignmentWithBaseWritingDirection`` property for ``NSTextLayoutManager``.
46    /// ``NSStringDrawingOptions.resolvesNaturalAlignmentWithBaseWritingDirection`` specifies the base writing direction based resolution for ``NSStringDrawing``.
47    #[doc(alias = "NSTextAlignmentNatural")]
48    pub const Natural: Self = Self(4);
49}
50
51unsafe impl Encode for NSTextAlignment {
52    const ENCODING: Encoding = NSInteger::ENCODING;
53}
54
55unsafe impl RefEncode for NSTextAlignment {
56    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
57}
58
59extern_class!(
60    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstext?language=objc)
61    #[unsafe(super(NSView, NSResponder, NSObject))]
62    #[derive(Debug, PartialEq, Eq, Hash)]
63    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
64    pub struct NSText;
65);
66
67#[cfg(all(
68    feature = "NSAccessibilityProtocols",
69    feature = "NSResponder",
70    feature = "NSView"
71))]
72extern_conformance!(
73    unsafe impl NSAccessibility for NSText {}
74);
75
76#[cfg(all(
77    feature = "NSAccessibilityProtocols",
78    feature = "NSResponder",
79    feature = "NSView"
80))]
81extern_conformance!(
82    unsafe impl NSAccessibilityElementProtocol for NSText {}
83);
84
85#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
86extern_conformance!(
87    unsafe impl NSAnimatablePropertyContainer for NSText {}
88);
89
90#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
91extern_conformance!(
92    unsafe impl NSAppearanceCustomization for NSText {}
93);
94
95#[cfg(all(
96    feature = "NSResponder",
97    feature = "NSSpellProtocol",
98    feature = "NSView"
99))]
100extern_conformance!(
101    unsafe impl NSChangeSpelling for NSText {}
102);
103
104#[cfg(all(feature = "NSResponder", feature = "NSView"))]
105extern_conformance!(
106    unsafe impl NSCoding for NSText {}
107);
108
109#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
110extern_conformance!(
111    unsafe impl NSDraggingDestination for NSText {}
112);
113
114#[cfg(all(
115    feature = "NSResponder",
116    feature = "NSSpellProtocol",
117    feature = "NSView"
118))]
119extern_conformance!(
120    unsafe impl NSIgnoreMisspelledWords for NSText {}
121);
122
123#[cfg(all(feature = "NSResponder", feature = "NSView"))]
124extern_conformance!(
125    unsafe impl NSObjectProtocol for NSText {}
126);
127
128#[cfg(all(
129    feature = "NSResponder",
130    feature = "NSUserInterfaceItemIdentification",
131    feature = "NSView"
132))]
133extern_conformance!(
134    unsafe impl NSUserInterfaceItemIdentification for NSText {}
135);
136
137#[cfg(all(feature = "NSResponder", feature = "NSView"))]
138impl NSText {
139    extern_methods!(
140        #[unsafe(method(initWithFrame:))]
141        #[unsafe(method_family = init)]
142        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
143
144        /// # Safety
145        ///
146        /// `coder` possibly has further requirements.
147        #[unsafe(method(initWithCoder:))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn initWithCoder(
150            this: Allocated<Self>,
151            coder: &NSCoder,
152        ) -> Option<Retained<Self>>;
153
154        #[unsafe(method(string))]
155        #[unsafe(method_family = none)]
156        pub fn string(&self) -> Retained<NSString>;
157
158        /// Setter for [`string`][Self::string].
159        ///
160        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
161        #[unsafe(method(setString:))]
162        #[unsafe(method_family = none)]
163        pub fn setString(&self, string: &NSString);
164
165        #[unsafe(method(replaceCharactersInRange:withString:))]
166        #[unsafe(method_family = none)]
167        pub fn replaceCharactersInRange_withString(&self, range: NSRange, string: &NSString);
168
169        #[unsafe(method(replaceCharactersInRange:withRTF:))]
170        #[unsafe(method_family = none)]
171        pub fn replaceCharactersInRange_withRTF(&self, range: NSRange, rtf_data: &NSData);
172
173        #[unsafe(method(replaceCharactersInRange:withRTFD:))]
174        #[unsafe(method_family = none)]
175        pub fn replaceCharactersInRange_withRTFD(&self, range: NSRange, rtfd_data: &NSData);
176
177        #[unsafe(method(RTFFromRange:))]
178        #[unsafe(method_family = none)]
179        pub fn RTFFromRange(&self, range: NSRange) -> Option<Retained<NSData>>;
180
181        #[unsafe(method(RTFDFromRange:))]
182        #[unsafe(method_family = none)]
183        pub fn RTFDFromRange(&self, range: NSRange) -> Option<Retained<NSData>>;
184
185        #[unsafe(method(writeRTFDToFile:atomically:))]
186        #[unsafe(method_family = none)]
187        pub fn writeRTFDToFile_atomically(&self, path: &NSString, flag: bool) -> bool;
188
189        #[unsafe(method(readRTFDFromFile:))]
190        #[unsafe(method_family = none)]
191        pub fn readRTFDFromFile(&self, path: &NSString) -> bool;
192
193        /// # Safety
194        ///
195        /// This is not retained internally, you must ensure the object is still alive.
196        #[unsafe(method(delegate))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSTextDelegate>>>;
199
200        /// Setter for [`delegate`][Self::delegate].
201        ///
202        /// # Safety
203        ///
204        /// This is unretained, you must ensure the object is kept alive while in use.
205        #[unsafe(method(setDelegate:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSTextDelegate>>);
208
209        #[unsafe(method(isEditable))]
210        #[unsafe(method_family = none)]
211        pub fn isEditable(&self) -> bool;
212
213        /// Setter for [`isEditable`][Self::isEditable].
214        #[unsafe(method(setEditable:))]
215        #[unsafe(method_family = none)]
216        pub fn setEditable(&self, editable: bool);
217
218        #[unsafe(method(isSelectable))]
219        #[unsafe(method_family = none)]
220        pub fn isSelectable(&self) -> bool;
221
222        /// Setter for [`isSelectable`][Self::isSelectable].
223        #[unsafe(method(setSelectable:))]
224        #[unsafe(method_family = none)]
225        pub fn setSelectable(&self, selectable: bool);
226
227        #[unsafe(method(isRichText))]
228        #[unsafe(method_family = none)]
229        pub fn isRichText(&self) -> bool;
230
231        /// Setter for [`isRichText`][Self::isRichText].
232        #[unsafe(method(setRichText:))]
233        #[unsafe(method_family = none)]
234        pub fn setRichText(&self, rich_text: bool);
235
236        #[unsafe(method(importsGraphics))]
237        #[unsafe(method_family = none)]
238        pub fn importsGraphics(&self) -> bool;
239
240        /// Setter for [`importsGraphics`][Self::importsGraphics].
241        #[unsafe(method(setImportsGraphics:))]
242        #[unsafe(method_family = none)]
243        pub fn setImportsGraphics(&self, imports_graphics: bool);
244
245        #[unsafe(method(isFieldEditor))]
246        #[unsafe(method_family = none)]
247        pub fn isFieldEditor(&self) -> bool;
248
249        /// Setter for [`isFieldEditor`][Self::isFieldEditor].
250        #[unsafe(method(setFieldEditor:))]
251        #[unsafe(method_family = none)]
252        pub fn setFieldEditor(&self, field_editor: bool);
253
254        #[unsafe(method(usesFontPanel))]
255        #[unsafe(method_family = none)]
256        pub fn usesFontPanel(&self) -> bool;
257
258        /// Setter for [`usesFontPanel`][Self::usesFontPanel].
259        #[unsafe(method(setUsesFontPanel:))]
260        #[unsafe(method_family = none)]
261        pub fn setUsesFontPanel(&self, uses_font_panel: bool);
262
263        #[unsafe(method(drawsBackground))]
264        #[unsafe(method_family = none)]
265        pub fn drawsBackground(&self) -> bool;
266
267        /// Setter for [`drawsBackground`][Self::drawsBackground].
268        #[unsafe(method(setDrawsBackground:))]
269        #[unsafe(method_family = none)]
270        pub fn setDrawsBackground(&self, draws_background: bool);
271
272        #[cfg(feature = "NSColor")]
273        #[unsafe(method(backgroundColor))]
274        #[unsafe(method_family = none)]
275        pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
276
277        #[cfg(feature = "NSColor")]
278        /// Setter for [`backgroundColor`][Self::backgroundColor].
279        ///
280        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
281        #[unsafe(method(setBackgroundColor:))]
282        #[unsafe(method_family = none)]
283        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
284
285        #[unsafe(method(isRulerVisible))]
286        #[unsafe(method_family = none)]
287        pub fn isRulerVisible(&self) -> bool;
288
289        #[unsafe(method(selectedRange))]
290        #[unsafe(method_family = none)]
291        pub fn selectedRange(&self) -> NSRange;
292
293        /// Setter for [`selectedRange`][Self::selectedRange].
294        #[unsafe(method(setSelectedRange:))]
295        #[unsafe(method_family = none)]
296        pub fn setSelectedRange(&self, selected_range: NSRange);
297
298        #[unsafe(method(scrollRangeToVisible:))]
299        #[unsafe(method_family = none)]
300        pub fn scrollRangeToVisible(&self, range: NSRange);
301
302        #[cfg(feature = "NSFont")]
303        #[unsafe(method(font))]
304        #[unsafe(method_family = none)]
305        pub fn font(&self) -> Option<Retained<NSFont>>;
306
307        #[cfg(feature = "NSFont")]
308        /// Setter for [`font`][Self::font].
309        #[unsafe(method(setFont:))]
310        #[unsafe(method_family = none)]
311        pub fn setFont(&self, font: Option<&NSFont>);
312
313        #[cfg(feature = "NSColor")]
314        #[unsafe(method(textColor))]
315        #[unsafe(method_family = none)]
316        pub fn textColor(&self) -> Option<Retained<NSColor>>;
317
318        #[cfg(feature = "NSColor")]
319        /// Setter for [`textColor`][Self::textColor].
320        ///
321        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
322        #[unsafe(method(setTextColor:))]
323        #[unsafe(method_family = none)]
324        pub fn setTextColor(&self, text_color: Option<&NSColor>);
325
326        #[unsafe(method(alignment))]
327        #[unsafe(method_family = none)]
328        pub fn alignment(&self) -> NSTextAlignment;
329
330        /// Setter for [`alignment`][Self::alignment].
331        #[unsafe(method(setAlignment:))]
332        #[unsafe(method_family = none)]
333        pub fn setAlignment(&self, alignment: NSTextAlignment);
334
335        #[unsafe(method(baseWritingDirection))]
336        #[unsafe(method_family = none)]
337        pub fn baseWritingDirection(&self) -> NSWritingDirection;
338
339        /// Setter for [`baseWritingDirection`][Self::baseWritingDirection].
340        #[unsafe(method(setBaseWritingDirection:))]
341        #[unsafe(method_family = none)]
342        pub fn setBaseWritingDirection(&self, base_writing_direction: NSWritingDirection);
343
344        #[cfg(feature = "NSColor")]
345        #[unsafe(method(setTextColor:range:))]
346        #[unsafe(method_family = none)]
347        pub fn setTextColor_range(&self, color: Option<&NSColor>, range: NSRange);
348
349        #[cfg(feature = "NSFont")]
350        #[unsafe(method(setFont:range:))]
351        #[unsafe(method_family = none)]
352        pub fn setFont_range(&self, font: &NSFont, range: NSRange);
353
354        #[unsafe(method(maxSize))]
355        #[unsafe(method_family = none)]
356        pub fn maxSize(&self) -> NSSize;
357
358        /// Setter for [`maxSize`][Self::maxSize].
359        #[unsafe(method(setMaxSize:))]
360        #[unsafe(method_family = none)]
361        pub fn setMaxSize(&self, max_size: NSSize);
362
363        #[unsafe(method(minSize))]
364        #[unsafe(method_family = none)]
365        pub fn minSize(&self) -> NSSize;
366
367        /// Setter for [`minSize`][Self::minSize].
368        #[unsafe(method(setMinSize:))]
369        #[unsafe(method_family = none)]
370        pub fn setMinSize(&self, min_size: NSSize);
371
372        #[unsafe(method(isHorizontallyResizable))]
373        #[unsafe(method_family = none)]
374        pub fn isHorizontallyResizable(&self) -> bool;
375
376        /// Setter for [`isHorizontallyResizable`][Self::isHorizontallyResizable].
377        #[unsafe(method(setHorizontallyResizable:))]
378        #[unsafe(method_family = none)]
379        pub fn setHorizontallyResizable(&self, horizontally_resizable: bool);
380
381        #[unsafe(method(isVerticallyResizable))]
382        #[unsafe(method_family = none)]
383        pub fn isVerticallyResizable(&self) -> bool;
384
385        /// Setter for [`isVerticallyResizable`][Self::isVerticallyResizable].
386        #[unsafe(method(setVerticallyResizable:))]
387        #[unsafe(method_family = none)]
388        pub fn setVerticallyResizable(&self, vertically_resizable: bool);
389
390        #[unsafe(method(sizeToFit))]
391        #[unsafe(method_family = none)]
392        pub fn sizeToFit(&self);
393
394        /// # Safety
395        ///
396        /// `sender` should be of the correct type.
397        #[unsafe(method(copy:))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn copy(&self, sender: Option<&AnyObject>);
400
401        /// # Safety
402        ///
403        /// `sender` should be of the correct type.
404        #[unsafe(method(copyFont:))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn copyFont(&self, sender: Option<&AnyObject>);
407
408        /// # Safety
409        ///
410        /// `sender` should be of the correct type.
411        #[unsafe(method(copyRuler:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn copyRuler(&self, sender: Option<&AnyObject>);
414
415        /// # Safety
416        ///
417        /// `sender` should be of the correct type.
418        #[unsafe(method(cut:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn cut(&self, sender: Option<&AnyObject>);
421
422        /// # Safety
423        ///
424        /// `sender` should be of the correct type.
425        #[unsafe(method(delete:))]
426        #[unsafe(method_family = none)]
427        pub unsafe fn delete(&self, sender: Option<&AnyObject>);
428
429        /// # Safety
430        ///
431        /// `sender` should be of the correct type.
432        #[unsafe(method(paste:))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn paste(&self, sender: Option<&AnyObject>);
435
436        /// # Safety
437        ///
438        /// `sender` should be of the correct type.
439        #[unsafe(method(pasteFont:))]
440        #[unsafe(method_family = none)]
441        pub unsafe fn pasteFont(&self, sender: Option<&AnyObject>);
442
443        /// # Safety
444        ///
445        /// `sender` should be of the correct type.
446        #[unsafe(method(pasteRuler:))]
447        #[unsafe(method_family = none)]
448        pub unsafe fn pasteRuler(&self, sender: Option<&AnyObject>);
449
450        /// # Safety
451        ///
452        /// `sender` should be of the correct type.
453        #[unsafe(method(selectAll:))]
454        #[unsafe(method_family = none)]
455        pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
456
457        /// # Safety
458        ///
459        /// `sender` should be of the correct type.
460        #[unsafe(method(changeFont:))]
461        #[unsafe(method_family = none)]
462        pub unsafe fn changeFont(&self, sender: Option<&AnyObject>);
463
464        /// # Safety
465        ///
466        /// `sender` should be of the correct type.
467        #[unsafe(method(alignLeft:))]
468        #[unsafe(method_family = none)]
469        pub unsafe fn alignLeft(&self, sender: Option<&AnyObject>);
470
471        /// # Safety
472        ///
473        /// `sender` should be of the correct type.
474        #[unsafe(method(alignRight:))]
475        #[unsafe(method_family = none)]
476        pub unsafe fn alignRight(&self, sender: Option<&AnyObject>);
477
478        /// # Safety
479        ///
480        /// `sender` should be of the correct type.
481        #[unsafe(method(alignCenter:))]
482        #[unsafe(method_family = none)]
483        pub unsafe fn alignCenter(&self, sender: Option<&AnyObject>);
484
485        /// # Safety
486        ///
487        /// `sender` should be of the correct type.
488        #[unsafe(method(subscript:))]
489        #[unsafe(method_family = none)]
490        pub unsafe fn subscript(&self, sender: Option<&AnyObject>);
491
492        /// # Safety
493        ///
494        /// `sender` should be of the correct type.
495        #[unsafe(method(superscript:))]
496        #[unsafe(method_family = none)]
497        pub unsafe fn superscript(&self, sender: Option<&AnyObject>);
498
499        /// # Safety
500        ///
501        /// `sender` should be of the correct type.
502        #[unsafe(method(underline:))]
503        #[unsafe(method_family = none)]
504        pub unsafe fn underline(&self, sender: Option<&AnyObject>);
505
506        /// # Safety
507        ///
508        /// `sender` should be of the correct type.
509        #[unsafe(method(unscript:))]
510        #[unsafe(method_family = none)]
511        pub unsafe fn unscript(&self, sender: Option<&AnyObject>);
512
513        /// # Safety
514        ///
515        /// `sender` should be of the correct type.
516        #[unsafe(method(showGuessPanel:))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn showGuessPanel(&self, sender: Option<&AnyObject>);
519
520        /// # Safety
521        ///
522        /// `sender` should be of the correct type.
523        #[unsafe(method(checkSpelling:))]
524        #[unsafe(method_family = none)]
525        pub unsafe fn checkSpelling(&self, sender: Option<&AnyObject>);
526
527        /// # Safety
528        ///
529        /// `sender` should be of the correct type.
530        #[unsafe(method(toggleRuler:))]
531        #[unsafe(method_family = none)]
532        pub unsafe fn toggleRuler(&self, sender: Option<&AnyObject>);
533    );
534}
535
536/// Methods declared on superclass `NSResponder`.
537#[cfg(all(feature = "NSResponder", feature = "NSView"))]
538impl NSText {
539    extern_methods!(
540        #[unsafe(method(init))]
541        #[unsafe(method_family = init)]
542        pub fn init(this: Allocated<Self>) -> Retained<Self>;
543    );
544}
545
546/// Methods declared on superclass `NSObject`.
547#[cfg(all(feature = "NSResponder", feature = "NSView"))]
548impl NSText {
549    extern_methods!(
550        #[unsafe(method(new))]
551        #[unsafe(method_family = new)]
552        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
553    );
554}
555
556/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsentercharacter?language=objc)
557pub const NSEnterCharacter: c_uint = 0x0003;
558/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbackspacecharacter?language=objc)
559pub const NSBackspaceCharacter: c_uint = 0x0008;
560/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabcharacter?language=objc)
561pub const NSTabCharacter: c_uint = 0x0009;
562/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnewlinecharacter?language=objc)
563pub const NSNewlineCharacter: c_uint = 0x000a;
564/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsformfeedcharacter?language=objc)
565pub const NSFormFeedCharacter: c_uint = 0x000c;
566/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscarriagereturncharacter?language=objc)
567pub const NSCarriageReturnCharacter: c_uint = 0x000d;
568/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbacktabcharacter?language=objc)
569pub const NSBackTabCharacter: c_uint = 0x0019;
570/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletecharacter?language=objc)
571pub const NSDeleteCharacter: c_uint = 0x007f;
572/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslineseparatorcharacter?language=objc)
573pub const NSLineSeparatorCharacter: c_uint = 0x2028;
574/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsparagraphseparatorcharacter?language=objc)
575pub const NSParagraphSeparatorCharacter: c_uint = 0x2029;
576
577/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextmovement?language=objc)
578// NS_ENUM
579#[repr(transparent)]
580#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
581pub struct NSTextMovement(pub NSInteger);
582impl NSTextMovement {
583    #[doc(alias = "NSTextMovementReturn")]
584    pub const Return: Self = Self(0x10);
585    #[doc(alias = "NSTextMovementTab")]
586    pub const Tab: Self = Self(0x11);
587    #[doc(alias = "NSTextMovementBacktab")]
588    pub const Backtab: Self = Self(0x12);
589    #[doc(alias = "NSTextMovementLeft")]
590    pub const Left: Self = Self(0x13);
591    #[doc(alias = "NSTextMovementRight")]
592    pub const Right: Self = Self(0x14);
593    #[doc(alias = "NSTextMovementUp")]
594    pub const Up: Self = Self(0x15);
595    #[doc(alias = "NSTextMovementDown")]
596    pub const Down: Self = Self(0x16);
597    #[doc(alias = "NSTextMovementCancel")]
598    pub const Cancel: Self = Self(0x17);
599    #[doc(alias = "NSTextMovementOther")]
600    pub const Other: Self = Self(0);
601}
602
603unsafe impl Encode for NSTextMovement {
604    const ENCODING: Encoding = NSInteger::ENCODING;
605}
606
607unsafe impl RefEncode for NSTextMovement {
608    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
609}
610
611extern "C" {
612    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextdidbegineditingnotification?language=objc)
613    pub static NSTextDidBeginEditingNotification: &'static NSNotificationName;
614}
615
616extern "C" {
617    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextdidendeditingnotification?language=objc)
618    pub static NSTextDidEndEditingNotification: &'static NSNotificationName;
619}
620
621extern "C" {
622    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextdidchangenotification?language=objc)
623    pub static NSTextDidChangeNotification: &'static NSNotificationName;
624}
625
626extern "C" {
627    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextmovementuserinfokey?language=objc)
628    pub static NSTextMovementUserInfoKey: &'static NSString;
629}
630
631/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsillegaltextmovement?language=objc)
632pub const NSIllegalTextMovement: c_uint = 0;
633/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsreturntextmovement?language=objc)
634pub const NSReturnTextMovement: c_uint = 0x10;
635/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabtextmovement?language=objc)
636pub const NSTabTextMovement: c_uint = 0x11;
637/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbacktabtextmovement?language=objc)
638pub const NSBacktabTextMovement: c_uint = 0x12;
639/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslefttextmovement?language=objc)
640pub const NSLeftTextMovement: c_uint = 0x13;
641/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrighttextmovement?language=objc)
642pub const NSRightTextMovement: c_uint = 0x14;
643/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuptextmovement?language=objc)
644pub const NSUpTextMovement: c_uint = 0x15;
645/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdowntextmovement?language=objc)
646pub const NSDownTextMovement: c_uint = 0x16;
647/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscanceltextmovement?language=objc)
648pub const NSCancelTextMovement: c_uint = 0x17;
649/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothertextmovement?language=objc)
650pub const NSOtherTextMovement: c_uint = 0;
651
652extern_protocol!(
653    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextdelegate?language=objc)
654    pub unsafe trait NSTextDelegate: NSObjectProtocol + MainThreadOnly {
655        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
656        #[optional]
657        #[unsafe(method(textShouldBeginEditing:))]
658        #[unsafe(method_family = none)]
659        fn textShouldBeginEditing(&self, text_object: &NSText) -> bool;
660
661        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
662        #[optional]
663        #[unsafe(method(textShouldEndEditing:))]
664        #[unsafe(method_family = none)]
665        fn textShouldEndEditing(&self, text_object: &NSText) -> bool;
666
667        #[optional]
668        #[unsafe(method(textDidBeginEditing:))]
669        #[unsafe(method_family = none)]
670        fn textDidBeginEditing(&self, notification: &NSNotification);
671
672        #[optional]
673        #[unsafe(method(textDidEndEditing:))]
674        #[unsafe(method_family = none)]
675        fn textDidEndEditing(&self, notification: &NSNotification);
676
677        #[optional]
678        #[unsafe(method(textDidChange:))]
679        #[unsafe(method_family = none)]
680        fn textDidChange(&self, notification: &NSNotification);
681    }
682);
683
684/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextwritingdirectionembedding?language=objc)
685#[deprecated = "Use NSWritingDirectionEmbedding instead"]
686pub const NSTextWritingDirectionEmbedding: c_uint = 0 << 1;
687/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextwritingdirectionoverride?language=objc)
688#[deprecated = "Use NSWritingDirectionOverride instead"]
689pub const NSTextWritingDirectionOverride: c_uint = 1 << 1;
690
691/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslefttextalignment?language=objc)
692#[deprecated]
693pub static NSLeftTextAlignment: NSTextAlignment = NSTextAlignment(NSTextAlignment::Left.0);
694
695/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrighttextalignment?language=objc)
696#[deprecated]
697pub static NSRightTextAlignment: NSTextAlignment = NSTextAlignment(NSTextAlignment::Right.0);
698
699/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscentertextalignment?language=objc)
700#[deprecated]
701pub static NSCenterTextAlignment: NSTextAlignment = NSTextAlignment(NSTextAlignment::Center.0);
702
703/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsjustifiedtextalignment?language=objc)
704#[deprecated]
705pub static NSJustifiedTextAlignment: NSTextAlignment =
706    NSTextAlignment(NSTextAlignment::Justified.0);
707
708/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnaturaltextalignment?language=objc)
709#[deprecated]
710pub static NSNaturalTextAlignment: NSTextAlignment = NSTextAlignment(NSTextAlignment::Natural.0);