objc2_app_kit/generated/
NSPrinter.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintertablestatus?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSPrinterTableStatus(pub NSUInteger);
15impl NSPrinterTableStatus {
16    #[doc(alias = "NSPrinterTableOK")]
17    pub const OK: Self = Self(0);
18    #[doc(alias = "NSPrinterTableNotFound")]
19    pub const NotFound: Self = Self(1);
20    #[doc(alias = "NSPrinterTableError")]
21    pub const Error: Self = Self(2);
22}
23
24unsafe impl Encode for NSPrinterTableStatus {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSPrinterTableStatus {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintertypename?language=objc)
33// NS_TYPED_EXTENSIBLE_ENUM
34pub type NSPrinterTypeName = NSString;
35
36/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprinterpapername?language=objc)
37// NS_TYPED_EXTENSIBLE_ENUM
38pub type NSPrinterPaperName = NSString;
39
40extern_class!(
41    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprinter?language=objc)
42    #[unsafe(super(NSObject))]
43    #[derive(Debug, PartialEq, Eq, Hash)]
44    pub struct NSPrinter;
45);
46
47extern_conformance!(
48    unsafe impl NSCoding for NSPrinter {}
49);
50
51extern_conformance!(
52    unsafe impl NSCopying for NSPrinter {}
53);
54
55unsafe impl CopyingHelper for NSPrinter {
56    type Result = Self;
57}
58
59extern_conformance!(
60    unsafe impl NSObjectProtocol for NSPrinter {}
61);
62
63impl NSPrinter {
64    extern_methods!(
65        #[unsafe(method(printerNames))]
66        #[unsafe(method_family = none)]
67        pub fn printerNames() -> Retained<NSArray<NSString>>;
68
69        #[unsafe(method(printerTypes))]
70        #[unsafe(method_family = none)]
71        pub fn printerTypes() -> Retained<NSArray<NSPrinterTypeName>>;
72
73        #[unsafe(method(printerWithName:))]
74        #[unsafe(method_family = none)]
75        pub fn printerWithName(name: &NSString) -> Option<Retained<NSPrinter>>;
76
77        #[unsafe(method(printerWithType:))]
78        #[unsafe(method_family = none)]
79        pub fn printerWithType(r#type: &NSPrinterTypeName) -> Option<Retained<NSPrinter>>;
80
81        #[unsafe(method(name))]
82        #[unsafe(method_family = none)]
83        pub fn name(&self) -> Retained<NSString>;
84
85        #[unsafe(method(type))]
86        #[unsafe(method_family = none)]
87        pub fn r#type(&self) -> Retained<NSPrinterTypeName>;
88
89        #[unsafe(method(languageLevel))]
90        #[unsafe(method_family = none)]
91        pub fn languageLevel(&self) -> NSInteger;
92
93        #[unsafe(method(pageSizeForPaper:))]
94        #[unsafe(method_family = none)]
95        pub fn pageSizeForPaper(&self, paper_name: &NSPrinterPaperName) -> NSSize;
96
97        #[cfg(feature = "NSGraphics")]
98        #[unsafe(method(deviceDescription))]
99        #[unsafe(method_family = none)]
100        pub fn deviceDescription(
101            &self,
102        ) -> Retained<NSDictionary<NSDeviceDescriptionKey, AnyObject>>;
103    );
104}
105
106/// Methods declared on superclass `NSObject`.
107impl NSPrinter {
108    extern_methods!(
109        #[unsafe(method(init))]
110        #[unsafe(method_family = init)]
111        pub fn init(this: Allocated<Self>) -> Retained<Self>;
112
113        #[unsafe(method(new))]
114        #[unsafe(method_family = new)]
115        pub fn new() -> Retained<Self>;
116    );
117}
118
119impl DefaultRetained for NSPrinter {
120    #[inline]
121    fn default_retained() -> Retained<Self> {
122        Self::new()
123    }
124}
125
126/// NSDeprecated.
127impl NSPrinter {
128    extern_methods!(
129        #[deprecated]
130        #[unsafe(method(statusForTable:))]
131        #[unsafe(method_family = none)]
132        pub fn statusForTable(&self, table_name: &NSString) -> NSPrinterTableStatus;
133
134        #[deprecated]
135        #[unsafe(method(isKey:inTable:))]
136        #[unsafe(method_family = none)]
137        pub fn isKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> bool;
138
139        #[deprecated]
140        #[unsafe(method(booleanForKey:inTable:))]
141        #[unsafe(method_family = none)]
142        pub fn booleanForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> bool;
143
144        #[deprecated]
145        #[unsafe(method(floatForKey:inTable:))]
146        #[unsafe(method_family = none)]
147        pub fn floatForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> c_float;
148
149        #[deprecated]
150        #[unsafe(method(intForKey:inTable:))]
151        #[unsafe(method_family = none)]
152        pub fn intForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> c_int;
153
154        #[deprecated]
155        #[unsafe(method(rectForKey:inTable:))]
156        #[unsafe(method_family = none)]
157        pub fn rectForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> NSRect;
158
159        #[deprecated]
160        #[unsafe(method(sizeForKey:inTable:))]
161        #[unsafe(method_family = none)]
162        pub fn sizeForKey_inTable(&self, key: Option<&NSString>, table: &NSString) -> NSSize;
163
164        #[deprecated]
165        #[unsafe(method(stringForKey:inTable:))]
166        #[unsafe(method_family = none)]
167        pub fn stringForKey_inTable(
168            &self,
169            key: Option<&NSString>,
170            table: &NSString,
171        ) -> Option<Retained<NSString>>;
172
173        #[deprecated]
174        #[unsafe(method(stringListForKey:inTable:))]
175        #[unsafe(method_family = none)]
176        pub fn stringListForKey_inTable(
177            &self,
178            key: Option<&NSString>,
179            table: &NSString,
180        ) -> Option<Retained<NSArray>>;
181
182        #[deprecated]
183        #[unsafe(method(imageRectForPaper:))]
184        #[unsafe(method_family = none)]
185        pub fn imageRectForPaper(&self, paper_name: Option<&NSString>) -> NSRect;
186
187        #[deprecated]
188        #[unsafe(method(acceptsBinary))]
189        #[unsafe(method_family = none)]
190        pub fn acceptsBinary(&self) -> bool;
191
192        #[deprecated]
193        #[unsafe(method(isColor))]
194        #[unsafe(method_family = none)]
195        pub fn isColor(&self) -> bool;
196
197        #[deprecated]
198        #[unsafe(method(isFontAvailable:))]
199        #[unsafe(method_family = none)]
200        pub fn isFontAvailable(&self, face_name: Option<&NSString>) -> bool;
201
202        #[deprecated]
203        #[unsafe(method(isOutputStackInReverseOrder))]
204        #[unsafe(method_family = none)]
205        pub fn isOutputStackInReverseOrder(&self) -> bool;
206
207        #[deprecated]
208        #[unsafe(method(printerWithName:domain:includeUnavailable:))]
209        #[unsafe(method_family = none)]
210        pub fn printerWithName_domain_includeUnavailable(
211            name: &NSString,
212            domain: Option<&NSString>,
213            flag: bool,
214        ) -> Option<Retained<NSPrinter>>;
215
216        #[deprecated]
217        #[unsafe(method(domain))]
218        #[unsafe(method_family = none)]
219        pub fn domain(&self) -> Retained<NSString>;
220
221        #[deprecated]
222        #[unsafe(method(host))]
223        #[unsafe(method_family = none)]
224        pub fn host(&self) -> Retained<NSString>;
225
226        #[deprecated]
227        #[unsafe(method(note))]
228        #[unsafe(method_family = none)]
229        pub fn note(&self) -> Retained<NSString>;
230    );
231}