objc2_pencil_kit/generated/
PKEraserTool.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkerasertype?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct PKEraserType(pub NSInteger);
16impl PKEraserType {
17    #[doc(alias = "PKEraserTypeVector")]
18    pub const Vector: Self = Self(0);
19    #[doc(alias = "PKEraserTypeBitmap")]
20    pub const Bitmap: Self = Self(1);
21    #[doc(alias = "PKEraserTypeFixedWidthBitmap")]
22    pub const FixedWidthBitmap: Self = Self(2);
23}
24
25unsafe impl Encode for PKEraserType {
26    const ENCODING: Encoding = NSInteger::ENCODING;
27}
28
29unsafe impl RefEncode for PKEraserType {
30    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33extern_class!(
34    /// An eraser tool for erasing parts of a drawing.
35    ///
36    /// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkerasertool?language=objc)
37    #[unsafe(super(PKTool, NSObject))]
38    #[derive(Debug, PartialEq, Eq, Hash)]
39    #[cfg(feature = "PKTool")]
40    pub struct PKEraserTool;
41);
42
43#[cfg(feature = "PKTool")]
44unsafe impl Send for PKEraserTool {}
45
46#[cfg(feature = "PKTool")]
47unsafe impl Sync for PKEraserTool {}
48
49#[cfg(feature = "PKTool")]
50extern_conformance!(
51    unsafe impl NSCopying for PKEraserTool {}
52);
53
54#[cfg(feature = "PKTool")]
55unsafe impl CopyingHelper for PKEraserTool {
56    type Result = Self;
57}
58
59#[cfg(feature = "PKTool")]
60extern_conformance!(
61    unsafe impl NSObjectProtocol for PKEraserTool {}
62);
63
64#[cfg(feature = "PKTool")]
65impl PKEraserTool {
66    extern_methods!(
67        /// The eraser type.
68        ///
69        /// This property is not atomic.
70        ///
71        /// # Safety
72        ///
73        /// This might not be thread-safe.
74        #[unsafe(method(eraserType))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn eraserType(&self) -> PKEraserType;
77
78        #[unsafe(method(initWithEraserType:))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn initWithEraserType(
81            this: Allocated<Self>,
82            eraser_type: PKEraserType,
83        ) -> Retained<Self>;
84
85        #[cfg(feature = "objc2-core-foundation")]
86        /// Create a new eraser tool with a width.
87        ///
88        /// Parameter `eraserType`: The type of eraser.
89        ///
90        /// Parameter `width`: The width of the eraser.
91        #[unsafe(method(initWithEraserType:width:))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn initWithEraserType_width(
94            this: Allocated<Self>,
95            eraser_type: PKEraserType,
96            width: CGFloat,
97        ) -> Retained<Self>;
98
99        #[cfg(feature = "objc2-core-foundation")]
100        /// The width of the eraser.
101        ///
102        /// This property is not atomic.
103        ///
104        /// # Safety
105        ///
106        /// This might not be thread-safe.
107        #[unsafe(method(width))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn width(&self) -> CGFloat;
110
111        #[cfg(feature = "objc2-core-foundation")]
112        /// The default width for an eraser type.
113        #[unsafe(method(defaultWidthForEraserType:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn defaultWidthForEraserType(eraser_type: PKEraserType) -> CGFloat;
116
117        #[cfg(feature = "objc2-core-foundation")]
118        /// The minimum width for an eraser type.
119        #[unsafe(method(minimumWidthForEraserType:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn minimumWidthForEraserType(eraser_type: PKEraserType) -> CGFloat;
122
123        #[cfg(feature = "objc2-core-foundation")]
124        /// The maximum width for an eraser type.
125        #[unsafe(method(maximumWidthForEraserType:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn maximumWidthForEraserType(eraser_type: PKEraserType) -> CGFloat;
128    );
129}
130
131/// Methods declared on superclass `PKTool`.
132#[cfg(feature = "PKTool")]
133impl PKEraserTool {
134    extern_methods!(
135        #[unsafe(method(init))]
136        #[unsafe(method_family = init)]
137        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
138    );
139}
140
141/// Methods declared on superclass `NSObject`.
142#[cfg(feature = "PKTool")]
143impl PKEraserTool {
144    extern_methods!(
145        #[unsafe(method(new))]
146        #[unsafe(method_family = new)]
147        pub unsafe fn new() -> Retained<Self>;
148    );
149}