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
87unsafe impl NSObjectProtocol for UIPress {}
88
89impl UIPress {
90    extern_methods!(
91        #[unsafe(method(timestamp))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn timestamp(&self) -> NSTimeInterval;
94
95        #[unsafe(method(phase))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn phase(&self) -> UIPressPhase;
98
99        #[unsafe(method(type))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn r#type(&self) -> UIPressType;
102
103        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
104        #[unsafe(method(window))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;
107
108        #[cfg(feature = "UIResponder")]
109        #[unsafe(method(responder))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn responder(&self, mtm: MainThreadMarker) -> Option<Retained<UIResponder>>;
112
113        #[cfg(feature = "UIGestureRecognizer")]
114        #[unsafe(method(gestureRecognizers))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn gestureRecognizers(
117            &self,
118            mtm: MainThreadMarker,
119        ) -> Option<Retained<NSArray<UIGestureRecognizer>>>;
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[unsafe(method(force))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn force(&self) -> CGFloat;
125
126        #[cfg(feature = "UIKey")]
127        /// For presses that originate from a hardware keyboard, contains a UIKey object describing the key being acted upon.
128        /// This property is nil if the press did not originate from a hardware keyboard.
129        #[unsafe(method(key))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn key(&self, mtm: MainThreadMarker) -> Option<Retained<UIKey>>;
132    );
133}
134
135/// Methods declared on superclass `NSObject`.
136impl UIPress {
137    extern_methods!(
138        #[unsafe(method(init))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
141
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new() -> Retained<Self>;
145    );
146}