objc2-game-controller 0.3.2

Bindings to the GameController framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcracingwheelinputstate?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GCRacingWheelInputState;
);

#[cfg(feature = "GCDevicePhysicalInputState")]
extern_conformance!(
    unsafe impl GCDevicePhysicalInputState for GCRacingWheelInputState {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GCRacingWheelInputState {}
);

impl GCRacingWheelInputState {
    extern_methods!(
        #[cfg(feature = "GCSteeringWheelElement")]
        /// The steering wheel element.
        #[unsafe(method(wheel))]
        #[unsafe(method_family = none)]
        pub unsafe fn wheel(&self) -> Retained<GCSteeringWheelElement>;

        #[cfg(all(feature = "GCButtonElement", feature = "GCPhysicalInputElement"))]
        #[unsafe(method(acceleratorPedal))]
        #[unsafe(method_family = none)]
        pub unsafe fn acceleratorPedal(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn GCButtonElement>>>;

        #[cfg(all(feature = "GCButtonElement", feature = "GCPhysicalInputElement"))]
        #[unsafe(method(brakePedal))]
        #[unsafe(method_family = none)]
        pub unsafe fn brakePedal(&self) -> Option<Retained<ProtocolObject<dyn GCButtonElement>>>;

        #[cfg(all(feature = "GCButtonElement", feature = "GCPhysicalInputElement"))]
        #[unsafe(method(clutchPedal))]
        #[unsafe(method_family = none)]
        pub unsafe fn clutchPedal(&self) -> Option<Retained<ProtocolObject<dyn GCButtonElement>>>;

        #[cfg(feature = "GCGearShifterElement")]
        /// The element representing an attached gear shifter accessory.
        ///
        /// Note that this element only represents an external gear shifter accessory.
        /// Many racing wheels have a pair of built in paddle buttons that can be used for
        /// sequential gear shifting.  Those buttons are can be looked up with the
        /// `GCInputLeftPaddle`and
        /// `GCInputRightPaddle`input names.
        #[unsafe(method(shifter))]
        #[unsafe(method_family = none)]
        pub unsafe fn shifter(&self) -> Option<Retained<GCGearShifterElement>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl GCRacingWheelInputState {
    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>;
    );
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcracingwheelinput?language=objc)
    #[unsafe(super(GCRacingWheelInputState, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct GCRacingWheelInput;
);

#[cfg(all(
    feature = "GCDevicePhysicalInput",
    feature = "GCDevicePhysicalInputState"
))]
extern_conformance!(
    unsafe impl GCDevicePhysicalInput for GCRacingWheelInput {}
);

#[cfg(feature = "GCDevicePhysicalInputState")]
extern_conformance!(
    unsafe impl GCDevicePhysicalInputState for GCRacingWheelInput {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for GCRacingWheelInput {}
);

impl GCRacingWheelInput {
    extern_methods!(
        /// Polls the current state vector of the racing wheel input and saves it to a new
        /// instance.
        #[unsafe(method(capture))]
        #[unsafe(method_family = none)]
        pub unsafe fn capture(&self) -> Retained<GCRacingWheelInputState>;

        #[cfg(feature = "GCDevicePhysicalInputStateDiff")]
        #[unsafe(method(nextInputState))]
        #[unsafe(method_family = none)]
        pub unsafe fn nextInputState(&self) -> Option<Retained<GCRacingWheelInputState>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl GCRacingWheelInput {
    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>;
    );
}