objc2_game_controller/generated/GCSwitchPositionInput.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 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcswitchpositioninput?language=objc)
12 pub unsafe trait GCSwitchPositionInput: NSObjectProtocol {
13 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
14 /// Set this block if you want to be notified when the value on the switch changes.
15 ///
16 ///
17 /// Parameter `input`: the element that has been modified.
18 ///
19 /// See: value
20 #[unsafe(method(positionDidChangeHandler))]
21 #[unsafe(method_family = none)]
22 unsafe fn positionDidChangeHandler(
23 &self,
24 ) -> *mut block2::Block<
25 dyn Fn(
26 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
27 NonNull<ProtocolObject<dyn GCSwitchPositionInput>>,
28 NSInteger,
29 ),
30 >;
31
32 #[cfg(all(feature = "GCPhysicalInputElement", feature = "block2"))]
33 /// Setter for [`positionDidChangeHandler`][Self::positionDidChangeHandler].
34 #[unsafe(method(setPositionDidChangeHandler:))]
35 #[unsafe(method_family = none)]
36 unsafe fn setPositionDidChangeHandler(
37 &self,
38 position_did_change_handler: Option<
39 &block2::Block<
40 dyn Fn(
41 NonNull<ProtocolObject<dyn GCPhysicalInputElement>>,
42 NonNull<ProtocolObject<dyn GCSwitchPositionInput>>,
43 NSInteger,
44 ),
45 >,
46 >,
47 );
48
49 /// The switch's position.
50 ///
51 ///
52 /// See: valueDidChangeHandler
53 #[unsafe(method(position))]
54 #[unsafe(method_family = none)]
55 unsafe fn position(&self) -> NSInteger;
56
57 /// The (inclusive) bounds of possible position values for the switch.
58 #[unsafe(method(positionRange))]
59 #[unsafe(method_family = none)]
60 unsafe fn positionRange(&self) -> NSRange;
61
62 /// `YES`if the switch input can only transition to positions that are adjacent
63 /// to the current position.
64 #[unsafe(method(isSequential))]
65 #[unsafe(method_family = none)]
66 unsafe fn isSequential(&self) -> bool;
67
68 /// Check if the position input value can "roll over" when reaching either of its
69 /// bounds.
70 ///
71 /// This will always be
72 /// `YES`for non-sequential switch inputs.
73 #[unsafe(method(canWrap))]
74 #[unsafe(method_family = none)]
75 unsafe fn canWrap(&self) -> bool;
76
77 /// The timestamp of the last value.
78 ///
79 /// This time interval is not relative to any specific point in time. You can
80 /// subtract a previous timestamp from the returned timestamp to determine the time
81 /// (in seconds) between changes to the value.
82 #[unsafe(method(lastPositionTimestamp))]
83 #[unsafe(method_family = none)]
84 unsafe fn lastPositionTimestamp(&self) -> NSTimeInterval;
85
86 /// The interval (in seconds) between the timestamp of the last event and the
87 /// current time.
88 ///
89 /// This should be treated as a lower bound of the event latency. It may not
90 /// include (wired or wireless) transmission latency, or latency accrued on
91 /// the device before the event was transmitted to the host.
92 #[unsafe(method(lastPositionLatency))]
93 #[unsafe(method_family = none)]
94 unsafe fn lastPositionLatency(&self) -> NSTimeInterval;
95
96 #[cfg(feature = "GCPhysicalInputSource")]
97 /// An object describing the physical action(s) the user performs to manipulate
98 /// this input.
99 #[unsafe(method(sources))]
100 #[unsafe(method_family = none)]
101 unsafe fn sources(&self) -> Retained<NSSet<ProtocolObject<dyn GCPhysicalInputSource>>>;
102 }
103);