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-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A tool for drawing on a PKCanvasView.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/pencilkit/pkinkingtool?language=objc)
    #[unsafe(super(PKTool, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "PKTool")]
    pub struct PKInkingTool;
);

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

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

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

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

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

#[cfg(feature = "PKTool")]
impl PKInkingTool {
    extern_methods!(
        #[cfg(all(
            feature = "PKInkType",
            feature = "objc2-app-kit",
            feature = "objc2-core-foundation"
        ))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(initWithInkType:color:width:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInkType_color_width(
            this: Allocated<Self>,
            r#type: &PKInkType,
            color: &NSColor,
            width: CGFloat,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "PKInkType",
            feature = "objc2-app-kit",
            feature = "objc2-core-foundation"
        ))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(initWithInkType:color:width:azimuth:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInkType_color_width_azimuth(
            this: Allocated<Self>,
            r#type: &PKInkType,
            color: &NSColor,
            width: CGFloat,
            angle: CGFloat,
        ) -> Retained<Self>;

        #[cfg(all(feature = "PKInkType", feature = "objc2-app-kit"))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(initWithInkType:color:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInkType_color(
            this: Allocated<Self>,
            r#type: &PKInkType,
            color: &NSColor,
        ) -> Retained<Self>;

        #[cfg(all(feature = "PKInk", feature = "objc2-core-foundation"))]
        /// Create a new inking tool for the provided ink.
        ///
        ///
        /// Parameter `ink`: The ink to use.
        ///
        /// Parameter `width`: The width of stroke to create.
        #[unsafe(method(initWithInk:width:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithInk_width(
            this: Allocated<Self>,
            ink: &PKInk,
            width: CGFloat,
        ) -> Retained<Self>;

        #[cfg(all(feature = "PKInkType", feature = "objc2-core-foundation"))]
        /// The default width for an ink of a type.
        #[unsafe(method(defaultWidthForInkType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn defaultWidthForInkType(ink_type: &PKInkType) -> CGFloat;

        #[cfg(all(feature = "PKInkType", feature = "objc2-core-foundation"))]
        /// The minimum width for an ink of a type.
        #[unsafe(method(minimumWidthForInkType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumWidthForInkType(ink_type: &PKInkType) -> CGFloat;

        #[cfg(all(feature = "PKInkType", feature = "objc2-core-foundation"))]
        /// The maximum width for an ink of a type.
        #[unsafe(method(maximumWidthForInkType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumWidthForInkType(ink_type: &PKInkType) -> CGFloat;

        #[cfg(feature = "PKInkType")]
        /// The type of ink, eg. pen, pencil...
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(inkType))]
        #[unsafe(method_family = none)]
        pub unsafe fn inkType(&self) -> Retained<PKInkType>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Converts a color from light to dark appearance or vice versa.
        ///
        ///
        /// Parameter `color`: The color to be inverted light
        /// <
        /// ->dark.
        ///
        /// Returns: The inverted color.
        ///
        /// This has the same effect as `convertColor` with opposite user interface styles.
        #[unsafe(method(invertColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn invertColor(color: &CGColor) -> Retained<CGColor>;

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(color))]
        #[unsafe(method_family = none)]
        pub unsafe fn color(&self) -> Retained<NSColor>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The base width of the ink.
        ///
        /// 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 base angle of the ink.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(azimuth))]
        #[unsafe(method_family = none)]
        pub unsafe fn azimuth(&self) -> CGFloat;

        #[cfg(feature = "PKInk")]
        /// The ink that this tool will create strokes with.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(ink))]
        #[unsafe(method_family = none)]
        pub unsafe fn ink(&self) -> Retained<PKInk>;

        #[cfg(feature = "PKContentVersion")]
        /// The PencilKit version required to use this inking tool.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(requiredContentVersion))]
        #[unsafe(method_family = none)]
        pub unsafe fn requiredContentVersion(&self) -> PKContentVersion;
    );
}

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