objc2_ui_kit/generated/
UIPanGestureRecognizer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrolltype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIScrollType(pub NSUInteger);
17impl UIScrollType {
18    #[doc(alias = "UIScrollTypeDiscrete")]
19    pub const Discrete: Self = Self(0);
20    #[doc(alias = "UIScrollTypeContinuous")]
21    pub const Continuous: Self = Self(1);
22}
23
24unsafe impl Encode for UIScrollType {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UIScrollType {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiscrolltypemask?language=objc)
33// NS_OPTIONS
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct UIScrollTypeMask(pub NSInteger);
37bitflags::bitflags! {
38    impl UIScrollTypeMask: NSInteger {
39        #[doc(alias = "UIScrollTypeMaskDiscrete")]
40        const Discrete = 1<<UIScrollType::Discrete.0;
41        #[doc(alias = "UIScrollTypeMaskContinuous")]
42        const Continuous = 1<<UIScrollType::Continuous.0;
43        #[doc(alias = "UIScrollTypeMaskAll")]
44        const All = UIScrollTypeMask::Discrete.0|UIScrollTypeMask::Continuous.0;
45    }
46}
47
48unsafe impl Encode for UIScrollTypeMask {
49    const ENCODING: Encoding = NSInteger::ENCODING;
50}
51
52unsafe impl RefEncode for UIScrollTypeMask {
53    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56extern_class!(
57    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipangesturerecognizer?language=objc)
58    #[unsafe(super(UIGestureRecognizer, NSObject))]
59    #[thread_kind = MainThreadOnly]
60    #[derive(Debug, PartialEq, Eq, Hash)]
61    #[cfg(feature = "UIGestureRecognizer")]
62    pub struct UIPanGestureRecognizer;
63);
64
65#[cfg(feature = "UIGestureRecognizer")]
66unsafe impl NSObjectProtocol for UIPanGestureRecognizer {}
67
68#[cfg(feature = "UIGestureRecognizer")]
69impl UIPanGestureRecognizer {
70    extern_methods!(
71        #[unsafe(method(minimumNumberOfTouches))]
72        #[unsafe(method_family = none)]
73        pub fn minimumNumberOfTouches(&self) -> NSUInteger;
74
75        /// Setter for [`minimumNumberOfTouches`][Self::minimumNumberOfTouches].
76        #[unsafe(method(setMinimumNumberOfTouches:))]
77        #[unsafe(method_family = none)]
78        pub fn setMinimumNumberOfTouches(&self, minimum_number_of_touches: NSUInteger);
79
80        #[unsafe(method(maximumNumberOfTouches))]
81        #[unsafe(method_family = none)]
82        pub fn maximumNumberOfTouches(&self) -> NSUInteger;
83
84        /// Setter for [`maximumNumberOfTouches`][Self::maximumNumberOfTouches].
85        #[unsafe(method(setMaximumNumberOfTouches:))]
86        #[unsafe(method_family = none)]
87        pub fn setMaximumNumberOfTouches(&self, maximum_number_of_touches: NSUInteger);
88
89        #[cfg(all(
90            feature = "UIResponder",
91            feature = "UIView",
92            feature = "objc2-core-foundation"
93        ))]
94        #[unsafe(method(translationInView:))]
95        #[unsafe(method_family = none)]
96        pub fn translationInView(&self, view: Option<&UIView>) -> CGPoint;
97
98        #[cfg(all(
99            feature = "UIResponder",
100            feature = "UIView",
101            feature = "objc2-core-foundation"
102        ))]
103        #[unsafe(method(setTranslation:inView:))]
104        #[unsafe(method_family = none)]
105        pub fn setTranslation_inView(&self, translation: CGPoint, view: Option<&UIView>);
106
107        #[cfg(all(
108            feature = "UIResponder",
109            feature = "UIView",
110            feature = "objc2-core-foundation"
111        ))]
112        #[unsafe(method(velocityInView:))]
113        #[unsafe(method_family = none)]
114        pub fn velocityInView(&self, view: Option<&UIView>) -> CGPoint;
115
116        #[unsafe(method(allowedScrollTypesMask))]
117        #[unsafe(method_family = none)]
118        pub fn allowedScrollTypesMask(&self) -> UIScrollTypeMask;
119
120        /// Setter for [`allowedScrollTypesMask`][Self::allowedScrollTypesMask].
121        #[unsafe(method(setAllowedScrollTypesMask:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setAllowedScrollTypesMask(&self, allowed_scroll_types_mask: UIScrollTypeMask);
124    );
125}
126
127/// Methods declared on superclass `UIGestureRecognizer`.
128#[cfg(feature = "UIGestureRecognizer")]
129impl UIPanGestureRecognizer {
130    extern_methods!(
131        #[unsafe(method(initWithTarget:action:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithTarget_action(
134            this: Allocated<Self>,
135            target: Option<&AnyObject>,
136            action: Option<Sel>,
137        ) -> Retained<Self>;
138
139        #[unsafe(method(init))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
142
143        #[unsafe(method(initWithCoder:))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn initWithCoder(
146            this: Allocated<Self>,
147            coder: &NSCoder,
148        ) -> Option<Retained<Self>>;
149    );
150}
151
152/// Methods declared on superclass `NSObject`.
153#[cfg(feature = "UIGestureRecognizer")]
154impl UIPanGestureRecognizer {
155    extern_methods!(
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
159    );
160}