objc2_game_controller/generated/GCDevicePhysicalInputStateDiff.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdevicephysicalinputelementchange?language=objc)
10// NS_ENUM
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct GCDevicePhysicalInputElementChange(pub NSInteger);
14impl GCDevicePhysicalInputElementChange {
15 /// Indicates that a change could not be determined. This is typically
16 /// because the input state queue filled up and older input state snapshots
17 /// were dropped.
18 #[doc(alias = "GCDevicePhysicalInputElementUnknownChange")]
19 pub const UnknownChange: Self = Self(-1);
20 /// Indicates that no value of the element changed.
21 #[doc(alias = "GCDevicePhysicalInputElementNoChange")]
22 pub const NoChange: Self = Self(0);
23 /// Indicates that a value of the element changed.
24 #[doc(alias = "GCDevicePhysicalInputElementChanged")]
25 pub const Changed: Self = Self(1);
26}
27
28unsafe impl Encode for GCDevicePhysicalInputElementChange {
29 const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for GCDevicePhysicalInputElementChange {
33 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_protocol!(
37 /// An object conforming to the
38 /// `GCDevicePhysicalInputStateDiff`protocol
39 /// contains the input state differences between the current and previous
40 /// `GCDevicePhysicalInputState`objects returned from the
41 /// `-nextInputState`method of
42 /// `GCDevicePhysicalInput.`
43 ///
44 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdevicephysicalinputstatediff?language=objc)
45 pub unsafe trait GCDevicePhysicalInputStateDiff: NSObjectProtocol {
46 #[cfg(feature = "GCPhysicalInputElement")]
47 /// Check if a value of
48 /// _element_changed, compared the previous input state.
49 ///
50 ///
51 /// Parameter `element`: The element to check. This may be a pointer to either the "live" element
52 /// from the device's physical input, or a pointer to an element from any input
53 /// state "snapshot" of the device's physical input.
54 #[unsafe(method(changeForElement:))]
55 #[unsafe(method_family = none)]
56 unsafe fn changeForElement(
57 &self,
58 element: &ProtocolObject<dyn GCPhysicalInputElement>,
59 ) -> GCDevicePhysicalInputElementChange;
60
61 #[cfg(feature = "GCPhysicalInputElement")]
62 /// Gets an enumerator that iterates over the elements that have changed, compared
63 /// the previous input state.
64 ///
65 /// This method returns
66 /// `nil`if the changed elements could not be determined -
67 /// typically because the input state queue filled up and older input state
68 /// snapshots were dropped.
69 #[unsafe(method(changedElements))]
70 #[unsafe(method_family = none)]
71 unsafe fn changedElements(
72 &self,
73 ) -> Option<Retained<NSEnumerator<ProtocolObject<dyn GCPhysicalInputElement>>>>;
74 }
75);