objc2_game_controller/generated/GCRacingWheel.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern "C" {
11 /// Use these constants with NSNotificationCenter to listen to connection and disconnection events.
12 ///
13 /// Use GCRacingWheelDidConnectNotification for observing connections of racing wheels.
14 /// Use GCRacingWheelDidDisconnectNotification for observing disconnections of racing wheels.
15 ///
16 /// Connections and disconnections of racing wheels will also be reflected in the connectedRacingWheels array
17 /// of the GCRacingWheel class.
18 ///
19 /// The 'object' property of the notification will contain the GCRacingWheel that was connected or disconnected.
20 /// For example:
21 ///
22 /// - (void)wheelDidConnect:(NSNotification *)note {
23 /// GCRacingWheel *controller = note.object;
24 /// ....
25 /// }
26 ///
27 ///
28 /// See: NSNotificationCenter
29 ///
30 /// See: GCRacingWheel.connectedRacingWheels
31 ///
32 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcracingwheeldidconnectnotification?language=objc)
33 pub static GCRacingWheelDidConnectNotification: &'static NSString;
34}
35
36extern "C" {
37 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcracingwheeldiddisconnectnotification?language=objc)
38 pub static GCRacingWheelDidDisconnectNotification: &'static NSString;
39}
40
41extern_class!(
42 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcracingwheel?language=objc)
43 #[unsafe(super(NSObject))]
44 #[derive(Debug, PartialEq, Eq, Hash)]
45 pub struct GCRacingWheel;
46);
47
48#[cfg(feature = "GCDevice")]
49unsafe impl GCDevice for GCRacingWheel {}
50
51unsafe impl NSObjectProtocol for GCRacingWheel {}
52
53impl GCRacingWheel {
54 extern_methods!(
55 #[unsafe(method(init))]
56 #[unsafe(method_family = init)]
57 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
58
59 /// Get the collection of racing wheels currently attached to the system.
60 ///
61 ///
62 /// See: GCRacingWheelDidConnectNotification
63 ///
64 /// See: GCRacingWheelDidDisconnectNotification
65 #[unsafe(method(connectedRacingWheels))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn connectedRacingWheels() -> Retained<NSSet<GCRacingWheel>>;
68
69 /// A GCRacingWheel must be acquired before your application can begin receiving
70 /// events from it. Prior to acquisition, your application may only query the
71 /// properties of the racing wheel. Acquisition is exclusive and may fail.
72 #[unsafe(method(acquireDeviceWithError:_))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn acquireDeviceWithError(&self) -> Result<(), Retained<NSError>>;
75
76 /// Releases a previous acquisition of the racing wheel.
77 #[unsafe(method(relinquishDevice))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn relinquishDevice(&self);
80
81 /// Checks if the racing wheel has been acquired by the application.
82 ///
83 /// This property is observable.
84 #[unsafe(method(isAcquired))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn isAcquired(&self) -> bool;
87
88 #[cfg(feature = "GCRacingWheelInput")]
89 /// Get the physical input profile for the racing wheel.
90 #[unsafe(method(wheelInput))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn wheelInput(&self) -> Retained<GCRacingWheelInput>;
93
94 /// A GCRacingWheel may represent a real device managed by the operating system,
95 /// or a snapshot created by the developer.
96 ///
97 ///
98 /// See: capture
99 #[unsafe(method(isSnapshot))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn isSnapshot(&self) -> bool;
102
103 /// Polls the state vector of the racing wheel and saves it to a new instance of
104 /// GCRacingWheel.
105 ///
106 /// If your application is heavily multithreaded this may also be useful to
107 /// guarantee atomicity of input handling as a snapshot will not change based on
108 /// user input once it is taken.
109 ///
110 ///
111 /// See: snapshot
112 ///
113 /// Returns: A new racing wheel with the duplicated state vector of the receiver.
114 #[unsafe(method(capture))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn capture(&self) -> Retained<GCRacingWheel>;
117 );
118}
119
120/// Methods declared on superclass `NSObject`.
121impl GCRacingWheel {
122 extern_methods!(
123 #[unsafe(method(new))]
124 #[unsafe(method_family = new)]
125 pub unsafe fn new() -> Retained<Self>;
126 );
127}