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