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
42unsafe impl NSObjectProtocol for NSPDFPanel {}
43
44impl NSPDFPanel {
45    extern_methods!(
46        #[unsafe(method(panel))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn panel(mtm: MainThreadMarker) -> Retained<NSPDFPanel>;
49
50        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
51        #[unsafe(method(accessoryController))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn accessoryController(&self) -> Option<Retained<NSViewController>>;
54
55        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
56        /// Setter for [`accessoryController`][Self::accessoryController].
57        #[unsafe(method(setAccessoryController:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setAccessoryController(
60            &self,
61            accessory_controller: Option<&NSViewController>,
62        );
63
64        #[unsafe(method(options))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn options(&self) -> NSPDFPanelOptions;
67
68        /// Setter for [`options`][Self::options].
69        #[unsafe(method(setOptions:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setOptions(&self, options: NSPDFPanelOptions);
72
73        #[unsafe(method(defaultFileName))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn defaultFileName(&self) -> Retained<NSString>;
76
77        /// Setter for [`defaultFileName`][Self::defaultFileName].
78        #[unsafe(method(setDefaultFileName:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setDefaultFileName(&self, default_file_name: &NSString);
81
82        #[cfg(all(
83            feature = "NSPDFInfo",
84            feature = "NSResponder",
85            feature = "NSWindow",
86            feature = "block2"
87        ))]
88        #[unsafe(method(beginSheetWithPDFInfo:modalForWindow:completionHandler:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn beginSheetWithPDFInfo_modalForWindow_completionHandler(
91            &self,
92            pdf_info: &NSPDFInfo,
93            doc_window: Option<&NSWindow>,
94            completion_handler: &block2::Block<dyn Fn(NSInteger)>,
95        );
96    );
97}
98
99/// Methods declared on superclass `NSObject`.
100impl NSPDFPanel {
101    extern_methods!(
102        #[unsafe(method(init))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
105
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
109    );
110}