objc2_app_kit/generated/
NSTextInputClient.rs1use 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#[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 pub unsafe trait NSTextInputClient {
49 #[unsafe(method(insertText:replacementRange:))]
53 #[unsafe(method_family = none)]
54 unsafe fn insertText_replacementRange(
55 &self,
56 string: &AnyObject,
57 replacement_range: NSRange,
58 );
59
60 #[unsafe(method(doCommandBySelector:))]
64 #[unsafe(method_family = none)]
65 unsafe fn doCommandBySelector(&self, selector: Sel);
66
67 #[unsafe(method(setMarkedText:selectedRange:replacementRange:))]
71 #[unsafe(method_family = none)]
72 unsafe fn setMarkedText_selectedRange_replacementRange(
73 &self,
74 string: &AnyObject,
75 selected_range: NSRange,
76 replacement_range: NSRange,
77 );
78
79 #[unsafe(method(unmarkText))]
80 #[unsafe(method_family = none)]
81 fn unmarkText(&self);
82
83 #[unsafe(method(selectedRange))]
84 #[unsafe(method_family = none)]
85 fn selectedRange(&self) -> NSRange;
86
87 #[unsafe(method(markedRange))]
88 #[unsafe(method_family = none)]
89 fn markedRange(&self) -> NSRange;
90
91 #[unsafe(method(hasMarkedText))]
92 #[unsafe(method_family = none)]
93 fn hasMarkedText(&self) -> bool;
94
95 #[unsafe(method(attributedSubstringForProposedRange:actualRange:))]
99 #[unsafe(method_family = none)]
100 unsafe fn attributedSubstringForProposedRange_actualRange(
101 &self,
102 range: NSRange,
103 actual_range: NSRangePointer,
104 ) -> Option<Retained<NSAttributedString>>;
105
106 #[unsafe(method(validAttributesForMarkedText))]
107 #[unsafe(method_family = none)]
108 fn validAttributesForMarkedText(&self) -> Retained<NSArray<NSAttributedStringKey>>;
109
110 #[unsafe(method(firstRectForCharacterRange:actualRange:))]
114 #[unsafe(method_family = none)]
115 unsafe fn firstRectForCharacterRange_actualRange(
116 &self,
117 range: NSRange,
118 actual_range: NSRangePointer,
119 ) -> NSRect;
120
121 #[unsafe(method(characterIndexForPoint:))]
122 #[unsafe(method_family = none)]
123 fn characterIndexForPoint(&self, point: NSPoint) -> NSUInteger;
124
125 #[optional]
126 #[unsafe(method(attributedString))]
127 #[unsafe(method_family = none)]
128 fn attributedString(&self) -> Retained<NSAttributedString>;
129
130 #[cfg(feature = "objc2-core-foundation")]
131 #[optional]
132 #[unsafe(method(fractionOfDistanceThroughGlyphForPoint:))]
133 #[unsafe(method_family = none)]
134 fn fractionOfDistanceThroughGlyphForPoint(&self, point: NSPoint) -> CGFloat;
135
136 #[cfg(feature = "objc2-core-foundation")]
137 #[optional]
138 #[unsafe(method(baselineDeltaForCharacterAtIndex:))]
139 #[unsafe(method_family = none)]
140 fn baselineDeltaForCharacterAtIndex(&self, an_index: NSUInteger) -> CGFloat;
141
142 #[optional]
143 #[unsafe(method(windowLevel))]
144 #[unsafe(method_family = none)]
145 fn windowLevel(&self) -> NSInteger;
146
147 #[optional]
148 #[unsafe(method(drawsVerticallyForCharacterAtIndex:))]
149 #[unsafe(method_family = none)]
150 fn drawsVerticallyForCharacterAtIndex(&self, char_index: NSUInteger) -> bool;
151
152 #[optional]
153 #[unsafe(method(preferredTextAccessoryPlacement))]
154 #[unsafe(method_family = none)]
155 fn preferredTextAccessoryPlacement(&self) -> NSTextCursorAccessoryPlacement;
156
157 #[optional]
158 #[unsafe(method(unionRectInVisibleSelectedRange))]
159 #[unsafe(method_family = none)]
160 fn unionRectInVisibleSelectedRange(&self) -> NSRect;
161
162 #[optional]
163 #[unsafe(method(documentVisibleRect))]
164 #[unsafe(method_family = none)]
165 fn documentVisibleRect(&self) -> NSRect;
166
167 #[optional]
168 #[unsafe(method(supportsAdaptiveImageGlyph))]
169 #[unsafe(method_family = none)]
170 fn supportsAdaptiveImageGlyph(&self) -> bool;
171
172 #[cfg(feature = "NSAdaptiveImageGlyph")]
173 #[optional]
174 #[unsafe(method(insertAdaptiveImageGlyph:replacementRange:))]
175 #[unsafe(method_family = none)]
176 fn insertAdaptiveImageGlyph_replacementRange(
177 &self,
178 adaptive_image_glyph: &NSAdaptiveImageGlyph,
179 replacement_range: NSRange,
180 );
181 }
182);