objc2_app_kit/generated/
NSPageLayout.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/nspagelayoutresult?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSPageLayoutResult(pub NSInteger);
15impl NSPageLayoutResult {
16    #[doc(alias = "NSPageLayoutResultCancelled")]
17    pub const Cancelled: Self = Self(0);
18    #[doc(alias = "NSPageLayoutResultChanged")]
19    pub const Changed: Self = Self(1);
20}
21
22unsafe impl Encode for NSPageLayoutResult {
23    const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for NSPageLayoutResult {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspagelayout?language=objc)
32    #[unsafe(super(NSObject))]
33    #[thread_kind = MainThreadOnly]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    pub struct NSPageLayout;
36);
37
38extern_conformance!(
39    unsafe impl NSObjectProtocol for NSPageLayout {}
40);
41
42impl NSPageLayout {
43    extern_methods!(
44        #[unsafe(method(pageLayout))]
45        #[unsafe(method_family = none)]
46        pub fn pageLayout(mtm: MainThreadMarker) -> Retained<NSPageLayout>;
47
48        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
49        #[unsafe(method(addAccessoryController:))]
50        #[unsafe(method_family = none)]
51        pub fn addAccessoryController(&self, accessory_controller: &NSViewController);
52
53        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
54        #[unsafe(method(removeAccessoryController:))]
55        #[unsafe(method_family = none)]
56        pub fn removeAccessoryController(&self, accessory_controller: &NSViewController);
57
58        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
59        #[unsafe(method(accessoryControllers))]
60        #[unsafe(method_family = none)]
61        pub fn accessoryControllers(&self) -> Retained<NSArray<NSViewController>>;
62
63        #[cfg(all(
64            feature = "NSPrintInfo",
65            feature = "NSResponder",
66            feature = "NSWindow",
67            feature = "block2"
68        ))]
69        #[unsafe(method(beginSheetUsingPrintInfo:onWindow:completionHandler:))]
70        #[unsafe(method_family = none)]
71        pub fn beginSheetUsingPrintInfo_onWindow_completionHandler(
72            &self,
73            print_info: &NSPrintInfo,
74            parent_window: &NSWindow,
75            handler: Option<&block2::DynBlock<dyn Fn(NSPageLayoutResult)>>,
76        );
77
78        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSWindow"))]
79        /// # Safety
80        ///
81        /// - `delegate` should be of the correct type.
82        /// - `did_end_selector` must be a valid selector.
83        /// - `context_info` must be a valid pointer or null.
84        #[deprecated]
85        #[unsafe(method(beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn beginSheetWithPrintInfo_modalForWindow_delegate_didEndSelector_contextInfo(
88            &self,
89            print_info: &NSPrintInfo,
90            doc_window: &NSWindow,
91            delegate: Option<&AnyObject>,
92            did_end_selector: Option<Sel>,
93            context_info: *mut c_void,
94        );
95
96        #[cfg(feature = "NSPrintInfo")]
97        #[unsafe(method(runModalWithPrintInfo:))]
98        #[unsafe(method_family = none)]
99        pub fn runModalWithPrintInfo(&self, print_info: &NSPrintInfo) -> NSInteger;
100
101        #[unsafe(method(runModal))]
102        #[unsafe(method_family = none)]
103        pub fn runModal(&self) -> NSInteger;
104
105        #[cfg(feature = "NSPrintInfo")]
106        #[unsafe(method(printInfo))]
107        #[unsafe(method_family = none)]
108        pub fn printInfo(&self) -> Option<Retained<NSPrintInfo>>;
109    );
110}
111
112/// Methods declared on superclass `NSObject`.
113impl NSPageLayout {
114    extern_methods!(
115        #[unsafe(method(init))]
116        #[unsafe(method_family = init)]
117        pub fn init(this: Allocated<Self>) -> Retained<Self>;
118
119        #[unsafe(method(new))]
120        #[unsafe(method_family = new)]
121        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
122    );
123}
124
125/// NSDeprecated.
126impl NSPageLayout {
127    extern_methods!(
128        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
129        /// # Safety
130        ///
131        /// `accessory_view` might not allow `None`.
132        #[deprecated]
133        #[unsafe(method(setAccessoryView:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);
136
137        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
138        #[deprecated]
139        #[unsafe(method(accessoryView))]
140        #[unsafe(method_family = none)]
141        pub fn accessoryView(&self) -> Option<Retained<NSView>>;
142
143        #[deprecated]
144        #[unsafe(method(readPrintInfo))]
145        #[unsafe(method_family = none)]
146        pub fn readPrintInfo(&self);
147
148        #[deprecated]
149        #[unsafe(method(writePrintInfo))]
150        #[unsafe(method_family = none)]
151        pub fn writePrintInfo(&self);
152    );
153}
154
155/// NSPageLayoutPanel.
156#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
157impl NSApplication {
158    extern_methods!(
159        /// # Safety
160        ///
161        /// `sender` should be of the correct type.
162        #[unsafe(method(runPageLayout:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn runPageLayout(&self, sender: Option<&AnyObject>);
165    );
166}