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")]
47extern_conformance!(
48    unsafe impl GCDevice for GCKeyboard {}
49);
50
51extern_conformance!(
52    unsafe impl NSObjectProtocol for GCKeyboard {}
53);
54
55impl GCKeyboard {
56    extern_methods!(
57        #[cfg(all(feature = "GCKeyboardInput", feature = "GCPhysicalInputProfile"))]
58        /// Unlike GCController GCKeyboard only has one input profile.
59        ///
60        /// This profile allows you to query buttons and button state
61        #[unsafe(method(keyboardInput))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn keyboardInput(&self) -> Option<Retained<GCKeyboardInput>>;
64
65        /// Keyboard object that represents all keyboards connected to the device
66        /// Should be used to query key states every time input needs to be handled
67        #[unsafe(method(coalescedKeyboard))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn coalescedKeyboard() -> Option<Retained<GCKeyboard>>;
70    );
71}
72
73/// Methods declared on superclass `NSObject`.
74impl GCKeyboard {
75    extern_methods!(
76        #[unsafe(method(init))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
79
80        #[unsafe(method(new))]
81        #[unsafe(method_family = new)]
82        pub unsafe fn new() -> Retained<Self>;
83    );
84}