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 fn currentInputContext(mtm: MainThreadMarker) -> Option<Retained<NSTextInputContext>>;
30
31 #[cfg(feature = "NSTextInputClient")]
32 #[unsafe(method(initWithClient:))]
33 #[unsafe(method_family = init)]
34 pub fn initWithClient(
35 this: Allocated<Self>,
36 client: &ProtocolObject<dyn NSTextInputClient>,
37 ) -> Retained<Self>;
38
39 #[unsafe(method(init))]
40 #[unsafe(method_family = init)]
41 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
42
43 #[cfg(feature = "NSTextInputClient")]
44 #[unsafe(method(client))]
46 #[unsafe(method_family = none)]
47 pub fn client(&self) -> Retained<ProtocolObject<dyn NSTextInputClient>>;
48
49 #[unsafe(method(acceptsGlyphInfo))]
50 #[unsafe(method_family = none)]
51 pub fn acceptsGlyphInfo(&self) -> bool;
52
53 #[unsafe(method(setAcceptsGlyphInfo:))]
55 #[unsafe(method_family = none)]
56 pub fn setAcceptsGlyphInfo(&self, accepts_glyph_info: bool);
57
58 #[unsafe(method(allowedInputSourceLocales))]
59 #[unsafe(method_family = none)]
60 pub fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
61
62 #[unsafe(method(setAllowedInputSourceLocales:))]
66 #[unsafe(method_family = none)]
67 pub 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 fn activate(&self);
76
77 #[unsafe(method(deactivate))]
78 #[unsafe(method_family = none)]
79 pub fn deactivate(&self);
80
81 #[cfg(feature = "NSEvent")]
82 #[unsafe(method(handleEvent:))]
84 #[unsafe(method_family = none)]
85 pub 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 fn textInputClientWillStartScrollingOrZooming(&self);
98
99 #[unsafe(method(textInputClientDidEndScrollingOrZooming))]
100 #[unsafe(method_family = none)]
101 pub fn textInputClientDidEndScrollingOrZooming(&self);
102
103 #[unsafe(method(textInputClientDidUpdateSelection))]
104 #[unsafe(method_family = none)]
105 pub fn textInputClientDidUpdateSelection(&self);
106
107 #[unsafe(method(textInputClientDidScroll))]
108 #[unsafe(method_family = none)]
109 pub fn textInputClientDidScroll(&self);
110
111 #[unsafe(method(keyboardInputSources))]
113 #[unsafe(method_family = none)]
114 pub 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:))]
126 #[unsafe(method_family = none)]
127 pub fn setSelectedKeyboardInputSource(
128 &self,
129 selected_keyboard_input_source: Option<&NSTextInputSourceIdentifier>,
130 );
131
132 #[unsafe(method(localizedNameForInputSource:))]
134 #[unsafe(method_family = none)]
135 pub fn localizedNameForInputSource(
136 input_source_identifier: &NSTextInputSourceIdentifier,
137 mtm: MainThreadMarker,
138 ) -> Option<Retained<NSString>>;
139 );
140}
141
142impl NSTextInputContext {
144 extern_methods!(
145 #[unsafe(method(new))]
146 #[unsafe(method_family = new)]
147 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
148 );
149}
150
151extern "C" {
152 pub static NSTextInputContextKeyboardSelectionDidChangeNotification:
156 &'static NSNotificationName;
157}