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
67unsafe impl NSObjectProtocol for NSPrintOperation {}
68
69impl NSPrintOperation {
70    extern_methods!(
71        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
72        #[unsafe(method(printOperationWithView:printInfo:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn printOperationWithView_printInfo(
75            view: &NSView,
76            print_info: &NSPrintInfo,
77        ) -> Retained<NSPrintOperation>;
78
79        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
80        #[unsafe(method(PDFOperationWithView:insideRect:toData:printInfo:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn PDFOperationWithView_insideRect_toData_printInfo(
83            view: &NSView,
84            rect: NSRect,
85            data: &NSMutableData,
86            print_info: &NSPrintInfo,
87        ) -> Retained<NSPrintOperation>;
88
89        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
90        #[unsafe(method(PDFOperationWithView:insideRect:toPath:printInfo:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn PDFOperationWithView_insideRect_toPath_printInfo(
93            view: &NSView,
94            rect: NSRect,
95            path: &NSString,
96            print_info: &NSPrintInfo,
97        ) -> Retained<NSPrintOperation>;
98
99        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
100        #[unsafe(method(EPSOperationWithView:insideRect:toData:printInfo:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn EPSOperationWithView_insideRect_toData_printInfo(
103            view: &NSView,
104            rect: NSRect,
105            data: &NSMutableData,
106            print_info: &NSPrintInfo,
107        ) -> Retained<NSPrintOperation>;
108
109        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
110        #[unsafe(method(EPSOperationWithView:insideRect:toPath:printInfo:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn EPSOperationWithView_insideRect_toPath_printInfo(
113            view: &NSView,
114            rect: NSRect,
115            path: &NSString,
116            print_info: &NSPrintInfo,
117        ) -> Retained<NSPrintOperation>;
118
119        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
120        #[unsafe(method(printOperationWithView:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn printOperationWithView(view: &NSView) -> Retained<NSPrintOperation>;
123
124        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
125        #[unsafe(method(PDFOperationWithView:insideRect:toData:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn PDFOperationWithView_insideRect_toData(
128            view: &NSView,
129            rect: NSRect,
130            data: &NSMutableData,
131        ) -> Retained<NSPrintOperation>;
132
133        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
134        #[unsafe(method(EPSOperationWithView:insideRect:toData:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn EPSOperationWithView_insideRect_toData(
137            view: &NSView,
138            rect: NSRect,
139            data: Option<&NSMutableData>,
140        ) -> Retained<NSPrintOperation>;
141
142        #[unsafe(method(currentOperation))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn currentOperation(mtm: MainThreadMarker)
145            -> Option<Retained<NSPrintOperation>>;
146
147        /// Setter for [`currentOperation`][Self::currentOperation].
148        #[unsafe(method(setCurrentOperation:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn setCurrentOperation(
151            current_operation: Option<&NSPrintOperation>,
152            mtm: MainThreadMarker,
153        );
154
155        #[unsafe(method(isCopyingOperation))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn isCopyingOperation(&self) -> bool;
158
159        #[unsafe(method(preferredRenderingQuality))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn preferredRenderingQuality(&self) -> NSPrintRenderingQuality;
162
163        #[unsafe(method(jobTitle))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn jobTitle(&self) -> Option<Retained<NSString>>;
166
167        /// Setter for [`jobTitle`][Self::jobTitle].
168        #[unsafe(method(setJobTitle:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setJobTitle(&self, job_title: Option<&NSString>);
171
172        #[unsafe(method(showsPrintPanel))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn showsPrintPanel(&self) -> bool;
175
176        /// Setter for [`showsPrintPanel`][Self::showsPrintPanel].
177        #[unsafe(method(setShowsPrintPanel:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setShowsPrintPanel(&self, shows_print_panel: bool);
180
181        #[unsafe(method(showsProgressPanel))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn showsProgressPanel(&self) -> bool;
184
185        /// Setter for [`showsProgressPanel`][Self::showsProgressPanel].
186        #[unsafe(method(setShowsProgressPanel:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn setShowsProgressPanel(&self, shows_progress_panel: bool);
189
190        #[cfg(feature = "NSPrintPanel")]
191        #[unsafe(method(printPanel))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn printPanel(&self) -> Retained<NSPrintPanel>;
194
195        #[cfg(feature = "NSPrintPanel")]
196        /// Setter for [`printPanel`][Self::printPanel].
197        #[unsafe(method(setPrintPanel:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setPrintPanel(&self, print_panel: &NSPrintPanel);
200
201        #[cfg(feature = "NSPDFPanel")]
202        #[unsafe(method(PDFPanel))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn PDFPanel(&self) -> Retained<NSPDFPanel>;
205
206        #[cfg(feature = "NSPDFPanel")]
207        /// Setter for [`PDFPanel`][Self::PDFPanel].
208        #[unsafe(method(setPDFPanel:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn setPDFPanel(&self, pdf_panel: &NSPDFPanel);
211
212        #[unsafe(method(canSpawnSeparateThread))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn canSpawnSeparateThread(&self) -> bool;
215
216        /// Setter for [`canSpawnSeparateThread`][Self::canSpawnSeparateThread].
217        #[unsafe(method(setCanSpawnSeparateThread:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn setCanSpawnSeparateThread(&self, can_spawn_separate_thread: bool);
220
221        #[unsafe(method(pageOrder))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn pageOrder(&self) -> NSPrintingPageOrder;
224
225        /// Setter for [`pageOrder`][Self::pageOrder].
226        #[unsafe(method(setPageOrder:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn setPageOrder(&self, page_order: NSPrintingPageOrder);
229
230        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
231        #[unsafe(method(runOperationModalForWindow:delegate:didRunSelector:contextInfo:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn runOperationModalForWindow_delegate_didRunSelector_contextInfo(
234            &self,
235            doc_window: &NSWindow,
236            delegate: Option<&AnyObject>,
237            did_run_selector: Option<Sel>,
238            context_info: *mut c_void,
239        );
240
241        #[unsafe(method(runOperation))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn runOperation(&self) -> bool;
244
245        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
246        #[unsafe(method(view))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn view(&self) -> Option<Retained<NSView>>;
249
250        #[cfg(feature = "NSPrintInfo")]
251        #[unsafe(method(printInfo))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn printInfo(&self) -> Retained<NSPrintInfo>;
254
255        #[cfg(feature = "NSPrintInfo")]
256        /// Setter for [`printInfo`][Self::printInfo].
257        #[unsafe(method(setPrintInfo:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setPrintInfo(&self, print_info: &NSPrintInfo);
260
261        #[cfg(feature = "NSGraphicsContext")]
262        #[unsafe(method(context))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn context(&self) -> Option<Retained<NSGraphicsContext>>;
265
266        #[unsafe(method(pageRange))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn pageRange(&self) -> NSRange;
269
270        #[unsafe(method(currentPage))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn currentPage(&self) -> NSInteger;
273
274        #[cfg(feature = "NSGraphicsContext")]
275        #[unsafe(method(createContext))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn createContext(&self) -> Option<Retained<NSGraphicsContext>>;
278
279        #[unsafe(method(destroyContext))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn destroyContext(&self);
282
283        #[unsafe(method(deliverResult))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn deliverResult(&self) -> bool;
286
287        #[unsafe(method(cleanUpOperation))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn cleanUpOperation(&self);
290    );
291}
292
293/// Methods declared on superclass `NSObject`.
294impl NSPrintOperation {
295    extern_methods!(
296        #[unsafe(method(init))]
297        #[unsafe(method_family = init)]
298        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
299
300        #[unsafe(method(new))]
301        #[unsafe(method_family = new)]
302        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
303    );
304}
305
306/// NSDeprecated.
307impl NSPrintOperation {
308    extern_methods!(
309        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
310        #[deprecated = "Use -[NSPrintPanel addAccessoryController:] and -[NSPrintPanel removeAccessoryController:] instead"]
311        #[unsafe(method(setAccessoryView:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn setAccessoryView(&self, view: Option<&NSView>);
314
315        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
316        #[deprecated = "Use -[NSPrintPanel accessoryControllers] instead"]
317        #[unsafe(method(accessoryView))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;
320
321        #[deprecated]
322        #[unsafe(method(setJobStyleHint:))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn setJobStyleHint(&self, hint: Option<&NSString>);
325
326        #[deprecated]
327        #[unsafe(method(jobStyleHint))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn jobStyleHint(&self) -> Option<Retained<NSString>>;
330
331        #[deprecated = "Use -setShowsPrintPanel: and -setShowsProgressPanel: instead"]
332        #[unsafe(method(setShowPanels:))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn setShowPanels(&self, flag: bool);
335
336        #[deprecated = "Use -showsPrintPanel and -showsProgressPanel instead"]
337        #[unsafe(method(showPanels))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn showPanels(&self) -> bool;
340    );
341}