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::*;

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

extern_conformance!(
    unsafe impl NSCopying for UIPrintFormatter {}
);

unsafe impl CopyingHelper for UIPrintFormatter {
    type Result = Self;
}

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

impl UIPrintFormatter {
    extern_methods!(
        #[cfg(feature = "UIPrintPageRenderer")]
        #[unsafe(method(printPageRenderer))]
        #[unsafe(method_family = none)]
        pub fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;

        #[unsafe(method(removeFromPrintPageRenderer))]
        #[unsafe(method_family = none)]
        pub fn removeFromPrintPageRenderer(&self);

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

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

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

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

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[deprecated]
        #[unsafe(method(contentInsets))]
        #[unsafe(method_family = none)]
        pub fn contentInsets(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`contentInsets`][Self::contentInsets].
        #[deprecated]
        #[unsafe(method(setContentInsets:))]
        #[unsafe(method_family = none)]
        pub fn setContentInsets(&self, content_insets: UIEdgeInsets);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(perPageContentInsets))]
        #[unsafe(method_family = none)]
        pub fn perPageContentInsets(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`perPageContentInsets`][Self::perPageContentInsets].
        #[unsafe(method(setPerPageContentInsets:))]
        #[unsafe(method_family = none)]
        pub fn setPerPageContentInsets(&self, per_page_content_insets: UIEdgeInsets);

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

        /// Setter for [`startPage`][Self::startPage].
        #[unsafe(method(setStartPage:))]
        #[unsafe(method_family = none)]
        pub fn setStartPage(&self, start_page: NSInteger);

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawInRect:forPageAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn drawInRect_forPageAtIndex(&self, rect: CGRect, page_index: NSInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIPrintFormatter {
    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 UIPrintFormatter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

extern_conformance!(
    unsafe impl NSCopying for UISimpleTextPrintFormatter {}
);

unsafe impl CopyingHelper for UISimpleTextPrintFormatter {
    type Result = Self;
}

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

impl UISimpleTextPrintFormatter {
    extern_methods!(
        #[unsafe(method(initWithText:))]
        #[unsafe(method_family = init)]
        pub fn initWithText(this: Allocated<Self>, text: &NSString) -> Retained<Self>;

        #[unsafe(method(initWithAttributedText:))]
        #[unsafe(method_family = init)]
        pub fn initWithAttributedText(
            this: Allocated<Self>,
            attributed_text: &NSAttributedString,
        ) -> Retained<Self>;

        #[unsafe(method(text))]
        #[unsafe(method_family = none)]
        pub fn text(&self) -> Option<Retained<NSString>>;

        /// Setter for [`text`][Self::text].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setText:))]
        #[unsafe(method_family = none)]
        pub fn setText(&self, text: Option<&NSString>);

        #[unsafe(method(attributedText))]
        #[unsafe(method_family = none)]
        pub fn attributedText(&self) -> Option<Retained<NSAttributedString>>;

        /// Setter for [`attributedText`][Self::attributedText].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributedText:))]
        #[unsafe(method_family = none)]
        pub fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);

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

        #[cfg(feature = "UIFont")]
        /// Setter for [`font`][Self::font].
        #[unsafe(method(setFont:))]
        #[unsafe(method_family = none)]
        pub fn setFont(&self, font: Option<&UIFont>);

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

        #[cfg(feature = "UIColor")]
        /// Setter for [`color`][Self::color].
        #[unsafe(method(setColor:))]
        #[unsafe(method_family = none)]
        pub fn setColor(&self, color: Option<&UIColor>);

        #[cfg(feature = "NSText")]
        #[unsafe(method(textAlignment))]
        #[unsafe(method_family = none)]
        pub fn textAlignment(&self) -> NSTextAlignment;

        #[cfg(feature = "NSText")]
        /// Setter for [`textAlignment`][Self::textAlignment].
        #[unsafe(method(setTextAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setTextAlignment(&self, text_alignment: NSTextAlignment);
    );
}

/// Methods declared on superclass `NSObject`.
impl UISimpleTextPrintFormatter {
    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 UISimpleTextPrintFormatter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

extern_conformance!(
    unsafe impl NSCopying for UIMarkupTextPrintFormatter {}
);

unsafe impl CopyingHelper for UIMarkupTextPrintFormatter {
    type Result = Self;
}

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

impl UIMarkupTextPrintFormatter {
    extern_methods!(
        #[unsafe(method(initWithMarkupText:))]
        #[unsafe(method_family = init)]
        pub fn initWithMarkupText(this: Allocated<Self>, markup_text: &NSString) -> Retained<Self>;

        #[unsafe(method(markupText))]
        #[unsafe(method_family = none)]
        pub fn markupText(&self) -> Option<Retained<NSString>>;

        /// Setter for [`markupText`][Self::markupText].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMarkupText:))]
        #[unsafe(method_family = none)]
        pub fn setMarkupText(&self, markup_text: Option<&NSString>);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIMarkupTextPrintFormatter {
    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 UIMarkupTextPrintFormatter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

extern_conformance!(
    unsafe impl NSCopying for UIViewPrintFormatter {}
);

unsafe impl CopyingHelper for UIViewPrintFormatter {
    type Result = Self;
}

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

impl UIViewPrintFormatter {
    extern_methods!(
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[unsafe(method(view))]
        #[unsafe(method_family = none)]
        pub fn view(&self, mtm: MainThreadMarker) -> Retained<UIView>;
    );
}

/// Methods declared on superclass `NSObject`.
impl UIViewPrintFormatter {
    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 UIViewPrintFormatter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// UIPrintFormatter.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIView {
    extern_methods!(
        #[unsafe(method(viewPrintFormatter))]
        #[unsafe(method_family = none)]
        pub fn viewPrintFormatter(&self) -> Retained<UIViewPrintFormatter>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(drawRect:forViewPrintFormatter:))]
        #[unsafe(method_family = none)]
        pub fn drawRect_forViewPrintFormatter(
            &self,
            rect: CGRect,
            formatter: &UIViewPrintFormatter,
        );
    );
}