objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintrenderingquality?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPrintRenderingQuality(pub NSInteger);
impl UIPrintRenderingQuality {
    #[doc(alias = "UIPrintRenderingQualityBest")]
    pub const Best: Self = Self(0);
    #[doc(alias = "UIPrintRenderingQualityResponsive")]
    pub const Responsive: Self = Self(1);
}

unsafe impl Encode for UIPrintRenderingQuality {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIPrintRenderingQuality {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintpagerenderer?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIPrintPageRenderer;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIPrintPageRenderer {}
);

impl UIPrintPageRenderer {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(headerHeight))]
        #[unsafe(method_family = none)]
        pub fn headerHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`headerHeight`][Self::headerHeight].
        #[unsafe(method(setHeaderHeight:))]
        #[unsafe(method_family = none)]
        pub fn setHeaderHeight(&self, header_height: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(footerHeight))]
        #[unsafe(method_family = none)]
        pub fn footerHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`footerHeight`][Self::footerHeight].
        #[unsafe(method(setFooterHeight:))]
        #[unsafe(method_family = none)]
        pub fn setFooterHeight(&self, footer_height: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(paperRect))]
        #[unsafe(method_family = none)]
        pub fn paperRect(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(printableRect))]
        #[unsafe(method_family = none)]
        pub fn printableRect(&self) -> CGRect;

        #[unsafe(method(numberOfPages))]
        #[unsafe(method_family = none)]
        pub fn numberOfPages(&self) -> NSInteger;

        #[cfg(feature = "UIPrintFormatter")]
        #[unsafe(method(printFormatters))]
        #[unsafe(method_family = none)]
        pub fn printFormatters(&self) -> Option<Retained<NSArray<UIPrintFormatter>>>;

        #[cfg(feature = "UIPrintFormatter")]
        /// Setter for [`printFormatters`][Self::printFormatters].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPrintFormatters:))]
        #[unsafe(method_family = none)]
        pub fn setPrintFormatters(&self, print_formatters: Option<&NSArray<UIPrintFormatter>>);

        #[cfg(feature = "UIPrintFormatter")]
        #[unsafe(method(printFormattersForPageAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn printFormattersForPageAtIndex(
            &self,
            page_index: NSInteger,
        ) -> Option<Retained<NSArray<UIPrintFormatter>>>;

        #[cfg(feature = "UIPrintFormatter")]
        #[unsafe(method(addPrintFormatter:startingAtPageAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn addPrintFormatter_startingAtPageAtIndex(
            &self,
            formatter: &UIPrintFormatter,
            page_index: NSInteger,
        );

        #[unsafe(method(currentRenderingQualityForRequestedRenderingQuality:))]
        #[unsafe(method_family = none)]
        pub fn currentRenderingQualityForRequestedRenderingQuality(
            &self,
            requested_rendering_quality: UIPrintRenderingQuality,
        ) -> UIPrintRenderingQuality;

        #[unsafe(method(prepareForDrawingPages:))]
        #[unsafe(method_family = none)]
        pub fn prepareForDrawingPages(&self, range: NSRange);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawPageAtIndex:inRect:))]
        #[unsafe(method_family = none)]
        pub fn drawPageAtIndex_inRect(&self, page_index: NSInteger, printable_rect: CGRect);

        #[cfg(feature = "UIPrintFormatter")]
        #[unsafe(method(drawPrintFormatter:forPageAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn drawPrintFormatter_forPageAtIndex(
            &self,
            print_formatter: &UIPrintFormatter,
            page_index: NSInteger,
        );

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawHeaderForPageAtIndex:inRect:))]
        #[unsafe(method_family = none)]
        pub fn drawHeaderForPageAtIndex_inRect(&self, page_index: NSInteger, header_rect: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawContentForPageAtIndex:inRect:))]
        #[unsafe(method_family = none)]
        pub fn drawContentForPageAtIndex_inRect(&self, page_index: NSInteger, content_rect: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawFooterForPageAtIndex:inRect:))]
        #[unsafe(method_family = none)]
        pub fn drawFooterForPageAtIndex_inRect(&self, page_index: NSInteger, footer_rect: CGRect);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIPrintPageRenderer {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for UIPrintPageRenderer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}