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
91unsafe impl NSObjectProtocol for UIPencilInteraction {}
92
93#[cfg(feature = "UIInteraction")]
94unsafe impl UIInteraction for UIPencilInteraction {}
95
96impl UIPencilInteraction {
97 extern_methods!(
98 #[unsafe(method(preferredTapAction))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn preferredTapAction(mtm: MainThreadMarker) -> UIPencilPreferredAction;
102
103 #[unsafe(method(preferredSqueezeAction))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn preferredSqueezeAction(mtm: MainThreadMarker) -> UIPencilPreferredAction;
107
108 #[unsafe(method(prefersPencilOnlyDrawing))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn prefersPencilOnlyDrawing(mtm: MainThreadMarker) -> bool;
112
113 #[unsafe(method(prefersHoverToolPreview))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn prefersHoverToolPreview(mtm: MainThreadMarker) -> bool;
117
118 #[unsafe(method(initWithDelegate:))]
120 #[unsafe(method_family = init)]
121 pub unsafe fn initWithDelegate(
122 this: Allocated<Self>,
123 delegate: &ProtocolObject<dyn UIPencilInteractionDelegate>,
124 ) -> Retained<Self>;
125
126 #[unsafe(method(delegate))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn delegate(
130 &self,
131 ) -> Option<Retained<ProtocolObject<dyn UIPencilInteractionDelegate>>>;
132
133 #[unsafe(method(setDelegate:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setDelegate(
138 &self,
139 delegate: Option<&ProtocolObject<dyn UIPencilInteractionDelegate>>,
140 );
141
142 #[unsafe(method(isEnabled))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn isEnabled(&self) -> bool;
146
147 #[unsafe(method(setEnabled:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn setEnabled(&self, enabled: bool);
151 );
152}
153
154impl UIPencilInteraction {
156 extern_methods!(
157 #[unsafe(method(init))]
158 #[unsafe(method_family = init)]
159 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
160
161 #[unsafe(method(new))]
162 #[unsafe(method_family = new)]
163 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
164 );
165}
166
167extern_class!(
168 #[unsafe(super(NSObject))]
172 #[thread_kind = MainThreadOnly]
173 #[derive(Debug, PartialEq, Eq, Hash)]
174 pub struct UIPencilHoverPose;
175);
176
177unsafe impl NSObjectProtocol for UIPencilHoverPose {}
178
179impl UIPencilHoverPose {
180 extern_methods!(
181 #[unsafe(method(new))]
182 #[unsafe(method_family = new)]
183 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
184
185 #[unsafe(method(init))]
186 #[unsafe(method_family = init)]
187 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
188
189 #[cfg(feature = "objc2-core-foundation")]
190 #[unsafe(method(location))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn location(&self) -> CGPoint;
195
196 #[cfg(feature = "objc2-core-foundation")]
197 #[unsafe(method(zOffset))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn zOffset(&self) -> CGFloat;
202
203 #[cfg(feature = "objc2-core-foundation")]
204 #[unsafe(method(azimuthAngle))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn azimuthAngle(&self) -> CGFloat;
208
209 #[cfg(feature = "objc2-core-foundation")]
210 #[unsafe(method(azimuthUnitVector))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn azimuthUnitVector(&self) -> CGVector;
214
215 #[cfg(feature = "objc2-core-foundation")]
216 #[unsafe(method(altitudeAngle))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn altitudeAngle(&self) -> CGFloat;
221
222 #[cfg(feature = "objc2-core-foundation")]
223 #[unsafe(method(rollAngle))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn rollAngle(&self) -> CGFloat;
227 );
228}
229
230extern_class!(
231 #[unsafe(super(NSObject))]
235 #[thread_kind = MainThreadOnly]
236 #[derive(Debug, PartialEq, Eq, Hash)]
237 pub struct UIPencilInteractionTap;
238);
239
240unsafe impl NSObjectProtocol for UIPencilInteractionTap {}
241
242impl UIPencilInteractionTap {
243 extern_methods!(
244 #[unsafe(method(new))]
245 #[unsafe(method_family = new)]
246 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
247
248 #[unsafe(method(init))]
249 #[unsafe(method_family = init)]
250 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
251
252 #[unsafe(method(timestamp))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn timestamp(&self) -> NSTimeInterval;
256
257 #[unsafe(method(hoverPose))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn hoverPose(&self) -> Option<Retained<UIPencilHoverPose>>;
261 );
262}
263
264extern_class!(
265 #[unsafe(super(NSObject))]
269 #[thread_kind = MainThreadOnly]
270 #[derive(Debug, PartialEq, Eq, Hash)]
271 pub struct UIPencilInteractionSqueeze;
272);
273
274unsafe impl NSObjectProtocol for UIPencilInteractionSqueeze {}
275
276impl UIPencilInteractionSqueeze {
277 extern_methods!(
278 #[unsafe(method(new))]
279 #[unsafe(method_family = new)]
280 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
281
282 #[unsafe(method(init))]
283 #[unsafe(method_family = init)]
284 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
285
286 #[unsafe(method(timestamp))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn timestamp(&self) -> NSTimeInterval;
290
291 #[unsafe(method(phase))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn phase(&self) -> UIPencilInteractionPhase;
295
296 #[unsafe(method(hoverPose))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn hoverPose(&self) -> Option<Retained<UIPencilHoverPose>>;
300 );
301}
302
303extern_protocol!(
304 pub unsafe trait UIPencilInteractionDelegate: NSObjectProtocol + MainThreadOnly {
306 #[deprecated = "Use pencilInteraction(_:didReceiveTap:) instead"]
313 #[optional]
314 #[unsafe(method(pencilInteractionDidTap:))]
315 #[unsafe(method_family = none)]
316 unsafe fn pencilInteractionDidTap(&self, interaction: &UIPencilInteraction);
317
318 #[optional]
325 #[unsafe(method(pencilInteraction:didReceiveTap:))]
326 #[unsafe(method_family = none)]
327 unsafe fn pencilInteraction_didReceiveTap(
328 &self,
329 interaction: &UIPencilInteraction,
330 tap: &UIPencilInteractionTap,
331 );
332
333 #[optional]
338 #[unsafe(method(pencilInteraction:didReceiveSqueeze:))]
339 #[unsafe(method_family = none)]
340 unsafe fn pencilInteraction_didReceiveSqueeze(
341 &self,
342 interaction: &UIPencilInteraction,
343 squeeze: &UIPencilInteractionSqueeze,
344 );
345 }
346);