objc2_ui_kit/generated/
UIPrintPageRenderer.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintrenderingquality?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIPrintRenderingQuality(pub NSInteger);
17impl UIPrintRenderingQuality {
18    #[doc(alias = "UIPrintRenderingQualityBest")]
19    pub const Best: Self = Self(0);
20    #[doc(alias = "UIPrintRenderingQualityResponsive")]
21    pub const Responsive: Self = Self(1);
22}
23
24unsafe impl Encode for UIPrintRenderingQuality {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UIPrintRenderingQuality {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintpagerenderer?language=objc)
34    #[unsafe(super(NSObject))]
35    #[derive(Debug, PartialEq, Eq, Hash)]
36    pub struct UIPrintPageRenderer;
37);
38
39extern_conformance!(
40    unsafe impl NSObjectProtocol for UIPrintPageRenderer {}
41);
42
43impl UIPrintPageRenderer {
44    extern_methods!(
45        #[cfg(feature = "objc2-core-foundation")]
46        #[unsafe(method(headerHeight))]
47        #[unsafe(method_family = none)]
48        pub fn headerHeight(&self) -> CGFloat;
49
50        #[cfg(feature = "objc2-core-foundation")]
51        /// Setter for [`headerHeight`][Self::headerHeight].
52        #[unsafe(method(setHeaderHeight:))]
53        #[unsafe(method_family = none)]
54        pub fn setHeaderHeight(&self, header_height: CGFloat);
55
56        #[cfg(feature = "objc2-core-foundation")]
57        #[unsafe(method(footerHeight))]
58        #[unsafe(method_family = none)]
59        pub fn footerHeight(&self) -> CGFloat;
60
61        #[cfg(feature = "objc2-core-foundation")]
62        /// Setter for [`footerHeight`][Self::footerHeight].
63        #[unsafe(method(setFooterHeight:))]
64        #[unsafe(method_family = none)]
65        pub fn setFooterHeight(&self, footer_height: CGFloat);
66
67        #[cfg(feature = "objc2-core-foundation")]
68        #[unsafe(method(paperRect))]
69        #[unsafe(method_family = none)]
70        pub fn paperRect(&self) -> CGRect;
71
72        #[cfg(feature = "objc2-core-foundation")]
73        #[unsafe(method(printableRect))]
74        #[unsafe(method_family = none)]
75        pub fn printableRect(&self) -> CGRect;
76
77        #[unsafe(method(numberOfPages))]
78        #[unsafe(method_family = none)]
79        pub fn numberOfPages(&self) -> NSInteger;
80
81        #[cfg(feature = "UIPrintFormatter")]
82        #[unsafe(method(printFormatters))]
83        #[unsafe(method_family = none)]
84        pub fn printFormatters(&self) -> Option<Retained<NSArray<UIPrintFormatter>>>;
85
86        #[cfg(feature = "UIPrintFormatter")]
87        /// Setter for [`printFormatters`][Self::printFormatters].
88        ///
89        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
90        #[unsafe(method(setPrintFormatters:))]
91        #[unsafe(method_family = none)]
92        pub fn setPrintFormatters(&self, print_formatters: Option<&NSArray<UIPrintFormatter>>);
93
94        #[cfg(feature = "UIPrintFormatter")]
95        #[unsafe(method(printFormattersForPageAtIndex:))]
96        #[unsafe(method_family = none)]
97        pub fn printFormattersForPageAtIndex(
98            &self,
99            page_index: NSInteger,
100        ) -> Option<Retained<NSArray<UIPrintFormatter>>>;
101
102        #[cfg(feature = "UIPrintFormatter")]
103        #[unsafe(method(addPrintFormatter:startingAtPageAtIndex:))]
104        #[unsafe(method_family = none)]
105        pub fn addPrintFormatter_startingAtPageAtIndex(
106            &self,
107            formatter: &UIPrintFormatter,
108            page_index: NSInteger,
109        );
110
111        #[unsafe(method(currentRenderingQualityForRequestedRenderingQuality:))]
112        #[unsafe(method_family = none)]
113        pub fn currentRenderingQualityForRequestedRenderingQuality(
114            &self,
115            requested_rendering_quality: UIPrintRenderingQuality,
116        ) -> UIPrintRenderingQuality;
117
118        #[unsafe(method(prepareForDrawingPages:))]
119        #[unsafe(method_family = none)]
120        pub fn prepareForDrawingPages(&self, range: NSRange);
121
122        #[cfg(feature = "objc2-core-foundation")]
123        #[unsafe(method(drawPageAtIndex:inRect:))]
124        #[unsafe(method_family = none)]
125        pub fn drawPageAtIndex_inRect(&self, page_index: NSInteger, printable_rect: CGRect);
126
127        #[cfg(feature = "UIPrintFormatter")]
128        #[unsafe(method(drawPrintFormatter:forPageAtIndex:))]
129        #[unsafe(method_family = none)]
130        pub fn drawPrintFormatter_forPageAtIndex(
131            &self,
132            print_formatter: &UIPrintFormatter,
133            page_index: NSInteger,
134        );
135
136        #[cfg(feature = "objc2-core-foundation")]
137        #[unsafe(method(drawHeaderForPageAtIndex:inRect:))]
138        #[unsafe(method_family = none)]
139        pub fn drawHeaderForPageAtIndex_inRect(&self, page_index: NSInteger, header_rect: CGRect);
140
141        #[cfg(feature = "objc2-core-foundation")]
142        #[unsafe(method(drawContentForPageAtIndex:inRect:))]
143        #[unsafe(method_family = none)]
144        pub fn drawContentForPageAtIndex_inRect(&self, page_index: NSInteger, content_rect: CGRect);
145
146        #[cfg(feature = "objc2-core-foundation")]
147        #[unsafe(method(drawFooterForPageAtIndex:inRect:))]
148        #[unsafe(method_family = none)]
149        pub fn drawFooterForPageAtIndex_inRect(&self, page_index: NSInteger, footer_rect: CGRect);
150    );
151}
152
153/// Methods declared on superclass `NSObject`.
154impl UIPrintPageRenderer {
155    extern_methods!(
156        #[unsafe(method(init))]
157        #[unsafe(method_family = init)]
158        pub fn init(this: Allocated<Self>) -> Retained<Self>;
159
160        #[unsafe(method(new))]
161        #[unsafe(method_family = new)]
162        pub fn new() -> Retained<Self>;
163    );
164}
165
166impl DefaultRetained for UIPrintPageRenderer {
167    #[inline]
168    fn default_retained() -> Retained<Self> {
169        Self::new()
170    }
171}