//! 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::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintingpageorder?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPrintingPageOrder(pub NSInteger);
impl NSPrintingPageOrder {
    #[doc(alias = "NSDescendingPageOrder")]
    pub const DescendingPageOrder: Self = Self(-1);
    #[doc(alias = "NSSpecialPageOrder")]
    pub const SpecialPageOrder: Self = Self(0);
    #[doc(alias = "NSAscendingPageOrder")]
    pub const AscendingPageOrder: Self = Self(1);
    #[doc(alias = "NSUnknownPageOrder")]
    pub const UnknownPageOrder: Self = Self(2);
}

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

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

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

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

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

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintoperationexistsexception?language=objc)
    pub static NSPrintOperationExistsException: &'static NSExceptionName;
}

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

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

impl NSPrintOperation {
    extern_methods!(
        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(printOperationWithView:printInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn printOperationWithView_printInfo(
            view: &NSView,
            print_info: &NSPrintInfo,
        ) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(PDFOperationWithView:insideRect:toData:printInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn PDFOperationWithView_insideRect_toData_printInfo(
            view: &NSView,
            rect: NSRect,
            data: &NSMutableData,
            print_info: &NSPrintInfo,
        ) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(PDFOperationWithView:insideRect:toPath:printInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn PDFOperationWithView_insideRect_toPath_printInfo(
            view: &NSView,
            rect: NSRect,
            path: &NSString,
            print_info: &NSPrintInfo,
        ) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(EPSOperationWithView:insideRect:toData:printInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn EPSOperationWithView_insideRect_toData_printInfo(
            view: &NSView,
            rect: NSRect,
            data: &NSMutableData,
            print_info: &NSPrintInfo,
        ) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(EPSOperationWithView:insideRect:toPath:printInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn EPSOperationWithView_insideRect_toPath_printInfo(
            view: &NSView,
            rect: NSRect,
            path: &NSString,
            print_info: &NSPrintInfo,
        ) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(printOperationWithView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn printOperationWithView(view: &NSView) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(PDFOperationWithView:insideRect:toData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn PDFOperationWithView_insideRect_toData(
            view: &NSView,
            rect: NSRect,
            data: &NSMutableData,
        ) -> Retained<NSPrintOperation>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(EPSOperationWithView:insideRect:toData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn EPSOperationWithView_insideRect_toData(
            view: &NSView,
            rect: NSRect,
            data: Option<&NSMutableData>,
        ) -> Retained<NSPrintOperation>;

        #[unsafe(method(currentOperation))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentOperation(mtm: MainThreadMarker)
            -> Option<Retained<NSPrintOperation>>;

        /// Setter for [`currentOperation`][Self::currentOperation].
        #[unsafe(method(setCurrentOperation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCurrentOperation(
            current_operation: Option<&NSPrintOperation>,
            mtm: MainThreadMarker,
        );

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

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

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

        /// Setter for [`jobTitle`][Self::jobTitle].
        #[unsafe(method(setJobTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setJobTitle(&self, job_title: Option<&NSString>);

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

        /// Setter for [`showsPrintPanel`][Self::showsPrintPanel].
        #[unsafe(method(setShowsPrintPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowsPrintPanel(&self, shows_print_panel: bool);

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

        /// Setter for [`showsProgressPanel`][Self::showsProgressPanel].
        #[unsafe(method(setShowsProgressPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowsProgressPanel(&self, shows_progress_panel: bool);

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

        #[cfg(feature = "NSPrintPanel")]
        /// Setter for [`printPanel`][Self::printPanel].
        #[unsafe(method(setPrintPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPrintPanel(&self, print_panel: &NSPrintPanel);

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

        #[cfg(feature = "NSPDFPanel")]
        /// Setter for [`PDFPanel`][Self::PDFPanel].
        #[unsafe(method(setPDFPanel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPDFPanel(&self, pdf_panel: &NSPDFPanel);

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

        /// Setter for [`canSpawnSeparateThread`][Self::canSpawnSeparateThread].
        #[unsafe(method(setCanSpawnSeparateThread:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCanSpawnSeparateThread(&self, can_spawn_separate_thread: bool);

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

        /// Setter for [`pageOrder`][Self::pageOrder].
        #[unsafe(method(setPageOrder:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPageOrder(&self, page_order: NSPrintingPageOrder);

        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
        #[unsafe(method(runOperationModalForWindow:delegate:didRunSelector:contextInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runOperationModalForWindow_delegate_didRunSelector_contextInfo(
            &self,
            doc_window: &NSWindow,
            delegate: Option<&AnyObject>,
            did_run_selector: Option<Sel>,
            context_info: *mut c_void,
        );

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

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(view))]
        #[unsafe(method_family = none)]
        pub unsafe fn view(&self) -> Option<Retained<NSView>>;

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

        #[cfg(feature = "NSPrintInfo")]
        /// Setter for [`printInfo`][Self::printInfo].
        #[unsafe(method(setPrintInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPrintInfo(&self, print_info: &NSPrintInfo);

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

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

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

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

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

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

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

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

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

/// NSDeprecated.
impl NSPrintOperation {
    extern_methods!(
        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[deprecated = "Use -[NSPrintPanel addAccessoryController:] and -[NSPrintPanel removeAccessoryController:] instead"]
        #[unsafe(method(setAccessoryView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAccessoryView(&self, view: Option<&NSView>);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[deprecated = "Use -[NSPrintPanel accessoryControllers] instead"]
        #[unsafe(method(accessoryView))]
        #[unsafe(method_family = none)]
        pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;

        #[deprecated]
        #[unsafe(method(setJobStyleHint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setJobStyleHint(&self, hint: Option<&NSString>);

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

        #[deprecated = "Use -setShowsPrintPanel: and -setShowsProgressPanel: instead"]
        #[unsafe(method(setShowPanels:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowPanels(&self, flag: bool);

        #[deprecated = "Use -showsPrintPanel and -showsProgressPanel instead"]
        #[unsafe(method(showPanels))]
        #[unsafe(method_family = none)]
        pub unsafe fn showPanels(&self) -> bool;
    );
}
