objc2_ui_kit/generated/
UIPrintFormatter.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintformatter?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct UIPrintFormatter;
17);
18
19extern_conformance!(
20    unsafe impl NSCopying for UIPrintFormatter {}
21);
22
23unsafe impl CopyingHelper for UIPrintFormatter {
24    type Result = Self;
25}
26
27extern_conformance!(
28    unsafe impl NSObjectProtocol for UIPrintFormatter {}
29);
30
31impl UIPrintFormatter {
32    extern_methods!(
33        #[cfg(feature = "UIPrintPageRenderer")]
34        #[unsafe(method(printPageRenderer))]
35        #[unsafe(method_family = none)]
36        pub fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;
37
38        #[unsafe(method(removeFromPrintPageRenderer))]
39        #[unsafe(method_family = none)]
40        pub fn removeFromPrintPageRenderer(&self);
41
42        #[cfg(feature = "objc2-core-foundation")]
43        #[unsafe(method(maximumContentHeight))]
44        #[unsafe(method_family = none)]
45        pub fn maximumContentHeight(&self) -> CGFloat;
46
47        #[cfg(feature = "objc2-core-foundation")]
48        /// Setter for [`maximumContentHeight`][Self::maximumContentHeight].
49        #[unsafe(method(setMaximumContentHeight:))]
50        #[unsafe(method_family = none)]
51        pub fn setMaximumContentHeight(&self, maximum_content_height: CGFloat);
52
53        #[cfg(feature = "objc2-core-foundation")]
54        #[unsafe(method(maximumContentWidth))]
55        #[unsafe(method_family = none)]
56        pub fn maximumContentWidth(&self) -> CGFloat;
57
58        #[cfg(feature = "objc2-core-foundation")]
59        /// Setter for [`maximumContentWidth`][Self::maximumContentWidth].
60        #[unsafe(method(setMaximumContentWidth:))]
61        #[unsafe(method_family = none)]
62        pub fn setMaximumContentWidth(&self, maximum_content_width: CGFloat);
63
64        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
65        #[deprecated]
66        #[unsafe(method(contentInsets))]
67        #[unsafe(method_family = none)]
68        pub fn contentInsets(&self) -> UIEdgeInsets;
69
70        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
71        /// Setter for [`contentInsets`][Self::contentInsets].
72        #[deprecated]
73        #[unsafe(method(setContentInsets:))]
74        #[unsafe(method_family = none)]
75        pub fn setContentInsets(&self, content_insets: UIEdgeInsets);
76
77        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
78        #[unsafe(method(perPageContentInsets))]
79        #[unsafe(method_family = none)]
80        pub fn perPageContentInsets(&self) -> UIEdgeInsets;
81
82        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
83        /// Setter for [`perPageContentInsets`][Self::perPageContentInsets].
84        #[unsafe(method(setPerPageContentInsets:))]
85        #[unsafe(method_family = none)]
86        pub fn setPerPageContentInsets(&self, per_page_content_insets: UIEdgeInsets);
87
88        #[unsafe(method(startPage))]
89        #[unsafe(method_family = none)]
90        pub fn startPage(&self) -> NSInteger;
91
92        /// Setter for [`startPage`][Self::startPage].
93        #[unsafe(method(setStartPage:))]
94        #[unsafe(method_family = none)]
95        pub fn setStartPage(&self, start_page: NSInteger);
96
97        #[unsafe(method(pageCount))]
98        #[unsafe(method_family = none)]
99        pub fn pageCount(&self) -> NSInteger;
100
101        #[unsafe(method(requiresMainThread))]
102        #[unsafe(method_family = none)]
103        pub fn requiresMainThread(&self) -> bool;
104
105        #[cfg(feature = "objc2-core-foundation")]
106        #[unsafe(method(rectForPageAtIndex:))]
107        #[unsafe(method_family = none)]
108        pub fn rectForPageAtIndex(&self, page_index: NSInteger) -> CGRect;
109
110        #[cfg(feature = "objc2-core-foundation")]
111        #[unsafe(method(drawInRect:forPageAtIndex:))]
112        #[unsafe(method_family = none)]
113        pub fn drawInRect_forPageAtIndex(&self, rect: CGRect, page_index: NSInteger);
114    );
115}
116
117/// Methods declared on superclass `NSObject`.
118impl UIPrintFormatter {
119    extern_methods!(
120        #[unsafe(method(init))]
121        #[unsafe(method_family = init)]
122        pub fn init(this: Allocated<Self>) -> Retained<Self>;
123
124        #[unsafe(method(new))]
125        #[unsafe(method_family = new)]
126        pub fn new() -> Retained<Self>;
127    );
128}
129
130impl DefaultRetained for UIPrintFormatter {
131    #[inline]
132    fn default_retained() -> Retained<Self> {
133        Self::new()
134    }
135}
136
137extern_class!(
138    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisimpletextprintformatter?language=objc)
139    #[unsafe(super(UIPrintFormatter, NSObject))]
140    #[derive(Debug, PartialEq, Eq, Hash)]
141    pub struct UISimpleTextPrintFormatter;
142);
143
144extern_conformance!(
145    unsafe impl NSCopying for UISimpleTextPrintFormatter {}
146);
147
148unsafe impl CopyingHelper for UISimpleTextPrintFormatter {
149    type Result = Self;
150}
151
152extern_conformance!(
153    unsafe impl NSObjectProtocol for UISimpleTextPrintFormatter {}
154);
155
156impl UISimpleTextPrintFormatter {
157    extern_methods!(
158        #[unsafe(method(initWithText:))]
159        #[unsafe(method_family = init)]
160        pub fn initWithText(this: Allocated<Self>, text: &NSString) -> Retained<Self>;
161
162        #[unsafe(method(initWithAttributedText:))]
163        #[unsafe(method_family = init)]
164        pub fn initWithAttributedText(
165            this: Allocated<Self>,
166            attributed_text: &NSAttributedString,
167        ) -> Retained<Self>;
168
169        #[unsafe(method(text))]
170        #[unsafe(method_family = none)]
171        pub fn text(&self) -> Option<Retained<NSString>>;
172
173        /// Setter for [`text`][Self::text].
174        ///
175        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
176        #[unsafe(method(setText:))]
177        #[unsafe(method_family = none)]
178        pub fn setText(&self, text: Option<&NSString>);
179
180        #[unsafe(method(attributedText))]
181        #[unsafe(method_family = none)]
182        pub fn attributedText(&self) -> Option<Retained<NSAttributedString>>;
183
184        /// Setter for [`attributedText`][Self::attributedText].
185        ///
186        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
187        #[unsafe(method(setAttributedText:))]
188        #[unsafe(method_family = none)]
189        pub fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
190
191        #[cfg(feature = "UIFont")]
192        #[unsafe(method(font))]
193        #[unsafe(method_family = none)]
194        pub fn font(&self) -> Option<Retained<UIFont>>;
195
196        #[cfg(feature = "UIFont")]
197        /// Setter for [`font`][Self::font].
198        #[unsafe(method(setFont:))]
199        #[unsafe(method_family = none)]
200        pub fn setFont(&self, font: Option<&UIFont>);
201
202        #[cfg(feature = "UIColor")]
203        #[unsafe(method(color))]
204        #[unsafe(method_family = none)]
205        pub fn color(&self) -> Option<Retained<UIColor>>;
206
207        #[cfg(feature = "UIColor")]
208        /// Setter for [`color`][Self::color].
209        #[unsafe(method(setColor:))]
210        #[unsafe(method_family = none)]
211        pub fn setColor(&self, color: Option<&UIColor>);
212
213        #[cfg(feature = "NSText")]
214        #[unsafe(method(textAlignment))]
215        #[unsafe(method_family = none)]
216        pub fn textAlignment(&self) -> NSTextAlignment;
217
218        #[cfg(feature = "NSText")]
219        /// Setter for [`textAlignment`][Self::textAlignment].
220        #[unsafe(method(setTextAlignment:))]
221        #[unsafe(method_family = none)]
222        pub fn setTextAlignment(&self, text_alignment: NSTextAlignment);
223    );
224}
225
226/// Methods declared on superclass `NSObject`.
227impl UISimpleTextPrintFormatter {
228    extern_methods!(
229        #[unsafe(method(init))]
230        #[unsafe(method_family = init)]
231        pub fn init(this: Allocated<Self>) -> Retained<Self>;
232
233        #[unsafe(method(new))]
234        #[unsafe(method_family = new)]
235        pub fn new() -> Retained<Self>;
236    );
237}
238
239impl DefaultRetained for UISimpleTextPrintFormatter {
240    #[inline]
241    fn default_retained() -> Retained<Self> {
242        Self::new()
243    }
244}
245
246extern_class!(
247    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uimarkuptextprintformatter?language=objc)
248    #[unsafe(super(UIPrintFormatter, NSObject))]
249    #[derive(Debug, PartialEq, Eq, Hash)]
250    pub struct UIMarkupTextPrintFormatter;
251);
252
253extern_conformance!(
254    unsafe impl NSCopying for UIMarkupTextPrintFormatter {}
255);
256
257unsafe impl CopyingHelper for UIMarkupTextPrintFormatter {
258    type Result = Self;
259}
260
261extern_conformance!(
262    unsafe impl NSObjectProtocol for UIMarkupTextPrintFormatter {}
263);
264
265impl UIMarkupTextPrintFormatter {
266    extern_methods!(
267        #[unsafe(method(initWithMarkupText:))]
268        #[unsafe(method_family = init)]
269        pub fn initWithMarkupText(this: Allocated<Self>, markup_text: &NSString) -> Retained<Self>;
270
271        #[unsafe(method(markupText))]
272        #[unsafe(method_family = none)]
273        pub fn markupText(&self) -> Option<Retained<NSString>>;
274
275        /// Setter for [`markupText`][Self::markupText].
276        ///
277        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
278        #[unsafe(method(setMarkupText:))]
279        #[unsafe(method_family = none)]
280        pub fn setMarkupText(&self, markup_text: Option<&NSString>);
281    );
282}
283
284/// Methods declared on superclass `NSObject`.
285impl UIMarkupTextPrintFormatter {
286    extern_methods!(
287        #[unsafe(method(init))]
288        #[unsafe(method_family = init)]
289        pub fn init(this: Allocated<Self>) -> Retained<Self>;
290
291        #[unsafe(method(new))]
292        #[unsafe(method_family = new)]
293        pub fn new() -> Retained<Self>;
294    );
295}
296
297impl DefaultRetained for UIMarkupTextPrintFormatter {
298    #[inline]
299    fn default_retained() -> Retained<Self> {
300        Self::new()
301    }
302}
303
304extern_class!(
305    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewprintformatter?language=objc)
306    #[unsafe(super(UIPrintFormatter, NSObject))]
307    #[derive(Debug, PartialEq, Eq, Hash)]
308    pub struct UIViewPrintFormatter;
309);
310
311extern_conformance!(
312    unsafe impl NSCopying for UIViewPrintFormatter {}
313);
314
315unsafe impl CopyingHelper for UIViewPrintFormatter {
316    type Result = Self;
317}
318
319extern_conformance!(
320    unsafe impl NSObjectProtocol for UIViewPrintFormatter {}
321);
322
323impl UIViewPrintFormatter {
324    extern_methods!(
325        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
326        #[unsafe(method(view))]
327        #[unsafe(method_family = none)]
328        pub fn view(&self, mtm: MainThreadMarker) -> Retained<UIView>;
329    );
330}
331
332/// Methods declared on superclass `NSObject`.
333impl UIViewPrintFormatter {
334    extern_methods!(
335        #[unsafe(method(init))]
336        #[unsafe(method_family = init)]
337        pub fn init(this: Allocated<Self>) -> Retained<Self>;
338
339        #[unsafe(method(new))]
340        #[unsafe(method_family = new)]
341        pub fn new() -> Retained<Self>;
342    );
343}
344
345impl DefaultRetained for UIViewPrintFormatter {
346    #[inline]
347    fn default_retained() -> Retained<Self> {
348        Self::new()
349    }
350}
351
352/// UIPrintFormatter.
353#[cfg(all(feature = "UIResponder", feature = "UIView"))]
354impl UIView {
355    extern_methods!(
356        #[unsafe(method(viewPrintFormatter))]
357        #[unsafe(method_family = none)]
358        pub fn viewPrintFormatter(&self) -> Retained<UIViewPrintFormatter>;
359
360        #[cfg(feature = "objc2-core-foundation")]
361        #[unsafe(method(drawRect:forViewPrintFormatter:))]
362        #[unsafe(method_family = none)]
363        pub fn drawRect_forViewPrintFormatter(
364            &self,
365            rect: CGRect,
366            formatter: &UIViewPrintFormatter,
367        );
368    );
369}