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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPressPhase(pub NSInteger);
impl UIPressPhase {
    #[doc(alias = "UIPressPhaseBegan")]
    pub const Began: Self = Self(0);
    #[doc(alias = "UIPressPhaseChanged")]
    pub const Changed: Self = Self(1);
    #[doc(alias = "UIPressPhaseStationary")]
    pub const Stationary: Self = Self(2);
    #[doc(alias = "UIPressPhaseEnded")]
    pub const Ended: Self = Self(3);
    #[doc(alias = "UIPressPhaseCancelled")]
    pub const Cancelled: Self = Self(4);
}

unsafe impl Encode for UIPressPhase {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIPressPhase {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPressType(pub NSInteger);
impl UIPressType {
    #[doc(alias = "UIPressTypeUpArrow")]
    pub const UpArrow: Self = Self(0);
    #[doc(alias = "UIPressTypeDownArrow")]
    pub const DownArrow: Self = Self(1);
    #[doc(alias = "UIPressTypeLeftArrow")]
    pub const LeftArrow: Self = Self(2);
    #[doc(alias = "UIPressTypeRightArrow")]
    pub const RightArrow: Self = Self(3);
    #[doc(alias = "UIPressTypeSelect")]
    pub const Select: Self = Self(4);
    #[doc(alias = "UIPressTypeMenu")]
    pub const Menu: Self = Self(5);
    #[doc(alias = "UIPressTypePlayPause")]
    pub const PlayPause: Self = Self(6);
    #[doc(alias = "UIPressTypePageUp")]
    pub const PageUp: Self = Self(30);
    #[doc(alias = "UIPressTypePageDown")]
    pub const PageDown: Self = Self(31);
}

unsafe impl Encode for UIPressType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIPressType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIPress;

    unsafe impl ClassType for UIPress {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for UIPress {}

extern_methods!(
    unsafe impl UIPress {
        #[method(timestamp)]
        pub unsafe fn timestamp(&self) -> NSTimeInterval;

        #[method(phase)]
        pub unsafe fn phase(&self) -> UIPressPhase;

        #[method(type)]
        pub unsafe fn r#type(&self) -> UIPressType;

        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
        #[method_id(@__retain_semantics Other window)]
        pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;

        #[cfg(feature = "UIResponder")]
        #[method_id(@__retain_semantics Other responder)]
        pub unsafe fn responder(&self, mtm: MainThreadMarker) -> Option<Retained<UIResponder>>;

        #[cfg(feature = "UIGestureRecognizer")]
        #[method_id(@__retain_semantics Other gestureRecognizers)]
        pub unsafe fn gestureRecognizers(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSArray<UIGestureRecognizer>>>;

        #[method(force)]
        pub unsafe fn force(&self) -> CGFloat;

        #[cfg(feature = "UIKey")]
        #[method_id(@__retain_semantics Other key)]
        pub unsafe fn key(&self, mtm: MainThreadMarker) -> Option<Retained<UIKey>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIPress {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);