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 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 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 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 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 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 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 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 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 fn currentOperation(mtm: MainThreadMarker) -> Option<Retained<NSPrintOperation>>;
147
148        /// Setter for [`currentOperation`][Self::currentOperation].
149        #[unsafe(method(setCurrentOperation:))]
150        #[unsafe(method_family = none)]
151        pub fn setCurrentOperation(
152            current_operation: Option<&NSPrintOperation>,
153            mtm: MainThreadMarker,
154        );
155
156        #[unsafe(method(isCopyingOperation))]
157        #[unsafe(method_family = none)]
158        pub fn isCopyingOperation(&self) -> bool;
159
160        #[unsafe(method(preferredRenderingQuality))]
161        #[unsafe(method_family = none)]
162        pub fn preferredRenderingQuality(&self) -> NSPrintRenderingQuality;
163
164        #[unsafe(method(jobTitle))]
165        #[unsafe(method_family = none)]
166        pub fn jobTitle(&self) -> Option<Retained<NSString>>;
167
168        /// Setter for [`jobTitle`][Self::jobTitle].
169        ///
170        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
171        #[unsafe(method(setJobTitle:))]
172        #[unsafe(method_family = none)]
173        pub fn setJobTitle(&self, job_title: Option<&NSString>);
174
175        #[unsafe(method(showsPrintPanel))]
176        #[unsafe(method_family = none)]
177        pub fn showsPrintPanel(&self) -> bool;
178
179        /// Setter for [`showsPrintPanel`][Self::showsPrintPanel].
180        #[unsafe(method(setShowsPrintPanel:))]
181        #[unsafe(method_family = none)]
182        pub fn setShowsPrintPanel(&self, shows_print_panel: bool);
183
184        #[unsafe(method(showsProgressPanel))]
185        #[unsafe(method_family = none)]
186        pub fn showsProgressPanel(&self) -> bool;
187
188        /// Setter for [`showsProgressPanel`][Self::showsProgressPanel].
189        #[unsafe(method(setShowsProgressPanel:))]
190        #[unsafe(method_family = none)]
191        pub fn setShowsProgressPanel(&self, shows_progress_panel: bool);
192
193        #[cfg(feature = "NSPrintPanel")]
194        #[unsafe(method(printPanel))]
195        #[unsafe(method_family = none)]
196        pub fn printPanel(&self) -> Retained<NSPrintPanel>;
197
198        #[cfg(feature = "NSPrintPanel")]
199        /// Setter for [`printPanel`][Self::printPanel].
200        #[unsafe(method(setPrintPanel:))]
201        #[unsafe(method_family = none)]
202        pub fn setPrintPanel(&self, print_panel: &NSPrintPanel);
203
204        #[cfg(feature = "NSPDFPanel")]
205        #[unsafe(method(PDFPanel))]
206        #[unsafe(method_family = none)]
207        pub fn PDFPanel(&self) -> Retained<NSPDFPanel>;
208
209        #[cfg(feature = "NSPDFPanel")]
210        /// Setter for [`PDFPanel`][Self::PDFPanel].
211        #[unsafe(method(setPDFPanel:))]
212        #[unsafe(method_family = none)]
213        pub fn setPDFPanel(&self, pdf_panel: &NSPDFPanel);
214
215        #[unsafe(method(canSpawnSeparateThread))]
216        #[unsafe(method_family = none)]
217        pub fn canSpawnSeparateThread(&self) -> bool;
218
219        /// Setter for [`canSpawnSeparateThread`][Self::canSpawnSeparateThread].
220        #[unsafe(method(setCanSpawnSeparateThread:))]
221        #[unsafe(method_family = none)]
222        pub fn setCanSpawnSeparateThread(&self, can_spawn_separate_thread: bool);
223
224        #[unsafe(method(pageOrder))]
225        #[unsafe(method_family = none)]
226        pub fn pageOrder(&self) -> NSPrintingPageOrder;
227
228        /// Setter for [`pageOrder`][Self::pageOrder].
229        #[unsafe(method(setPageOrder:))]
230        #[unsafe(method_family = none)]
231        pub fn setPageOrder(&self, page_order: NSPrintingPageOrder);
232
233        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
234        /// # Safety
235        ///
236        /// - `delegate` should be of the correct type.
237        /// - `did_run_selector` must be a valid selector.
238        /// - `context_info` must be a valid pointer or null.
239        #[unsafe(method(runOperationModalForWindow:delegate:didRunSelector:contextInfo:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn runOperationModalForWindow_delegate_didRunSelector_contextInfo(
242            &self,
243            doc_window: &NSWindow,
244            delegate: Option<&AnyObject>,
245            did_run_selector: Option<Sel>,
246            context_info: *mut c_void,
247        );
248
249        #[unsafe(method(runOperation))]
250        #[unsafe(method_family = none)]
251        pub fn runOperation(&self) -> bool;
252
253        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
254        #[unsafe(method(view))]
255        #[unsafe(method_family = none)]
256        pub fn view(&self) -> Option<Retained<NSView>>;
257
258        #[cfg(feature = "NSPrintInfo")]
259        #[unsafe(method(printInfo))]
260        #[unsafe(method_family = none)]
261        pub fn printInfo(&self) -> Retained<NSPrintInfo>;
262
263        #[cfg(feature = "NSPrintInfo")]
264        /// Setter for [`printInfo`][Self::printInfo].
265        ///
266        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
267        #[unsafe(method(setPrintInfo:))]
268        #[unsafe(method_family = none)]
269        pub fn setPrintInfo(&self, print_info: &NSPrintInfo);
270
271        #[cfg(feature = "NSGraphicsContext")]
272        #[unsafe(method(context))]
273        #[unsafe(method_family = none)]
274        pub fn context(&self) -> Option<Retained<NSGraphicsContext>>;
275
276        #[unsafe(method(pageRange))]
277        #[unsafe(method_family = none)]
278        pub fn pageRange(&self) -> NSRange;
279
280        #[unsafe(method(currentPage))]
281        #[unsafe(method_family = none)]
282        pub fn currentPage(&self) -> NSInteger;
283
284        #[cfg(feature = "NSGraphicsContext")]
285        #[unsafe(method(createContext))]
286        #[unsafe(method_family = none)]
287        pub fn createContext(&self) -> Option<Retained<NSGraphicsContext>>;
288
289        #[unsafe(method(destroyContext))]
290        #[unsafe(method_family = none)]
291        pub fn destroyContext(&self);
292
293        #[unsafe(method(deliverResult))]
294        #[unsafe(method_family = none)]
295        pub fn deliverResult(&self) -> bool;
296
297        #[unsafe(method(cleanUpOperation))]
298        #[unsafe(method_family = none)]
299        pub fn cleanUpOperation(&self);
300    );
301}
302
303/// Methods declared on superclass `NSObject`.
304impl NSPrintOperation {
305    extern_methods!(
306        #[unsafe(method(init))]
307        #[unsafe(method_family = init)]
308        pub fn init(this: Allocated<Self>) -> Retained<Self>;
309
310        #[unsafe(method(new))]
311        #[unsafe(method_family = new)]
312        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
313    );
314}
315
316/// NSDeprecated.
317impl NSPrintOperation {
318    extern_methods!(
319        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
320        #[deprecated = "Use -[NSPrintPanel addAccessoryController:] and -[NSPrintPanel removeAccessoryController:] instead"]
321        #[unsafe(method(setAccessoryView:))]
322        #[unsafe(method_family = none)]
323        pub fn setAccessoryView(&self, view: Option<&NSView>);
324
325        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
326        #[deprecated = "Use -[NSPrintPanel accessoryControllers] instead"]
327        #[unsafe(method(accessoryView))]
328        #[unsafe(method_family = none)]
329        pub fn accessoryView(&self) -> Option<Retained<NSView>>;
330
331        #[deprecated]
332        #[unsafe(method(setJobStyleHint:))]
333        #[unsafe(method_family = none)]
334        pub fn setJobStyleHint(&self, hint: Option<&NSString>);
335
336        #[deprecated]
337        #[unsafe(method(jobStyleHint))]
338        #[unsafe(method_family = none)]
339        pub fn jobStyleHint(&self) -> Option<Retained<NSString>>;
340
341        #[deprecated = "Use -setShowsPrintPanel: and -setShowsProgressPanel: instead"]
342        #[unsafe(method(setShowPanels:))]
343        #[unsafe(method_family = none)]
344        pub fn setShowPanels(&self, flag: bool);
345
346        #[deprecated = "Use -showsPrintPanel and -showsProgressPanel instead"]
347        #[unsafe(method(showPanels))]
348        #[unsafe(method_family = none)]
349        pub fn showPanels(&self) -> bool;
350    );
351}