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