objc2_ui_kit/generated/
UIPanGestureRecognizer.rs1use 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#[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#[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 #[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")]
66extern_conformance!(
67 unsafe impl NSObjectProtocol for UIPanGestureRecognizer {}
68);
69
70#[cfg(feature = "UIGestureRecognizer")]
71impl UIPanGestureRecognizer {
72 extern_methods!(
73 #[unsafe(method(minimumNumberOfTouches))]
74 #[unsafe(method_family = none)]
75 pub fn minimumNumberOfTouches(&self) -> NSUInteger;
76
77 #[unsafe(method(setMinimumNumberOfTouches:))]
79 #[unsafe(method_family = none)]
80 pub fn setMinimumNumberOfTouches(&self, minimum_number_of_touches: NSUInteger);
81
82 #[unsafe(method(maximumNumberOfTouches))]
83 #[unsafe(method_family = none)]
84 pub fn maximumNumberOfTouches(&self) -> NSUInteger;
85
86 #[unsafe(method(setMaximumNumberOfTouches:))]
88 #[unsafe(method_family = none)]
89 pub fn setMaximumNumberOfTouches(&self, maximum_number_of_touches: NSUInteger);
90
91 #[cfg(all(
92 feature = "UIResponder",
93 feature = "UIView",
94 feature = "objc2-core-foundation"
95 ))]
96 #[unsafe(method(translationInView:))]
97 #[unsafe(method_family = none)]
98 pub fn translationInView(&self, view: Option<&UIView>) -> CGPoint;
99
100 #[cfg(all(
101 feature = "UIResponder",
102 feature = "UIView",
103 feature = "objc2-core-foundation"
104 ))]
105 #[unsafe(method(setTranslation:inView:))]
106 #[unsafe(method_family = none)]
107 pub fn setTranslation_inView(&self, translation: CGPoint, view: Option<&UIView>);
108
109 #[cfg(all(
110 feature = "UIResponder",
111 feature = "UIView",
112 feature = "objc2-core-foundation"
113 ))]
114 #[unsafe(method(velocityInView:))]
115 #[unsafe(method_family = none)]
116 pub fn velocityInView(&self, view: Option<&UIView>) -> CGPoint;
117
118 #[unsafe(method(allowedScrollTypesMask))]
119 #[unsafe(method_family = none)]
120 pub fn allowedScrollTypesMask(&self) -> UIScrollTypeMask;
121
122 #[unsafe(method(setAllowedScrollTypesMask:))]
124 #[unsafe(method_family = none)]
125 pub fn setAllowedScrollTypesMask(&self, allowed_scroll_types_mask: UIScrollTypeMask);
126 );
127}
128
129#[cfg(feature = "UIGestureRecognizer")]
131impl UIPanGestureRecognizer {
132 extern_methods!(
133 #[unsafe(method(initWithTarget:action:))]
138 #[unsafe(method_family = init)]
139 pub unsafe fn initWithTarget_action(
140 this: Allocated<Self>,
141 target: Option<&AnyObject>,
142 action: Option<Sel>,
143 ) -> Retained<Self>;
144
145 #[unsafe(method(init))]
146 #[unsafe(method_family = init)]
147 pub fn init(this: Allocated<Self>) -> Retained<Self>;
148
149 #[unsafe(method(initWithCoder:))]
153 #[unsafe(method_family = init)]
154 pub unsafe fn initWithCoder(
155 this: Allocated<Self>,
156 coder: &NSCoder,
157 ) -> Option<Retained<Self>>;
158 );
159}
160
161#[cfg(feature = "UIGestureRecognizer")]
163impl UIPanGestureRecognizer {
164 extern_methods!(
165 #[unsafe(method(new))]
166 #[unsafe(method_family = new)]
167 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
168 );
169}