objc2_ui_kit/generated/
UIPress.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::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipressphase?language=objc)
12// NS_ENUM
13#[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/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipresstype?language=objc)
38// NS_ENUM
39#[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    /// Represents a button on a TV remote labeled with 123. When this button is pressed, an app should provide UI to enter a specific channel number if channel
62    /// numbers are available. If no channel numbers exist the app should provide UI to toggle channel category filters, search for channels by name or search for
63    /// currently airing shows.
64    #[doc(alias = "UIPressTypeTVRemoteOneTwoThree")]
65    pub const TVRemoteOneTwoThree: Self = Self(32);
66    /// Represents a button on a TV remote labeled with four colors, analogous to the four separate color buttons found on some TV remotes. When this button is
67    /// pressed, an app should perform the appropriate color action or if there are multiple color actions available provide UI to choose the specific color.
68    #[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipress?language=objc)
82    #[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        /// For presses that originate from a hardware keyboard, contains a UIKey object describing the key being acted upon.
130        /// This property is nil if the press did not originate from a hardware keyboard.
131        #[unsafe(method(key))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn key(&self, mtm: MainThreadMarker) -> Option<Retained<UIKey>>;
134    );
135}
136
137/// Methods declared on superclass `NSObject`.
138impl 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}