objc2_app_kit/generated/
NSTextInputContext.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub type NSTextInputSourceIdentifier = NSString;
12
13extern_class!(
14 #[unsafe(super(NSObject))]
16 #[thread_kind = MainThreadOnly]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct NSTextInputContext;
19);
20
21extern_conformance!(
22 unsafe impl NSObjectProtocol for NSTextInputContext {}
23);
24
25impl NSTextInputContext {
26 extern_methods!(
27 #[unsafe(method(currentInputContext))]
28 #[unsafe(method_family = none)]
29 pub unsafe fn currentInputContext(
30 mtm: MainThreadMarker,
31 ) -> Option<Retained<NSTextInputContext>>;
32
33 #[cfg(feature = "NSTextInputClient")]
34 #[unsafe(method(initWithClient:))]
35 #[unsafe(method_family = init)]
36 pub unsafe fn initWithClient(
37 this: Allocated<Self>,
38 client: &ProtocolObject<dyn NSTextInputClient>,
39 ) -> Retained<Self>;
40
41 #[unsafe(method(init))]
42 #[unsafe(method_family = init)]
43 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
44
45 #[cfg(feature = "NSTextInputClient")]
46 #[unsafe(method(client))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn client(&self) -> Retained<ProtocolObject<dyn NSTextInputClient>>;
50
51 #[unsafe(method(acceptsGlyphInfo))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn acceptsGlyphInfo(&self) -> bool;
54
55 #[unsafe(method(setAcceptsGlyphInfo:))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn setAcceptsGlyphInfo(&self, accepts_glyph_info: bool);
59
60 #[unsafe(method(allowedInputSourceLocales))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
63
64 #[unsafe(method(setAllowedInputSourceLocales:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn setAllowedInputSourceLocales(
68 &self,
69 allowed_input_source_locales: Option<&NSArray<NSString>>,
70 );
71
72 #[unsafe(method(activate))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn activate(&self);
76
77 #[unsafe(method(deactivate))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn deactivate(&self);
80
81 #[cfg(feature = "NSEvent")]
82 #[unsafe(method(handleEvent:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn handleEvent(&self, event: &NSEvent) -> bool;
86
87 #[unsafe(method(discardMarkedText))]
88 #[unsafe(method_family = none)]
89 pub fn discardMarkedText(&self);
90
91 #[unsafe(method(invalidateCharacterCoordinates))]
92 #[unsafe(method_family = none)]
93 pub fn invalidateCharacterCoordinates(&self);
94
95 #[unsafe(method(textInputClientWillStartScrollingOrZooming))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn textInputClientWillStartScrollingOrZooming(&self);
98
99 #[unsafe(method(textInputClientDidEndScrollingOrZooming))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn textInputClientDidEndScrollingOrZooming(&self);
102
103 #[unsafe(method(textInputClientDidUpdateSelection))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn textInputClientDidUpdateSelection(&self);
106
107 #[unsafe(method(textInputClientDidScroll))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn textInputClientDidScroll(&self);
110
111 #[unsafe(method(keyboardInputSources))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn keyboardInputSources(
115 &self,
116 ) -> Option<Retained<NSArray<NSTextInputSourceIdentifier>>>;
117
118 #[unsafe(method(selectedKeyboardInputSource))]
119 #[unsafe(method_family = none)]
120 pub fn selectedKeyboardInputSource(&self) -> Option<Retained<NSTextInputSourceIdentifier>>;
121
122 #[unsafe(method(setSelectedKeyboardInputSource:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setSelectedKeyboardInputSource(
126 &self,
127 selected_keyboard_input_source: Option<&NSTextInputSourceIdentifier>,
128 );
129
130 #[unsafe(method(localizedNameForInputSource:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn localizedNameForInputSource(
134 input_source_identifier: &NSTextInputSourceIdentifier,
135 mtm: MainThreadMarker,
136 ) -> Option<Retained<NSString>>;
137 );
138}
139
140impl NSTextInputContext {
142 extern_methods!(
143 #[unsafe(method(new))]
144 #[unsafe(method_family = new)]
145 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
146 );
147}
148
149extern "C" {
150 pub static NSTextInputContextKeyboardSelectionDidChangeNotification:
154 &'static NSNotificationName;
155}