objc2_app_kit/generated/
NSPDFPanel.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/nspdfpaneloptions?language=objc)
11// NS_OPTIONS
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSPDFPanelOptions(pub NSInteger);
15bitflags::bitflags! {
16    impl NSPDFPanelOptions: NSInteger {
17        #[doc(alias = "NSPDFPanelShowsPaperSize")]
18        const ShowsPaperSize = 1<<2;
19        #[doc(alias = "NSPDFPanelShowsOrientation")]
20        const ShowsOrientation = 1<<3;
21        #[doc(alias = "NSPDFPanelRequestsParentDirectory")]
22        const RequestsParentDirectory = 1<<24;
23    }
24}
25
26unsafe impl Encode for NSPDFPanelOptions {
27    const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSPDFPanelOptions {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspdfpanel?language=objc)
36    #[unsafe(super(NSObject))]
37    #[thread_kind = MainThreadOnly]
38    #[derive(Debug, PartialEq, Eq, Hash)]
39    pub struct NSPDFPanel;
40);
41
42extern_conformance!(
43    unsafe impl NSObjectProtocol for NSPDFPanel {}
44);
45
46impl NSPDFPanel {
47    extern_methods!(
48        #[unsafe(method(panel))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn panel(mtm: MainThreadMarker) -> Retained<NSPDFPanel>;
51
52        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
53        #[unsafe(method(accessoryController))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn accessoryController(&self) -> Option<Retained<NSViewController>>;
56
57        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
58        /// Setter for [`accessoryController`][Self::accessoryController].
59        #[unsafe(method(setAccessoryController:))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn setAccessoryController(
62            &self,
63            accessory_controller: Option<&NSViewController>,
64        );
65
66        #[unsafe(method(options))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn options(&self) -> NSPDFPanelOptions;
69
70        /// Setter for [`options`][Self::options].
71        #[unsafe(method(setOptions:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn setOptions(&self, options: NSPDFPanelOptions);
74
75        #[unsafe(method(defaultFileName))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn defaultFileName(&self) -> Retained<NSString>;
78
79        /// Setter for [`defaultFileName`][Self::defaultFileName].
80        #[unsafe(method(setDefaultFileName:))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setDefaultFileName(&self, default_file_name: &NSString);
83
84        #[cfg(all(
85            feature = "NSPDFInfo",
86            feature = "NSResponder",
87            feature = "NSWindow",
88            feature = "block2"
89        ))]
90        #[unsafe(method(beginSheetWithPDFInfo:modalForWindow:completionHandler:))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn beginSheetWithPDFInfo_modalForWindow_completionHandler(
93            &self,
94            pdf_info: &NSPDFInfo,
95            doc_window: Option<&NSWindow>,
96            completion_handler: &block2::DynBlock<dyn Fn(NSInteger)>,
97        );
98    );
99}
100
101/// Methods declared on superclass `NSObject`.
102impl NSPDFPanel {
103    extern_methods!(
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
107
108        #[unsafe(method(new))]
109        #[unsafe(method_family = new)]
110        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
111    );
112}