1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPrinterJobTypes(pub NSInteger);
bitflags::bitflags! {
    impl UIPrinterJobTypes: NSInteger {
        const UIPrinterJobTypeUnknown = 0;
        const UIPrinterJobTypeDocument = 1<<0;
        const UIPrinterJobTypeEnvelope = 1<<1;
        const UIPrinterJobTypeLabel = 1<<2;
        const UIPrinterJobTypePhoto = 1<<3;
        const UIPrinterJobTypeReceipt = 1<<4;
        const UIPrinterJobTypeRoll = 1<<5;
        const UIPrinterJobTypeLargeFormat = 1<<6;
        const UIPrinterJobTypePostcard = 1<<7;
    }
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIPrinter;

    unsafe impl ClassType for UIPrinter {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIPrinter {}

extern_methods!(
    unsafe impl UIPrinter {
        #[method_id(@__retain_semantics Other printerWithURL:)]
        pub unsafe fn printerWithURL(url: &NSURL, mtm: MainThreadMarker) -> Retained<UIPrinter>;

        #[method_id(@__retain_semantics Other URL)]
        pub unsafe fn URL(&self) -> Retained<NSURL>;

        #[method_id(@__retain_semantics Other displayName)]
        pub unsafe fn displayName(&self) -> Retained<NSString>;

        #[method_id(@__retain_semantics Other displayLocation)]
        pub unsafe fn displayLocation(&self) -> Option<Retained<NSString>>;

        #[method(supportedJobTypes)]
        pub unsafe fn supportedJobTypes(&self) -> UIPrinterJobTypes;

        #[method_id(@__retain_semantics Other makeAndModel)]
        pub unsafe fn makeAndModel(&self) -> Option<Retained<NSString>>;

        #[method(supportsColor)]
        pub unsafe fn supportsColor(&self) -> bool;

        #[method(supportsDuplex)]
        pub unsafe fn supportsDuplex(&self) -> bool;

        #[cfg(feature = "block2")]
        #[method(contactPrinter:)]
        pub unsafe fn contactPrinter(
            &self,
            completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIPrinter {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);