objc2_app_kit/generated/
NSTextInputClient.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/nstextcursoraccessoryplacement?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSTextCursorAccessoryPlacement(pub NSInteger);
17impl NSTextCursorAccessoryPlacement {
18    #[doc(alias = "NSTextCursorAccessoryPlacementUnspecified")]
19    pub const Unspecified: Self = Self(0);
20    #[doc(alias = "NSTextCursorAccessoryPlacementBackward")]
21    pub const Backward: Self = Self(1);
22    #[doc(alias = "NSTextCursorAccessoryPlacementForward")]
23    pub const Forward: Self = Self(2);
24    #[doc(alias = "NSTextCursorAccessoryPlacementInvisible")]
25    pub const Invisible: Self = Self(3);
26    #[doc(alias = "NSTextCursorAccessoryPlacementCenter")]
27    pub const Center: Self = Self(4);
28    #[doc(alias = "NSTextCursorAccessoryPlacementOffscreenLeft")]
29    pub const OffscreenLeft: Self = Self(5);
30    #[doc(alias = "NSTextCursorAccessoryPlacementOffscreenTop")]
31    pub const OffscreenTop: Self = Self(6);
32    #[doc(alias = "NSTextCursorAccessoryPlacementOffscreenRight")]
33    pub const OffscreenRight: Self = Self(7);
34    #[doc(alias = "NSTextCursorAccessoryPlacementOffscreenBottom")]
35    pub const OffscreenBottom: Self = Self(8);
36}
37
38unsafe impl Encode for NSTextCursorAccessoryPlacement {
39    const ENCODING: Encoding = NSInteger::ENCODING;
40}
41
42unsafe impl RefEncode for NSTextCursorAccessoryPlacement {
43    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
44}
45
46extern_protocol!(
47    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputclient?language=objc)
48    pub unsafe trait NSTextInputClient {
49        #[unsafe(method(insertText:replacementRange:))]
50        #[unsafe(method_family = none)]
51        unsafe fn insertText_replacementRange(
52            &self,
53            string: &AnyObject,
54            replacement_range: NSRange,
55        );
56
57        #[unsafe(method(doCommandBySelector:))]
58        #[unsafe(method_family = none)]
59        unsafe fn doCommandBySelector(&self, selector: Sel);
60
61        #[unsafe(method(setMarkedText:selectedRange:replacementRange:))]
62        #[unsafe(method_family = none)]
63        unsafe fn setMarkedText_selectedRange_replacementRange(
64            &self,
65            string: &AnyObject,
66            selected_range: NSRange,
67            replacement_range: NSRange,
68        );
69
70        #[unsafe(method(unmarkText))]
71        #[unsafe(method_family = none)]
72        unsafe fn unmarkText(&self);
73
74        #[unsafe(method(selectedRange))]
75        #[unsafe(method_family = none)]
76        unsafe fn selectedRange(&self) -> NSRange;
77
78        #[unsafe(method(markedRange))]
79        #[unsafe(method_family = none)]
80        unsafe fn markedRange(&self) -> NSRange;
81
82        #[unsafe(method(hasMarkedText))]
83        #[unsafe(method_family = none)]
84        unsafe fn hasMarkedText(&self) -> bool;
85
86        #[unsafe(method(attributedSubstringForProposedRange:actualRange:))]
87        #[unsafe(method_family = none)]
88        unsafe fn attributedSubstringForProposedRange_actualRange(
89            &self,
90            range: NSRange,
91            actual_range: NSRangePointer,
92        ) -> Option<Retained<NSAttributedString>>;
93
94        #[unsafe(method(validAttributesForMarkedText))]
95        #[unsafe(method_family = none)]
96        unsafe fn validAttributesForMarkedText(&self) -> Retained<NSArray<NSAttributedStringKey>>;
97
98        #[unsafe(method(firstRectForCharacterRange:actualRange:))]
99        #[unsafe(method_family = none)]
100        unsafe fn firstRectForCharacterRange_actualRange(
101            &self,
102            range: NSRange,
103            actual_range: NSRangePointer,
104        ) -> NSRect;
105
106        #[unsafe(method(characterIndexForPoint:))]
107        #[unsafe(method_family = none)]
108        unsafe fn characterIndexForPoint(&self, point: NSPoint) -> NSUInteger;
109
110        #[optional]
111        #[unsafe(method(attributedString))]
112        #[unsafe(method_family = none)]
113        unsafe fn attributedString(&self) -> Retained<NSAttributedString>;
114
115        #[cfg(feature = "objc2-core-foundation")]
116        #[optional]
117        #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:))]
118        #[unsafe(method_family = none)]
119        unsafe fn fractionOfDistanceThroughGlyphForPoint(&self, point: NSPoint) -> CGFloat;
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[optional]
123        #[unsafe(method(baselineDeltaForCharacterAtIndex:))]
124        #[unsafe(method_family = none)]
125        unsafe fn baselineDeltaForCharacterAtIndex(&self, an_index: NSUInteger) -> CGFloat;
126
127        #[optional]
128        #[unsafe(method(windowLevel))]
129        #[unsafe(method_family = none)]
130        unsafe fn windowLevel(&self) -> NSInteger;
131
132        #[optional]
133        #[unsafe(method(drawsVerticallyForCharacterAtIndex:))]
134        #[unsafe(method_family = none)]
135        unsafe fn drawsVerticallyForCharacterAtIndex(&self, char_index: NSUInteger) -> bool;
136
137        #[optional]
138        #[unsafe(method(preferredTextAccessoryPlacement))]
139        #[unsafe(method_family = none)]
140        unsafe fn preferredTextAccessoryPlacement(&self) -> NSTextCursorAccessoryPlacement;
141
142        #[optional]
143        #[unsafe(method(unionRectInVisibleSelectedRange))]
144        #[unsafe(method_family = none)]
145        unsafe fn unionRectInVisibleSelectedRange(&self) -> NSRect;
146
147        #[optional]
148        #[unsafe(method(documentVisibleRect))]
149        #[unsafe(method_family = none)]
150        unsafe fn documentVisibleRect(&self) -> NSRect;
151
152        #[optional]
153        #[unsafe(method(supportsAdaptiveImageGlyph))]
154        #[unsafe(method_family = none)]
155        unsafe fn supportsAdaptiveImageGlyph(&self) -> bool;
156
157        #[cfg(feature = "NSAdaptiveImageGlyph")]
158        #[optional]
159        #[unsafe(method(insertAdaptiveImageGlyph:replacementRange:))]
160        #[unsafe(method_family = none)]
161        unsafe fn insertAdaptiveImageGlyph_replacementRange(
162            &self,
163            adaptive_image_glyph: &NSAdaptiveImageGlyph,
164            replacement_range: NSRange,
165        );
166    }
167);