objc2_game_controller/generated/
GCTouchedStateInput.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_protocol!(
11    /// An object conforming to
12    /// `GCTouchedStateInput`represents the touched state of
13    /// an element.
14    ///
15    /// Some buttons feature capacitive touch capabilities, where the user can touch
16    /// the button without pressing it.  In such cases, a button can be touched without
17    /// being pressed.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gctouchedstateinput?language=objc)
20    pub unsafe trait GCTouchedStateInput: NSObjectProtocol {
21        #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
22        /// Set this block if you want to be notified when the touched state changes.
23        ///
24        /// # Safety
25        ///
26        /// - The returned block's argument 1 must be a valid pointer.
27        /// - The returned block's argument 2 must be a valid pointer.
28        #[unsafe(method(touchedDidChangeHandler))]
29        #[unsafe(method_family = none)]
30        unsafe fn touchedDidChangeHandler(
31            &self,
32        ) -> *mut block2::DynBlock<
33            dyn Fn(
34                NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
35                NonNull<ProtocolObject<dyn GCTouchedStateInput>>,
36                Bool,
37            ),
38        >;
39
40        #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
41        /// Setter for [`touchedDidChangeHandler`][Self::touchedDidChangeHandler].
42        ///
43        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
44        #[unsafe(method(setTouchedDidChangeHandler:))]
45        #[unsafe(method_family = none)]
46        unsafe fn setTouchedDidChangeHandler(
47            &self,
48            touched_did_change_handler: Option<
49                &block2::DynBlock<
50                    dyn Fn(
51                        NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
52                        NonNull<ProtocolObject<dyn GCTouchedStateInput>>,
53                        Bool,
54                    ),
55                >,
56            >,
57        );
58
59        /// Some buttons feature capacitive touch capabilities, where the user can touch
60        /// the button without pressing it. In such cases, a button will be touched before
61        /// it is pressed.
62        ///
63        ///
64        /// See: touchedDidChangeHandler
65        ///
66        /// See: GCPressedStateInput
67        #[unsafe(method(isTouched))]
68        #[unsafe(method_family = none)]
69        unsafe fn isTouched(&self) -> bool;
70
71        /// The timestamp of the last touched state change.
72        ///
73        /// This time interval is not relative to any specific point in time.  You can
74        /// subtract a previous timestamp from the returned timestamp to determine the time
75        /// (in seconds) between changes to the value.
76        #[unsafe(method(lastTouchedStateTimestamp))]
77        #[unsafe(method_family = none)]
78        unsafe fn lastTouchedStateTimestamp(&self) -> NSTimeInterval;
79
80        /// The interval (in seconds) between the timestamp of the last touched state
81        /// change and the current time.
82        ///
83        /// This should be treated as a lower bound of the event latency.  It may not
84        /// include (wired or wireless) transmission latency, or latency accrued on
85        /// the device before the event was transmitted to the host.
86        #[unsafe(method(lastTouchedStateLatency))]
87        #[unsafe(method_family = none)]
88        unsafe fn lastTouchedStateLatency(&self) -> NSTimeInterval;
89
90        #[cfg(feature = "GCPhysicalInputSource")]
91        /// An object describing the physical action(s) the user performs to manipulate
92        /// this input.
93        #[unsafe(method(sources))]
94        #[unsafe(method_family = none)]
95        unsafe fn sources(&self) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>;
96    }
97);