objc2_ui_kit/generated/
UIPencilInteraction.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)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct UIPencilPreferredAction(pub NSInteger);
19impl UIPencilPreferredAction {
20 #[doc(alias = "UIPencilPreferredActionIgnore")]
22 pub const Ignore: Self = Self(0);
23 #[doc(alias = "UIPencilPreferredActionSwitchEraser")]
25 pub const SwitchEraser: Self = Self(1);
26 #[doc(alias = "UIPencilPreferredActionSwitchPrevious")]
28 pub const SwitchPrevious: Self = Self(2);
29 #[doc(alias = "UIPencilPreferredActionShowColorPalette")]
31 pub const ShowColorPalette: Self = Self(3);
32 #[doc(alias = "UIPencilPreferredActionShowInkAttributes")]
34 pub const ShowInkAttributes: Self = Self(4);
35 #[doc(alias = "UIPencilPreferredActionShowContextualPalette")]
37 pub const ShowContextualPalette: Self = Self(5);
38 #[doc(alias = "UIPencilPreferredActionRunSystemShortcut")]
40 pub const RunSystemShortcut: Self = Self(6);
41}
42
43unsafe impl Encode for UIPencilPreferredAction {
44 const ENCODING: Encoding = NSInteger::ENCODING;
45}
46
47unsafe impl RefEncode for UIPencilPreferredAction {
48 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
49}
50
51#[repr(transparent)]
58#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
59pub struct UIPencilInteractionPhase(pub NSUInteger);
60impl UIPencilInteractionPhase {
61 #[doc(alias = "UIPencilInteractionPhaseBegan")]
63 pub const Began: Self = Self(0);
64 #[doc(alias = "UIPencilInteractionPhaseChanged")]
66 pub const Changed: Self = Self(1);
67 #[doc(alias = "UIPencilInteractionPhaseEnded")]
69 pub const Ended: Self = Self(2);
70 #[doc(alias = "UIPencilInteractionPhaseCancelled")]
72 pub const Cancelled: Self = Self(3);
73}
74
75unsafe impl Encode for UIPencilInteractionPhase {
76 const ENCODING: Encoding = NSUInteger::ENCODING;
77}
78
79unsafe impl RefEncode for UIPencilInteractionPhase {
80 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
81}
82
83extern_class!(
84 #[unsafe(super(NSObject))]
86 #[thread_kind = MainThreadOnly]
87 #[derive(Debug, PartialEq, Eq, Hash)]
88 pub struct UIPencilInteraction;
89);
90
91extern_conformance!(
92 unsafe impl NSObjectProtocol for UIPencilInteraction {}
93);
94
95#[cfg(feature = "UIInteraction")]
96extern_conformance!(
97 unsafe impl UIInteraction for UIPencilInteraction {}
98);
99
100impl UIPencilInteraction {
101 extern_methods!(
102 #[unsafe(method(preferredTapAction))]
104 #[unsafe(method_family = none)]
105 pub fn preferredTapAction(mtm: MainThreadMarker) -> UIPencilPreferredAction;
106
107 #[unsafe(method(preferredSqueezeAction))]
109 #[unsafe(method_family = none)]
110 pub fn preferredSqueezeAction(mtm: MainThreadMarker) -> UIPencilPreferredAction;
111
112 #[unsafe(method(prefersPencilOnlyDrawing))]
114 #[unsafe(method_family = none)]
115 pub fn prefersPencilOnlyDrawing(mtm: MainThreadMarker) -> bool;
116
117 #[unsafe(method(prefersHoverToolPreview))]
119 #[unsafe(method_family = none)]
120 pub fn prefersHoverToolPreview(mtm: MainThreadMarker) -> bool;
121
122 #[unsafe(method(initWithDelegate:))]
124 #[unsafe(method_family = init)]
125 pub fn initWithDelegate(
126 this: Allocated<Self>,
127 delegate: &ProtocolObject<dyn UIPencilInteractionDelegate>,
128 ) -> Retained<Self>;
129
130 #[unsafe(method(delegate))]
132 #[unsafe(method_family = none)]
133 pub fn delegate(&self)
134 -> Option<Retained<ProtocolObject<dyn UIPencilInteractionDelegate>>>;
135
136 #[unsafe(method(setDelegate:))]
140 #[unsafe(method_family = none)]
141 pub fn setDelegate(
142 &self,
143 delegate: Option<&ProtocolObject<dyn UIPencilInteractionDelegate>>,
144 );
145
146 #[unsafe(method(isEnabled))]
148 #[unsafe(method_family = none)]
149 pub fn isEnabled(&self) -> bool;
150
151 #[unsafe(method(setEnabled:))]
153 #[unsafe(method_family = none)]
154 pub fn setEnabled(&self, enabled: bool);
155 );
156}
157
158impl UIPencilInteraction {
160 extern_methods!(
161 #[unsafe(method(init))]
162 #[unsafe(method_family = init)]
163 pub fn init(this: Allocated<Self>) -> Retained<Self>;
164
165 #[unsafe(method(new))]
166 #[unsafe(method_family = new)]
167 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
168 );
169}
170
171extern_class!(
172 #[unsafe(super(NSObject))]
176 #[thread_kind = MainThreadOnly]
177 #[derive(Debug, PartialEq, Eq, Hash)]
178 pub struct UIPencilHoverPose;
179);
180
181extern_conformance!(
182 unsafe impl NSObjectProtocol for UIPencilHoverPose {}
183);
184
185impl UIPencilHoverPose {
186 extern_methods!(
187 #[unsafe(method(new))]
188 #[unsafe(method_family = new)]
189 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
190
191 #[unsafe(method(init))]
192 #[unsafe(method_family = init)]
193 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
194
195 #[cfg(feature = "objc2-core-foundation")]
196 #[unsafe(method(location))]
199 #[unsafe(method_family = none)]
200 pub fn location(&self) -> CGPoint;
201
202 #[cfg(feature = "objc2-core-foundation")]
203 #[unsafe(method(zOffset))]
206 #[unsafe(method_family = none)]
207 pub fn zOffset(&self) -> CGFloat;
208
209 #[cfg(feature = "objc2-core-foundation")]
210 #[unsafe(method(azimuthAngle))]
212 #[unsafe(method_family = none)]
213 pub fn azimuthAngle(&self) -> CGFloat;
214
215 #[cfg(feature = "objc2-core-foundation")]
216 #[unsafe(method(azimuthUnitVector))]
218 #[unsafe(method_family = none)]
219 pub fn azimuthUnitVector(&self) -> CGVector;
220
221 #[cfg(feature = "objc2-core-foundation")]
222 #[unsafe(method(altitudeAngle))]
225 #[unsafe(method_family = none)]
226 pub fn altitudeAngle(&self) -> CGFloat;
227
228 #[cfg(feature = "objc2-core-foundation")]
229 #[unsafe(method(rollAngle))]
231 #[unsafe(method_family = none)]
232 pub fn rollAngle(&self) -> CGFloat;
233 );
234}
235
236extern_class!(
237 #[unsafe(super(NSObject))]
241 #[thread_kind = MainThreadOnly]
242 #[derive(Debug, PartialEq, Eq, Hash)]
243 pub struct UIPencilInteractionTap;
244);
245
246extern_conformance!(
247 unsafe impl NSObjectProtocol for UIPencilInteractionTap {}
248);
249
250impl UIPencilInteractionTap {
251 extern_methods!(
252 #[unsafe(method(new))]
253 #[unsafe(method_family = new)]
254 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
255
256 #[unsafe(method(init))]
257 #[unsafe(method_family = init)]
258 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
259
260 #[unsafe(method(timestamp))]
262 #[unsafe(method_family = none)]
263 pub fn timestamp(&self) -> NSTimeInterval;
264
265 #[unsafe(method(hoverPose))]
267 #[unsafe(method_family = none)]
268 pub fn hoverPose(&self) -> Option<Retained<UIPencilHoverPose>>;
269 );
270}
271
272extern_class!(
273 #[unsafe(super(NSObject))]
277 #[thread_kind = MainThreadOnly]
278 #[derive(Debug, PartialEq, Eq, Hash)]
279 pub struct UIPencilInteractionSqueeze;
280);
281
282extern_conformance!(
283 unsafe impl NSObjectProtocol for UIPencilInteractionSqueeze {}
284);
285
286impl UIPencilInteractionSqueeze {
287 extern_methods!(
288 #[unsafe(method(new))]
289 #[unsafe(method_family = new)]
290 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
291
292 #[unsafe(method(init))]
293 #[unsafe(method_family = init)]
294 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
295
296 #[unsafe(method(timestamp))]
298 #[unsafe(method_family = none)]
299 pub fn timestamp(&self) -> NSTimeInterval;
300
301 #[unsafe(method(phase))]
303 #[unsafe(method_family = none)]
304 pub fn phase(&self) -> UIPencilInteractionPhase;
305
306 #[unsafe(method(hoverPose))]
308 #[unsafe(method_family = none)]
309 pub fn hoverPose(&self) -> Option<Retained<UIPencilHoverPose>>;
310 );
311}
312
313extern_protocol!(
314 pub unsafe trait UIPencilInteractionDelegate: NSObjectProtocol + MainThreadOnly {
316 #[deprecated = "Use pencilInteraction(_:didReceiveTap:) instead"]
323 #[optional]
324 #[unsafe(method(pencilInteractionDidTap:))]
325 #[unsafe(method_family = none)]
326 fn pencilInteractionDidTap(&self, interaction: &UIPencilInteraction);
327
328 #[optional]
335 #[unsafe(method(pencilInteraction:didReceiveTap:))]
336 #[unsafe(method_family = none)]
337 fn pencilInteraction_didReceiveTap(
338 &self,
339 interaction: &UIPencilInteraction,
340 tap: &UIPencilInteractionTap,
341 );
342
343 #[optional]
348 #[unsafe(method(pencilInteraction:didReceiveSqueeze:))]
349 #[unsafe(method_family = none)]
350 fn pencilInteraction_didReceiveSqueeze(
351 &self,
352 interaction: &UIPencilInteraction,
353 squeeze: &UIPencilInteractionSqueeze,
354 );
355 }
356);