objc2_ui_kit/generated/
UIPress.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct UIPressPhase(pub NSInteger);
16impl UIPressPhase {
17 #[doc(alias = "UIPressPhaseBegan")]
18 pub const Began: Self = Self(0);
19 #[doc(alias = "UIPressPhaseChanged")]
20 pub const Changed: Self = Self(1);
21 #[doc(alias = "UIPressPhaseStationary")]
22 pub const Stationary: Self = Self(2);
23 #[doc(alias = "UIPressPhaseEnded")]
24 pub const Ended: Self = Self(3);
25 #[doc(alias = "UIPressPhaseCancelled")]
26 pub const Cancelled: Self = Self(4);
27}
28
29unsafe impl Encode for UIPressPhase {
30 const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UIPressPhase {
34 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct UIPressType(pub NSInteger);
42impl UIPressType {
43 #[doc(alias = "UIPressTypeUpArrow")]
44 pub const UpArrow: Self = Self(0);
45 #[doc(alias = "UIPressTypeDownArrow")]
46 pub const DownArrow: Self = Self(1);
47 #[doc(alias = "UIPressTypeLeftArrow")]
48 pub const LeftArrow: Self = Self(2);
49 #[doc(alias = "UIPressTypeRightArrow")]
50 pub const RightArrow: Self = Self(3);
51 #[doc(alias = "UIPressTypeSelect")]
52 pub const Select: Self = Self(4);
53 #[doc(alias = "UIPressTypeMenu")]
54 pub const Menu: Self = Self(5);
55 #[doc(alias = "UIPressTypePlayPause")]
56 pub const PlayPause: Self = Self(6);
57 #[doc(alias = "UIPressTypePageUp")]
58 pub const PageUp: Self = Self(30);
59 #[doc(alias = "UIPressTypePageDown")]
60 pub const PageDown: Self = Self(31);
61 #[doc(alias = "UIPressTypeTVRemoteOneTwoThree")]
65 pub const TVRemoteOneTwoThree: Self = Self(32);
66 #[doc(alias = "UIPressTypeTVRemoteFourColors")]
69 pub const TVRemoteFourColors: Self = Self(33);
70}
71
72unsafe impl Encode for UIPressType {
73 const ENCODING: Encoding = NSInteger::ENCODING;
74}
75
76unsafe impl RefEncode for UIPressType {
77 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
78}
79
80extern_class!(
81 #[unsafe(super(NSObject))]
83 #[derive(Debug, PartialEq, Eq, Hash)]
84 pub struct UIPress;
85);
86
87extern_conformance!(
88 unsafe impl NSObjectProtocol for UIPress {}
89);
90
91impl UIPress {
92 extern_methods!(
93 #[unsafe(method(timestamp))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn timestamp(&self) -> NSTimeInterval;
96
97 #[unsafe(method(phase))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn phase(&self) -> UIPressPhase;
100
101 #[unsafe(method(type))]
102 #[unsafe(method_family = none)]
103 pub unsafe fn r#type(&self) -> UIPressType;
104
105 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
106 #[unsafe(method(window))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;
109
110 #[cfg(feature = "UIResponder")]
111 #[unsafe(method(responder))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn responder(&self, mtm: MainThreadMarker) -> Option<Retained<UIResponder>>;
114
115 #[cfg(feature = "UIGestureRecognizer")]
116 #[unsafe(method(gestureRecognizers))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn gestureRecognizers(
119 &self,
120 mtm: MainThreadMarker,
121 ) -> Option<Retained<NSArray<UIGestureRecognizer>>>;
122
123 #[cfg(feature = "objc2-core-foundation")]
124 #[unsafe(method(force))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn force(&self) -> CGFloat;
127
128 #[cfg(feature = "UIKey")]
129 #[unsafe(method(key))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn key(&self, mtm: MainThreadMarker) -> Option<Retained<UIKey>>;
134 );
135}
136
137impl UIPress {
139 extern_methods!(
140 #[unsafe(method(init))]
141 #[unsafe(method_family = init)]
142 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
143
144 #[unsafe(method(new))]
145 #[unsafe(method_family = new)]
146 pub unsafe fn new() -> Retained<Self>;
147 );
148}