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_class!(
10 /// This class manages input sessions.
11 ///
12 /// 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.
13 ///
14 /// 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.
15 ///
16 /// See also [Apple's documentation](https://developer.apple.com/documentation/inputmethodkit/imkserver?language=objc)
17 #[unsafe(super(NSObject))]
18 #[derive(Debug, PartialEq, Eq, Hash)]
19 pub struct IMKServer;
20);
21
22extern_conformance!(
23 unsafe impl NSObjectProtocol for IMKServer {}
24);
25
26impl IMKServer {
27 extern_methods!(
28 /// Create a IMKServer from information in the bundle's Info.plist.
29 ///
30 /// 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.
31 #[unsafe(method(initWithName:bundleIdentifier:))]
32 #[unsafe(method_family = init)]
33 pub unsafe fn initWithName_bundleIdentifier(
34 this: Allocated<Self>,
35 name: Option<&NSString>,
36 bundle_identifier: Option<&NSString>,
37 ) -> Option<Retained<Self>>;
38
39 /// Creates an IMKServer using the parameters.
40 ///
41 /// 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.
42 #[unsafe(method(initWithName:controllerClass:delegateClass:))]
43 #[unsafe(method_family = init)]
44 pub unsafe fn initWithName_controllerClass_delegateClass(
45 this: Allocated<Self>,
46 name: Option<&NSString>,
47 controller_class_id: Option<&AnyClass>,
48 delegate_class_id: Option<&AnyClass>,
49 ) -> Option<Retained<Self>>;
50
51 /// Returns an NSBundle for the input method.
52 ///
53 /// 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.
54 #[unsafe(method(bundle))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn bundle(&self) -> Option<Retained<NSBundle>>;
57
58 /// Call this before terminating a palette IM.
59 ///
60 /// Palettes need to be able to terminate. When this method is called the IMKServer will notify each client of the palette that
61 /// 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
62 /// an input method of type palette an exception will be thrown.
63 ///
64 /// If the method returns NO the palette should not terminate.
65 #[unsafe(method(paletteWillTerminate))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn paletteWillTerminate(&self) -> bool;
68
69 /// Returns a BOOL indicating whether or not the last key press was a dead key.
70 #[unsafe(method(lastKeyEventWasDeadKey))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn lastKeyEventWasDeadKey(&self) -> bool;
73 );
74}
75
76/// Methods declared on superclass `NSObject`.
77impl IMKServer {
78 extern_methods!(
79 #[unsafe(method(init))]
80 #[unsafe(method_family = init)]
81 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
82
83 #[unsafe(method(new))]
84 #[unsafe(method_family = new)]
85 pub unsafe fn new() -> Retained<Self>;
86 );
87}