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")]
49extern_conformance!(
50    unsafe impl GCDevice for GCRacingWheel {}
51);
52
53extern_conformance!(
54    unsafe impl NSObjectProtocol for GCRacingWheel {}
55);
56
57impl GCRacingWheel {
58    extern_methods!(
59        #[unsafe(method(init))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
62
63        /// Get the collection of racing wheels currently attached to the system.
64        ///
65        ///
66        /// See: GCRacingWheelDidConnectNotification
67        ///
68        /// See: GCRacingWheelDidDisconnectNotification
69        #[unsafe(method(connectedRacingWheels))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn connectedRacingWheels() -> Retained<NSSet<GCRacingWheel>>;
72
73        /// A GCRacingWheel must be acquired before your application can begin receiving
74        /// events from it.  Prior to acquisition, your application may only query the
75        /// properties of the racing wheel.  Acquisition is exclusive and may fail.
76        #[unsafe(method(acquireDeviceWithError:_))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn acquireDeviceWithError(&self) -> Result<(), Retained<NSError>>;
79
80        /// Releases a previous acquisition of the racing wheel.
81        #[unsafe(method(relinquishDevice))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn relinquishDevice(&self);
84
85        /// Checks if the racing wheel has been acquired by the application.
86        ///
87        /// This property is observable.
88        #[unsafe(method(isAcquired))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn isAcquired(&self) -> bool;
91
92        #[cfg(feature = "GCRacingWheelInput")]
93        /// Get the physical input profile for the racing wheel.
94        #[unsafe(method(wheelInput))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn wheelInput(&self) -> Retained<GCRacingWheelInput>;
97
98        /// A GCRacingWheel may represent a real device managed by the operating system,
99        /// or a snapshot created by the developer.
100        ///
101        ///
102        /// See: capture
103        #[unsafe(method(isSnapshot))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn isSnapshot(&self) -> bool;
106
107        /// Polls the state vector of the racing wheel and saves it to a new instance of
108        /// GCRacingWheel.
109        ///
110        /// If your application is heavily multithreaded this may also be useful to
111        /// guarantee atomicity of input handling as a snapshot will not change based on
112        /// user input once it is taken.
113        ///
114        ///
115        /// See: snapshot
116        ///
117        /// Returns: A new racing wheel with the duplicated state vector of the receiver.
118        #[unsafe(method(capture))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn capture(&self) -> Retained<GCRacingWheel>;
121    );
122}
123
124/// Methods declared on superclass `NSObject`.
125impl GCRacingWheel {
126    extern_methods!(
127        #[unsafe(method(new))]
128        #[unsafe(method_family = new)]
129        pub unsafe fn new() -> Retained<Self>;
130    );
131}