objc2-app-kit 0.3.2

Bindings to the AppKit 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::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintertablestatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPrinterTableStatus(pub NSUInteger);
impl NSPrinterTableStatus {
    #[doc(alias = "NSPrinterTableOK")]
    pub const OK: Self = Self(0);
    #[doc(alias = "NSPrinterTableNotFound")]
    pub const NotFound: Self = Self(1);
    #[doc(alias = "NSPrinterTableError")]
    pub const Error: Self = Self(2);
}

unsafe impl Encode for NSPrinterTableStatus {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintertypename?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSPrinterTypeName = NSString;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprinterpapername?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSPrinterPaperName = NSString;

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

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

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

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

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

impl NSPrinter {
    extern_methods!(
        #[unsafe(method(printerNames))]
        #[unsafe(method_family = none)]
        pub fn printerNames() -> Retained<NSArray<NSString>>;

        #[unsafe(method(printerTypes))]
        #[unsafe(method_family = none)]
        pub fn printerTypes() -> Retained<NSArray<NSPrinterTypeName>>;

        #[unsafe(method(printerWithName:))]
        #[unsafe(method_family = none)]
        pub fn printerWithName(name: &NSString) -> Option<Retained<NSPrinter>>;

        #[unsafe(method(printerWithType:))]
        #[unsafe(method_family = none)]
        pub fn printerWithType(r#type: &NSPrinterTypeName) -> Option<Retained<NSPrinter>>;

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

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub fn r#type(&self) -> Retained<NSPrinterTypeName>;

        #[unsafe(method(languageLevel))]
        #[unsafe(method_family = none)]
        pub fn languageLevel(&self) -> NSInteger;

        #[unsafe(method(pageSizeForPaper:))]
        #[unsafe(method_family = none)]
        pub fn pageSizeForPaper(&self, paper_name: &NSPrinterPaperName) -> NSSize;

        #[cfg(feature = "NSGraphics")]
        #[unsafe(method(deviceDescription))]
        #[unsafe(method_family = none)]
        pub fn deviceDescription(
            &self,
        ) -> Retained<NSDictionary<NSDeviceDescriptionKey, AnyObject>>;
    );
}

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

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

impl DefaultRetained for NSPrinter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// NSDeprecated.
impl NSPrinter {
    extern_methods!(
        #[deprecated]
        #[unsafe(method(statusForTable:))]
        #[unsafe(method_family = none)]
        pub fn statusForTable(&self, table_name: &NSString) -> NSPrinterTableStatus;

        #[deprecated]
        #[unsafe(method(isKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn isKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> bool;

        #[deprecated]
        #[unsafe(method(booleanForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn booleanForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> bool;

        #[deprecated]
        #[unsafe(method(floatForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn floatForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> c_float;

        #[deprecated]
        #[unsafe(method(intForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn intForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> c_int;

        #[deprecated]
        #[unsafe(method(rectForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn rectForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> NSRect;

        #[deprecated]
        #[unsafe(method(sizeForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn sizeForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> NSSize;

        #[deprecated]
        #[unsafe(method(stringForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn stringForKey_inTable(
            &self,
            key: Option<&NSString>,
            table: &NSString,
        ) -> Option<Retained<NSString>>;

        #[deprecated]
        #[unsafe(method(stringListForKey:inTable:))]
        #[unsafe(method_family = none)]
        pub fn stringListForKey_inTable(
            &self,
            key: Option<&NSString>,
            table: &NSString,
        ) -> Option<Retained<NSArray>>;

        #[deprecated]
        #[unsafe(method(imageRectForPaper:))]
        #[unsafe(method_family = none)]
        pub fn imageRectForPaper(&self, paper_name: Option<&NSString>) -> NSRect;

        #[deprecated]
        #[unsafe(method(acceptsBinary))]
        #[unsafe(method_family = none)]
        pub fn acceptsBinary(&self) -> bool;

        #[deprecated]
        #[unsafe(method(isColor))]
        #[unsafe(method_family = none)]
        pub fn isColor(&self) -> bool;

        #[deprecated]
        #[unsafe(method(isFontAvailable:))]
        #[unsafe(method_family = none)]
        pub fn isFontAvailable(&self, face_name: Option<&NSString>) -> bool;

        #[deprecated]
        #[unsafe(method(isOutputStackInReverseOrder))]
        #[unsafe(method_family = none)]
        pub fn isOutputStackInReverseOrder(&self) -> bool;

        #[deprecated]
        #[unsafe(method(printerWithName:domain:includeUnavailable:))]
        #[unsafe(method_family = none)]
        pub fn printerWithName_domain_includeUnavailable(
            name: &NSString,
            domain: Option<&NSString>,
            flag: bool,
        ) -> Option<Retained<NSPrinter>>;

        #[deprecated]
        #[unsafe(method(domain))]
        #[unsafe(method_family = none)]
        pub fn domain(&self) -> Retained<NSString>;

        #[deprecated]
        #[unsafe(method(host))]
        #[unsafe(method_family = none)]
        pub fn host(&self) -> Retained<NSString>;

        #[deprecated]
        #[unsafe(method(note))]
        #[unsafe(method_family = none)]
        pub fn note(&self) -> Retained<NSString>;
    );
}