objc2-pencil-kit 0.3.2

Bindings to the PencilKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkerasertype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PKEraserType(pub NSInteger);
impl PKEraserType {
    #[doc(alias = "PKEraserTypeVector")]
    pub const Vector: Self = Self(0);
    #[doc(alias = "PKEraserTypeBitmap")]
    pub const Bitmap: Self = Self(1);
    #[doc(alias = "PKEraserTypeFixedWidthBitmap")]
    pub const FixedWidthBitmap: Self = Self(2);
}

unsafe impl Encode for PKEraserType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for PKEraserType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// An eraser tool for erasing parts of a drawing.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkerasertool?language=objc)
    #[unsafe(super(PKTool, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "PKTool")]
    pub struct PKEraserTool;
);

#[cfg(feature = "PKTool")]
unsafe impl Send for PKEraserTool {}

#[cfg(feature = "PKTool")]
unsafe impl Sync for PKEraserTool {}

#[cfg(feature = "PKTool")]
extern_conformance!(
    unsafe impl NSCopying for PKEraserTool {}
);

#[cfg(feature = "PKTool")]
unsafe impl CopyingHelper for PKEraserTool {
    type Result = Self;
}

#[cfg(feature = "PKTool")]
extern_conformance!(
    unsafe impl NSObjectProtocol for PKEraserTool {}
);

#[cfg(feature = "PKTool")]
impl PKEraserTool {
    extern_methods!(
        /// The eraser type.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(eraserType))]
        #[unsafe(method_family = none)]
        pub unsafe fn eraserType(&self) -> PKEraserType;

        #[unsafe(method(initWithEraserType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEraserType(
            this: Allocated<Self>,
            eraser_type: PKEraserType,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Create a new eraser tool with a width.
        ///
        /// Parameter `eraserType`: The type of eraser.
        ///
        /// Parameter `width`: The width of the eraser.
        #[unsafe(method(initWithEraserType:width:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEraserType_width(
            this: Allocated<Self>,
            eraser_type: PKEraserType,
            width: CGFloat,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The width of the eraser.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(width))]
        #[unsafe(method_family = none)]
        pub unsafe fn width(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// The default width for an eraser type.
        #[unsafe(method(defaultWidthForEraserType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultWidthForEraserType(eraser_type: PKEraserType) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// The minimum width for an eraser type.
        #[unsafe(method(minimumWidthForEraserType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumWidthForEraserType(eraser_type: PKEraserType) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// The maximum width for an eraser type.
        #[unsafe(method(maximumWidthForEraserType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumWidthForEraserType(eraser_type: PKEraserType) -> CGFloat;
    );
}

/// Methods declared on superclass `PKTool`.
#[cfg(feature = "PKTool")]
impl PKEraserTool {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "PKTool")]
impl PKEraserTool {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}