objc2-pdf-kit 0.3.2

Bindings to the PDFKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
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/pdfkit/pdfborderstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PDFBorderStyle(pub NSInteger);
impl PDFBorderStyle {
    #[doc(alias = "kPDFBorderStyleSolid")]
    pub const Solid: Self = Self(0);
    #[doc(alias = "kPDFBorderStyleDashed")]
    pub const Dashed: Self = Self(1);
    #[doc(alias = "kPDFBorderStyleBeveled")]
    pub const Beveled: Self = Self(2);
    #[doc(alias = "kPDFBorderStyleInset")]
    pub const Inset: Self = Self(3);
    #[doc(alias = "kPDFBorderStyleUnderline")]
    pub const Underline: Self = Self(4);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfborderkey?language=objc)
// NS_TYPED_ENUM
pub type PDFBorderKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfborderkeylinewidth?language=objc)
    pub static PDFBorderKeyLineWidth: &'static PDFBorderKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfborderkeystyle?language=objc)
    pub static PDFBorderKeyStyle: &'static PDFBorderKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfborderkeydashpattern?language=objc)
    pub static PDFBorderKeyDashPattern: &'static PDFBorderKey;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/pdfkit/pdfborder?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PDFBorder;
);

extern_conformance!(
    unsafe impl NSCoding for PDFBorder {}
);

extern_conformance!(
    unsafe impl NSCopying for PDFBorder {}
);

unsafe impl CopyingHelper for PDFBorder {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for PDFBorder {}
);

impl PDFBorder {
    extern_methods!(
        #[unsafe(method(style))]
        #[unsafe(method_family = none)]
        pub unsafe fn style(&self) -> PDFBorderStyle;

        /// Setter for [`style`][Self::style].
        #[unsafe(method(setStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setStyle(&self, style: PDFBorderStyle);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(lineWidth))]
        #[unsafe(method_family = none)]
        pub unsafe fn lineWidth(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`lineWidth`][Self::lineWidth].
        #[unsafe(method(setLineWidth:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLineWidth(&self, line_width: CGFloat);

        #[unsafe(method(dashPattern))]
        #[unsafe(method_family = none)]
        pub unsafe fn dashPattern(&self) -> Option<Retained<NSArray>>;

        /// Setter for [`dashPattern`][Self::dashPattern].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `dash_pattern` generic should be of the correct type.
        #[unsafe(method(setDashPattern:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDashPattern(&self, dash_pattern: Option<&NSArray>);

        #[unsafe(method(borderKeyValues))]
        #[unsafe(method_family = none)]
        pub unsafe fn borderKeyValues(&self) -> Retained<NSDictionary>;

        #[unsafe(method(drawInRect:))]
        #[unsafe(method_family = none)]
        pub unsafe fn drawInRect(&self, rect: NSRect);
    );
}

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}