use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
#[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);
}
#[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);
#[doc(alias = "UIPressTypeTVRemoteOneTwoThree")]
pub const TVRemoteOneTwoThree: Self = Self(32);
#[doc(alias = "UIPressTypeTVRemoteFourColors")]
pub const TVRemoteFourColors: Self = Self(33);
}
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!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIPress;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIPress {}
);
impl UIPress {
extern_methods!(
#[unsafe(method(timestamp))]
#[unsafe(method_family = none)]
pub fn timestamp(&self) -> NSTimeInterval;
#[unsafe(method(phase))]
#[unsafe(method_family = none)]
pub fn phase(&self) -> UIPressPhase;
#[unsafe(method(type))]
#[unsafe(method_family = none)]
pub fn r#type(&self) -> UIPressType;
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
#[unsafe(method(window))]
#[unsafe(method_family = none)]
pub fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;
#[cfg(feature = "UIResponder")]
#[unsafe(method(responder))]
#[unsafe(method_family = none)]
pub fn responder(&self, mtm: MainThreadMarker) -> Option<Retained<UIResponder>>;
#[cfg(feature = "UIGestureRecognizer")]
#[unsafe(method(gestureRecognizers))]
#[unsafe(method_family = none)]
pub fn gestureRecognizers(
&self,
mtm: MainThreadMarker,
) -> Option<Retained<NSArray<UIGestureRecognizer>>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(force))]
#[unsafe(method_family = none)]
pub fn force(&self) -> CGFloat;
#[cfg(feature = "UIKey")]
#[unsafe(method(key))]
#[unsafe(method_family = none)]
pub fn key(&self, mtm: MainThreadMarker) -> Option<Retained<UIKey>>;
);
}
impl UIPress {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for UIPress {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}