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