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
21unsafe impl NSObjectProtocol for NSTextInputContext {}
22
23impl NSTextInputContext {
24 extern_methods!(
25 #[unsafe(method(currentInputContext))]
26 #[unsafe(method_family = none)]
27 pub unsafe fn currentInputContext(
28 mtm: MainThreadMarker,
29 ) -> Option<Retained<NSTextInputContext>>;
30
31 #[cfg(feature = "NSTextInputClient")]
32 #[unsafe(method(initWithClient:))]
33 #[unsafe(method_family = init)]
34 pub unsafe 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 unsafe fn client(&self) -> Retained<ProtocolObject<dyn NSTextInputClient>>;
48
49 #[unsafe(method(acceptsGlyphInfo))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn acceptsGlyphInfo(&self) -> bool;
52
53 #[unsafe(method(setAcceptsGlyphInfo:))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn setAcceptsGlyphInfo(&self, accepts_glyph_info: bool);
57
58 #[unsafe(method(allowedInputSourceLocales))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
61
62 #[unsafe(method(setAllowedInputSourceLocales:))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn setAllowedInputSourceLocales(
66 &self,
67 allowed_input_source_locales: Option<&NSArray<NSString>>,
68 );
69
70 #[unsafe(method(activate))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn activate(&self);
74
75 #[unsafe(method(deactivate))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn deactivate(&self);
78
79 #[cfg(feature = "NSEvent")]
80 #[unsafe(method(handleEvent:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn handleEvent(&self, event: &NSEvent) -> bool;
84
85 #[unsafe(method(discardMarkedText))]
86 #[unsafe(method_family = none)]
87 pub fn discardMarkedText(&self);
88
89 #[unsafe(method(invalidateCharacterCoordinates))]
90 #[unsafe(method_family = none)]
91 pub fn invalidateCharacterCoordinates(&self);
92
93 #[unsafe(method(textInputClientWillStartScrollingOrZooming))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn textInputClientWillStartScrollingOrZooming(&self);
96
97 #[unsafe(method(textInputClientDidEndScrollingOrZooming))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn textInputClientDidEndScrollingOrZooming(&self);
100
101 #[unsafe(method(keyboardInputSources))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn keyboardInputSources(
105 &self,
106 ) -> Option<Retained<NSArray<NSTextInputSourceIdentifier>>>;
107
108 #[unsafe(method(selectedKeyboardInputSource))]
109 #[unsafe(method_family = none)]
110 pub fn selectedKeyboardInputSource(&self) -> Option<Retained<NSTextInputSourceIdentifier>>;
111
112 #[unsafe(method(setSelectedKeyboardInputSource:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn setSelectedKeyboardInputSource(
116 &self,
117 selected_keyboard_input_source: Option<&NSTextInputSourceIdentifier>,
118 );
119
120 #[unsafe(method(localizedNameForInputSource:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn localizedNameForInputSource(
124 input_source_identifier: &NSTextInputSourceIdentifier,
125 mtm: MainThreadMarker,
126 ) -> Option<Retained<NSString>>;
127 );
128}
129
130impl NSTextInputContext {
132 extern_methods!(
133 #[unsafe(method(new))]
134 #[unsafe(method_family = new)]
135 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
136 );
137}
138
139extern "C" {
140 pub static NSTextInputContextKeyboardSelectionDidChangeNotification:
144 &'static NSNotificationName;
145}