objc2_app_kit/generated/
NSTextInputContext.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputsourceidentifier?language=objc)
11pub type NSTextInputSourceIdentifier = NSString;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputcontext?language=objc)
15    #[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        /// ** Properties ****
45        #[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        /// Setter for [`acceptsGlyphInfo`][Self::acceptsGlyphInfo].
54        #[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        /// Setter for [`allowedInputSourceLocales`][Self::allowedInputSourceLocales].
63        ///
64        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
65        #[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        /// ** Activation ****
73        #[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        /// ** Input source interface ***
83        #[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        /// ** Text Input sources handling ***
112        #[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        /// Setter for [`selectedKeyboardInputSource`][Self::selectedKeyboardInputSource].
123        ///
124        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
125        #[unsafe(method(setSelectedKeyboardInputSource:))]
126        #[unsafe(method_family = none)]
127        pub fn setSelectedKeyboardInputSource(
128            &self,
129            selected_keyboard_input_source: Option<&NSTextInputSourceIdentifier>,
130        );
131
132        /// ** Text Input source attributes ***
133        #[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
142/// Methods declared on superclass `NSObject`.
143impl 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    /// ** Notifications ***
153    ///
154    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputcontextkeyboardselectiondidchangenotification?language=objc)
155    pub static NSTextInputContextKeyboardSelectionDidChangeNotification:
156        &'static NSNotificationName;
157}