objc2_input_method_kit/generated/IMKServer.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern "C" {
10 /// Key used to obtain an input method's mode dictionary from the input method's bundle.
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/inputmethodkit/imkmodedictionary?language=objc)
13 pub static IMKModeDictionary: &'static NSString;
14}
15
16extern "C" {
17 /// Key used to find an input method's input controller class name from the input method's bundle.
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/inputmethodkit/imkcontrollerclass?language=objc)
20 pub static IMKControllerClass: &'static NSString;
21}
22
23extern "C" {
24 /// Key used to find an input method's delegate class name from the input method's bundle.
25 ///
26 /// See also [Apple's documentation](https://developer.apple.com/documentation/inputmethodkit/imkdelegateclass?language=objc)
27 pub static IMKDelegateClass: &'static NSString;
28}
29
30extern_class!(
31 /// This class manages input sessions.
32 ///
33 /// An input method should create one and only one of these objects. An IMKServer creates an NSConnection that can be connected to by input clients. After a connection has been made an IMKServer manages communication between the client and the input method. For each communication session the IMKServer will create an IMKInputController class as well as delegate classes for that controller. Each controller object then serves as a proxy for the input session on the client side. This means that input methods do not have to concern themselves with managing client sessions. A given controller will only receive communication from a single session.
34 ///
35 /// IMKServer's also will manage a basic candidate window for an input method. See IMKCandidates.h to understand how to create a candidate window and associate the candidate window with the IMKServer object.
36 ///
37 /// See also [Apple's documentation](https://developer.apple.com/documentation/inputmethodkit/imkserver?language=objc)
38 #[unsafe(super(NSObject))]
39 #[derive(Debug, PartialEq, Eq, Hash)]
40 pub struct IMKServer;
41);
42
43extern_conformance!(
44 unsafe impl NSObjectProtocol for IMKServer {}
45);
46
47impl IMKServer {
48 extern_methods!(
49 /// Create a IMKServer from information in the bundle's Info.plist.
50 ///
51 /// This method will look into the info.plist for a controller class and delegate class. The class names will be loaded, no classes will be instantiated. Additionally, an NSConnection will be allocated and registered with the name parameter.
52 ///
53 /// # Safety
54 ///
55 /// - `name` might not allow `None`.
56 /// - `bundle_identifier` might not allow `None`.
57 #[unsafe(method(initWithName:bundleIdentifier:))]
58 #[unsafe(method_family = init)]
59 pub unsafe fn initWithName_bundleIdentifier(
60 this: Allocated<Self>,
61 name: Option<&NSString>,
62 bundle_identifier: Option<&NSString>,
63 ) -> Option<Retained<Self>>;
64
65 /// Creates an IMKServer using the parameters.
66 ///
67 /// This method creates an IMKServer object without attempting to examine the bundle instead the class names provided as parameters are used to create input controller objects and delegate objects.
68 ///
69 /// # Safety
70 ///
71 /// - `name` might not allow `None`.
72 /// - `controller_class_id` probably has further requirements.
73 /// - `controller_class_id` might not allow `None`.
74 /// - `delegate_class_id` probably has further requirements.
75 /// - `delegate_class_id` might not allow `None`.
76 #[unsafe(method(initWithName:controllerClass:delegateClass:))]
77 #[unsafe(method_family = init)]
78 pub unsafe fn initWithName_controllerClass_delegateClass(
79 this: Allocated<Self>,
80 name: Option<&NSString>,
81 controller_class_id: Option<&AnyClass>,
82 delegate_class_id: Option<&AnyClass>,
83 ) -> Option<Retained<Self>>;
84
85 /// Returns an NSBundle for the input method.
86 ///
87 /// If the IMKServer contains a bundle identifier the NSBundle is created from that. Otherwise, the bundle is created for the main bundle. The returned NSBundle is an autoreleased object.
88 #[unsafe(method(bundle))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn bundle(&self) -> Option<Retained<NSBundle>>;
91
92 /// Call this before terminating a palette IM.
93 ///
94 /// Palettes need to be able to terminate. When this method is called the IMKServer will notify each client of the palette that
95 /// the palette is about to terminate. The palette can terminate safely if a value of YES is returned. If the caller of this method is not
96 /// an input method of type palette an exception will be thrown.
97 ///
98 /// If the method returns NO the palette should not terminate.
99 #[unsafe(method(paletteWillTerminate))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn paletteWillTerminate(&self) -> bool;
102
103 /// Returns a BOOL indicating whether or not the last key press was a dead key.
104 #[unsafe(method(lastKeyEventWasDeadKey))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn lastKeyEventWasDeadKey(&self) -> bool;
107 );
108}
109
110/// Methods declared on superclass `NSObject`.
111impl IMKServer {
112 extern_methods!(
113 #[unsafe(method(init))]
114 #[unsafe(method_family = init)]
115 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
116
117 #[unsafe(method(new))]
118 #[unsafe(method_family = new)]
119 pub unsafe fn new() -> Retained<Self>;
120 );
121}