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 #[unsafe(method(touchedDidChangeHandler))]
24 #[unsafe(method_family = none)]
25 unsafe fn touchedDidChangeHandler(
26 &self,
27 ) -> *mut block2::DynBlock<
28 dyn Fn(
29 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
30 NonNull<ProtocolObject<dyn GCTouchedStateInput>>,
31 Bool,
32 ),
33 >;
34
35 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
36 /// Setter for [`touchedDidChangeHandler`][Self::touchedDidChangeHandler].
37 #[unsafe(method(setTouchedDidChangeHandler:))]
38 #[unsafe(method_family = none)]
39 unsafe fn setTouchedDidChangeHandler(
40 &self,
41 touched_did_change_handler: Option<
42 &block2::DynBlock<
43 dyn Fn(
44 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
45 NonNull<ProtocolObject<dyn GCTouchedStateInput>>,
46 Bool,
47 ),
48 >,
49 >,
50 );
51
52 /// Some buttons feature capacitive touch capabilities, where the user can touch
53 /// the button without pressing it. In such cases, a button will be touched before
54 /// it is pressed.
55 ///
56 ///
57 /// See: touchedDidChangeHandler
58 ///
59 /// See: GCPressedStateInput
60 #[unsafe(method(isTouched))]
61 #[unsafe(method_family = none)]
62 unsafe fn isTouched(&self) -> bool;
63
64 /// The timestamp of the last touched state change.
65 ///
66 /// This time interval is not relative to any specific point in time. You can
67 /// subtract a previous timestamp from the returned timestamp to determine the time
68 /// (in seconds) between changes to the value.
69 #[unsafe(method(lastTouchedStateTimestamp))]
70 #[unsafe(method_family = none)]
71 unsafe fn lastTouchedStateTimestamp(&self) -> NSTimeInterval;
72
73 /// The interval (in seconds) between the timestamp of the last touched state
74 /// change and the current time.
75 ///
76 /// This should be treated as a lower bound of the event latency. It may not
77 /// include (wired or wireless) transmission latency, or latency accrued on
78 /// the device before the event was transmitted to the host.
79 #[unsafe(method(lastTouchedStateLatency))]
80 #[unsafe(method_family = none)]
81 unsafe fn lastTouchedStateLatency(&self) -> NSTimeInterval;
82
83 #[cfg(feature = "GCPhysicalInputSource")]
84 /// An object describing the physical action(s) the user performs to manipulate
85 /// this input.
86 #[unsafe(method(sources))]
87 #[unsafe(method_family = none)]
88 unsafe fn sources(&self) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>;
89 }
90);