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 objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// An object conforming to
    /// `GCDevicePhysicalInputState`contains the state of
    /// a device's physical inputs.  This may be either the "live" physical input
    /// state if the same object also conforms to
    /// `GCDevicePhysicalInput,`or a
    /// snapshot of the physical input state.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdevicephysicalinputstate?language=objc)
    pub unsafe trait GCDevicePhysicalInputState: NSObjectProtocol {
        #[cfg(feature = "GCDevice")]
        /// The device that this profile is mapping input from.
        #[unsafe(method(device))]
        #[unsafe(method_family = none)]
        unsafe fn device(&self) -> Option<Retained<ProtocolObject<dyn GCDevice>>>;

        /// The internal time stamp of the last event.
        ///
        /// This time interval is not relative to any specific point in time.  Your
        /// application can subtract a previous timestamp from the returned timestamp to
        /// determine the time (in seconds) between events.  The
        /// `lastEventTimestamp`of
        /// the inputs from two different devices can be compared to determine which event
        /// occurred first.
        #[unsafe(method(lastEventTimestamp))]
        #[unsafe(method_family = none)]
        unsafe fn lastEventTimestamp(&self) -> NSTimeInterval;

        /// The interval (in seconds) between the timestamp of the last event and the
        /// current time.
        ///
        /// This value should be treated as a lower bound of the event latency.  It may
        /// not include (wired or wireless) transmission latency, or latency accrued on
        /// the device before the event was transmitted to the host.
        ///
        ///
        /// Note: If the system has gone to sleep between when the event occurred and when this
        /// property is read, the returned value may not reflect the true latency.
        #[unsafe(method(lastEventLatency))]
        #[unsafe(method_family = none)]
        unsafe fn lastEventLatency(&self) -> NSTimeInterval;

        #[cfg(all(feature = "GCInputNames", feature = "GCPhysicalInputElement"))]
        /// The following properties allow for runtime lookup of any input element on a
        /// profile, when provided with a valid alias.
        #[unsafe(method(elements))]
        #[unsafe(method_family = none)]
        unsafe fn elements(
            &self,
        ) -> Retained<
            GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCPhysicalInputElement>>,
        >;

        #[cfg(all(
            feature = "GCButtonElement",
            feature = "GCInputNames",
            feature = "GCPhysicalInputElement"
        ))]
        #[unsafe(method(buttons))]
        #[unsafe(method_family = none)]
        unsafe fn buttons(
            &self,
        ) -> Retained<GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCButtonElement>>>;

        #[cfg(all(
            feature = "GCAxisElement",
            feature = "GCInputNames",
            feature = "GCPhysicalInputElement"
        ))]
        #[unsafe(method(axes))]
        #[unsafe(method_family = none)]
        unsafe fn axes(
            &self,
        ) -> Retained<GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCAxisElement>>>;

        #[cfg(all(
            feature = "GCInputNames",
            feature = "GCPhysicalInputElement",
            feature = "GCSwitchElement"
        ))]
        #[unsafe(method(switches))]
        #[unsafe(method_family = none)]
        unsafe fn switches(
            &self,
        ) -> Retained<GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCSwitchElement>>>;

        #[cfg(all(
            feature = "GCDirectionPadElement",
            feature = "GCInputNames",
            feature = "GCPhysicalInputElement"
        ))]
        #[unsafe(method(dpads))]
        #[unsafe(method_family = none)]
        unsafe fn dpads(
            &self,
        ) -> Retained<
            GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCDirectionPadElement>>,
        >;

        #[cfg(feature = "GCPhysicalInputElement")]
        /// Profile elements can be accessed using keyed subscript notation, with a valid alias of its inputs.
        ///
        ///
        ///
        ///
        /// Note: Equivalent to -elements
        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        unsafe fn objectForKeyedSubscript(
            &self,
            key: &NSString,
        ) -> Option<Retained<ProtocolObject<dyn GCPhysicalInputElement>>>;
    }
);