objc2_app_kit/generated/
NSPrintOperation.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/nsprintingpageorder?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSPrintingPageOrder(pub NSInteger);
15impl NSPrintingPageOrder {
16    #[doc(alias = "NSDescendingPageOrder")]
17    pub const DescendingPageOrder: Self = Self(-1);
18    #[doc(alias = "NSSpecialPageOrder")]
19    pub const SpecialPageOrder: Self = Self(0);
20    #[doc(alias = "NSAscendingPageOrder")]
21    pub const AscendingPageOrder: Self = Self(1);
22    #[doc(alias = "NSUnknownPageOrder")]
23    pub const UnknownPageOrder: Self = Self(2);
24}
25
26unsafe impl Encode for NSPrintingPageOrder {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSPrintingPageOrder {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintrenderingquality?language=objc)
35// NS_ENUM
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct NSPrintRenderingQuality(pub NSInteger);
39impl NSPrintRenderingQuality {
40    #[doc(alias = "NSPrintRenderingQualityBest")]
41    pub const Best: Self = Self(0);
42    #[doc(alias = "NSPrintRenderingQualityResponsive")]
43    pub const Responsive: Self = Self(1);
44}
45
46unsafe impl Encode for NSPrintRenderingQuality {
47    const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSPrintRenderingQuality {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern "C" {
55    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintoperationexistsexception?language=objc)
56    pub static NSPrintOperationExistsException: &'static NSExceptionName;
57}
58
59extern_class!(
60    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintoperation?language=objc)
61    #[unsafe(super(NSObject))]
62    #[thread_kind = MainThreadOnly]
63    #[derive(Debug, PartialEq, Eq, Hash)]
64    pub struct NSPrintOperation;
65);
66
67extern_conformance!(
68    unsafe impl NSObjectProtocol for NSPrintOperation {}
69);
70
71impl NSPrintOperation {
72    extern_methods!(
73        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
74        #[unsafe(method(printOperationWithView:printInfo:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn printOperationWithView_printInfo(
77            view: &NSView,
78            print_info: &NSPrintInfo,
79        ) -> Retained<NSPrintOperation>;
80
81        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
82        #[unsafe(method(PDFOperationWithView:insideRect:toData:printInfo:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn PDFOperationWithView_insideRect_toData_printInfo(
85            view: &NSView,
86            rect: NSRect,
87            data: &NSMutableData,
88            print_info: &NSPrintInfo,
89        ) -> Retained<NSPrintOperation>;
90
91        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
92        #[unsafe(method(PDFOperationWithView:insideRect:toPath:printInfo:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn PDFOperationWithView_insideRect_toPath_printInfo(
95            view: &NSView,
96            rect: NSRect,
97            path: &NSString,
98            print_info: &NSPrintInfo,
99        ) -> Retained<NSPrintOperation>;
100
101        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
102        #[unsafe(method(EPSOperationWithView:insideRect:toData:printInfo:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn EPSOperationWithView_insideRect_toData_printInfo(
105            view: &NSView,
106            rect: NSRect,
107            data: &NSMutableData,
108            print_info: &NSPrintInfo,
109        ) -> Retained<NSPrintOperation>;
110
111        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
112        #[unsafe(method(EPSOperationWithView:insideRect:toPath:printInfo:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn EPSOperationWithView_insideRect_toPath_printInfo(
115            view: &NSView,
116            rect: NSRect,
117            path: &NSString,
118            print_info: &NSPrintInfo,
119        ) -> Retained<NSPrintOperation>;
120
121        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
122        #[unsafe(method(printOperationWithView:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn printOperationWithView(view: &NSView) -> Retained<NSPrintOperation>;
125
126        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
127        #[unsafe(method(PDFOperationWithView:insideRect:toData:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn PDFOperationWithView_insideRect_toData(
130            view: &NSView,
131            rect: NSRect,
132            data: &NSMutableData,
133        ) -> Retained<NSPrintOperation>;
134
135        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
136        #[unsafe(method(EPSOperationWithView:insideRect:toData:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn EPSOperationWithView_insideRect_toData(
139            view: &NSView,
140            rect: NSRect,
141            data: Option<&NSMutableData>,
142        ) -> Retained<NSPrintOperation>;
143
144        #[unsafe(method(currentOperation))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn currentOperation(mtm: MainThreadMarker)
147            -> Option<Retained<NSPrintOperation>>;
148
149        /// Setter for [`currentOperation`][Self::currentOperation].
150        #[unsafe(method(setCurrentOperation:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setCurrentOperation(
153            current_operation: Option<&NSPrintOperation>,
154            mtm: MainThreadMarker,
155        );
156
157        #[unsafe(method(isCopyingOperation))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn isCopyingOperation(&self) -> bool;
160
161        #[unsafe(method(preferredRenderingQuality))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn preferredRenderingQuality(&self) -> NSPrintRenderingQuality;
164
165        #[unsafe(method(jobTitle))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn jobTitle(&self) -> Option<Retained<NSString>>;
168
169        /// Setter for [`jobTitle`][Self::jobTitle].
170        #[unsafe(method(setJobTitle:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setJobTitle(&self, job_title: Option<&NSString>);
173
174        #[unsafe(method(showsPrintPanel))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn showsPrintPanel(&self) -> bool;
177
178        /// Setter for [`showsPrintPanel`][Self::showsPrintPanel].
179        #[unsafe(method(setShowsPrintPanel:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setShowsPrintPanel(&self, shows_print_panel: bool);
182
183        #[unsafe(method(showsProgressPanel))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn showsProgressPanel(&self) -> bool;
186
187        /// Setter for [`showsProgressPanel`][Self::showsProgressPanel].
188        #[unsafe(method(setShowsProgressPanel:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setShowsProgressPanel(&self, shows_progress_panel: bool);
191
192        #[cfg(feature = "NSPrintPanel")]
193        #[unsafe(method(printPanel))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn printPanel(&self) -> Retained<NSPrintPanel>;
196
197        #[cfg(feature = "NSPrintPanel")]
198        /// Setter for [`printPanel`][Self::printPanel].
199        #[unsafe(method(setPrintPanel:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setPrintPanel(&self, print_panel: &NSPrintPanel);
202
203        #[cfg(feature = "NSPDFPanel")]
204        #[unsafe(method(PDFPanel))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn PDFPanel(&self) -> Retained<NSPDFPanel>;
207
208        #[cfg(feature = "NSPDFPanel")]
209        /// Setter for [`PDFPanel`][Self::PDFPanel].
210        #[unsafe(method(setPDFPanel:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn setPDFPanel(&self, pdf_panel: &NSPDFPanel);
213
214        #[unsafe(method(canSpawnSeparateThread))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn canSpawnSeparateThread(&self) -> bool;
217
218        /// Setter for [`canSpawnSeparateThread`][Self::canSpawnSeparateThread].
219        #[unsafe(method(setCanSpawnSeparateThread:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setCanSpawnSeparateThread(&self, can_spawn_separate_thread: bool);
222
223        #[unsafe(method(pageOrder))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn pageOrder(&self) -> NSPrintingPageOrder;
226
227        /// Setter for [`pageOrder`][Self::pageOrder].
228        #[unsafe(method(setPageOrder:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn setPageOrder(&self, page_order: NSPrintingPageOrder);
231
232        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
233        #[unsafe(method(runOperationModalForWindow:delegate:didRunSelector:contextInfo:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn runOperationModalForWindow_delegate_didRunSelector_contextInfo(
236            &self,
237            doc_window: &NSWindow,
238            delegate: Option<&AnyObject>,
239            did_run_selector: Option<Sel>,
240            context_info: *mut c_void,
241        );
242
243        #[unsafe(method(runOperation))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn runOperation(&self) -> bool;
246
247        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
248        #[unsafe(method(view))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn view(&self) -> Option<Retained<NSView>>;
251
252        #[cfg(feature = "NSPrintInfo")]
253        #[unsafe(method(printInfo))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn printInfo(&self) -> Retained<NSPrintInfo>;
256
257        #[cfg(feature = "NSPrintInfo")]
258        /// Setter for [`printInfo`][Self::printInfo].
259        #[unsafe(method(setPrintInfo:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setPrintInfo(&self, print_info: &NSPrintInfo);
262
263        #[cfg(feature = "NSGraphicsContext")]
264        #[unsafe(method(context))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn context(&self) -> Option<Retained<NSGraphicsContext>>;
267
268        #[unsafe(method(pageRange))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn pageRange(&self) -> NSRange;
271
272        #[unsafe(method(currentPage))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn currentPage(&self) -> NSInteger;
275
276        #[cfg(feature = "NSGraphicsContext")]
277        #[unsafe(method(createContext))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn createContext(&self) -> Option<Retained<NSGraphicsContext>>;
280
281        #[unsafe(method(destroyContext))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn destroyContext(&self);
284
285        #[unsafe(method(deliverResult))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn deliverResult(&self) -> bool;
288
289        #[unsafe(method(cleanUpOperation))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn cleanUpOperation(&self);
292    );
293}
294
295/// Methods declared on superclass `NSObject`.
296impl NSPrintOperation {
297    extern_methods!(
298        #[unsafe(method(init))]
299        #[unsafe(method_family = init)]
300        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
301
302        #[unsafe(method(new))]
303        #[unsafe(method_family = new)]
304        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
305    );
306}
307
308/// NSDeprecated.
309impl NSPrintOperation {
310    extern_methods!(
311        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
312        #[deprecated = "Use -[NSPrintPanel addAccessoryController:] and -[NSPrintPanel removeAccessoryController:] instead"]
313        #[unsafe(method(setAccessoryView:))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn setAccessoryView(&self, view: Option<&NSView>);
316
317        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
318        #[deprecated = "Use -[NSPrintPanel accessoryControllers] instead"]
319        #[unsafe(method(accessoryView))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;
322
323        #[deprecated]
324        #[unsafe(method(setJobStyleHint:))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn setJobStyleHint(&self, hint: Option<&NSString>);
327
328        #[deprecated]
329        #[unsafe(method(jobStyleHint))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn jobStyleHint(&self) -> Option<Retained<NSString>>;
332
333        #[deprecated = "Use -setShowsPrintPanel: and -setShowsProgressPanel: instead"]
334        #[unsafe(method(setShowPanels:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setShowPanels(&self, flag: bool);
337
338        #[deprecated = "Use -showsPrintPanel and -showsProgressPanel instead"]
339        #[unsafe(method(showPanels))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn showPanels(&self) -> bool;
342    );
343}