objc2_game_controller/generated/GCKeyboard.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 /// Use these constants with NSNotificationCenter to listen to connection and disconnection events
11 ///
12 /// Use GCKeyboardDidConnectNotification for observing keyboard connection
13 /// Use GCKeyboardDidDisconnectNotification for observing keyboard disconnection
14 ///
15 /// The 'object' property of the notification will contain the GCKeyboard that was connected or disconnected.
16 ///
17 ///
18 /// See: NSNotificationCetner
19 ///
20 /// Note: All connected keyboards are coalesced into one keyboard object, so notification about connection/disconnection will only be delivered once until last keyboard disconnects.
21 ///
22 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gckeyboarddidconnectnotification?language=objc)
23 pub static GCKeyboardDidConnectNotification: &'static NSString;
24}
25
26extern "C" {
27 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gckeyboarddiddisconnectnotification?language=objc)
28 pub static GCKeyboardDidDisconnectNotification: &'static NSString;
29}
30
31extern_class!(
32 /// GCKeyboard is available to an application that links to GameController.framework
33 /// There are 2 ways to access keyboard paired to the system:
34 /// 1: Querying for the coalescedKeyboard using [GCKeyboard coalescedKeyboard]
35 /// 2: Registering for Connection/Disconnection notifications from NSNotificationCenter
36 ///
37 ///
38 /// Note: All connected keyboards are coalesced into one keyboard object, so notification about connection/disconnection will only be delivered once.
39 ///
40 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gckeyboard?language=objc)
41 #[unsafe(super(NSObject))]
42 #[derive(Debug, PartialEq, Eq, Hash)]
43 pub struct GCKeyboard;
44);
45
46#[cfg(feature = "GCDevice")]
47unsafe impl GCDevice for GCKeyboard {}
48
49unsafe impl NSObjectProtocol for GCKeyboard {}
50
51impl GCKeyboard {
52 extern_methods!(
53 #[cfg(all(feature = "GCKeyboardInput", feature = "GCPhysicalInputProfile"))]
54 /// Unlike GCController GCKeyboard only has one input profile.
55 ///
56 /// This profile allows you to query buttons and button state
57 #[unsafe(method(keyboardInput))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn keyboardInput(&self) -> Option<Retained<GCKeyboardInput>>;
60
61 /// Keyboard object that represents all keyboards connected to the device
62 /// Should be used to query key states every time input needs to be handled
63 #[unsafe(method(coalescedKeyboard))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn coalescedKeyboard() -> Option<Retained<GCKeyboard>>;
66 );
67}
68
69/// Methods declared on superclass `NSObject`.
70impl GCKeyboard {
71 extern_methods!(
72 #[unsafe(method(init))]
73 #[unsafe(method_family = init)]
74 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
75
76 #[unsafe(method(new))]
77 #[unsafe(method_family = new)]
78 pub unsafe fn new() -> Retained<Self>;
79 );
80}