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::*;
#[cfg(feature = "block2")]
pub type UIPrintInteractionCompletionHandler =
*mut block2::DynBlock<dyn Fn(NonNull<UIPrintInteractionController>, Bool, *mut NSError)>;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPrinterCutterBehavior(pub NSInteger);
impl UIPrinterCutterBehavior {
#[doc(alias = "UIPrinterCutterBehaviorNoCut")]
pub const NoCut: Self = Self(0);
#[doc(alias = "UIPrinterCutterBehaviorPrinterDefault")]
pub const PrinterDefault: Self = Self(1);
#[doc(alias = "UIPrinterCutterBehaviorCutAfterEachPage")]
pub const CutAfterEachPage: Self = Self(2);
#[doc(alias = "UIPrinterCutterBehaviorCutAfterEachCopy")]
pub const CutAfterEachCopy: Self = Self(3);
#[doc(alias = "UIPrinterCutterBehaviorCutAfterEachJob")]
pub const CutAfterEachJob: Self = Self(4);
}
unsafe impl Encode for UIPrinterCutterBehavior {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIPrinterCutterBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIPrintInteractionController;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIPrintInteractionController {}
);
impl UIPrintInteractionController {
extern_methods!(
#[unsafe(method(isPrintingAvailable))]
#[unsafe(method_family = none)]
pub fn isPrintingAvailable(mtm: MainThreadMarker) -> bool;
#[unsafe(method(printableUTIs))]
#[unsafe(method_family = none)]
pub fn printableUTIs(mtm: MainThreadMarker) -> Retained<NSSet<NSString>>;
#[unsafe(method(canPrintURL:))]
#[unsafe(method_family = none)]
pub fn canPrintURL(url: &NSURL, mtm: MainThreadMarker) -> bool;
#[unsafe(method(canPrintData:))]
#[unsafe(method_family = none)]
pub fn canPrintData(data: &NSData, mtm: MainThreadMarker) -> bool;
#[unsafe(method(sharedPrintController))]
#[unsafe(method_family = none)]
pub fn sharedPrintController(
mtm: MainThreadMarker,
) -> Retained<UIPrintInteractionController>;
#[cfg(feature = "UIPrintInfo")]
#[unsafe(method(printInfo))]
#[unsafe(method_family = none)]
pub fn printInfo(&self) -> Option<Retained<UIPrintInfo>>;
#[cfg(feature = "UIPrintInfo")]
#[unsafe(method(setPrintInfo:))]
#[unsafe(method_family = none)]
pub fn setPrintInfo(&self, print_info: Option<&UIPrintInfo>);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPrintInteractionControllerDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UIPrintInteractionControllerDelegate>>,
);
#[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
#[unsafe(method(showsPageRange))]
#[unsafe(method_family = none)]
pub fn showsPageRange(&self) -> bool;
#[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
#[unsafe(method(setShowsPageRange:))]
#[unsafe(method_family = none)]
pub fn setShowsPageRange(&self, shows_page_range: bool);
#[unsafe(method(showsNumberOfCopies))]
#[unsafe(method_family = none)]
pub fn showsNumberOfCopies(&self) -> bool;
#[unsafe(method(setShowsNumberOfCopies:))]
#[unsafe(method_family = none)]
pub fn setShowsNumberOfCopies(&self, shows_number_of_copies: bool);
#[unsafe(method(showsPaperSelectionForLoadedPapers))]
#[unsafe(method_family = none)]
pub fn showsPaperSelectionForLoadedPapers(&self) -> bool;
#[unsafe(method(setShowsPaperSelectionForLoadedPapers:))]
#[unsafe(method_family = none)]
pub fn setShowsPaperSelectionForLoadedPapers(
&self,
shows_paper_selection_for_loaded_papers: bool,
);
#[unsafe(method(showsPaperOrientation))]
#[unsafe(method_family = none)]
pub fn showsPaperOrientation(&self) -> bool;
#[unsafe(method(setShowsPaperOrientation:))]
#[unsafe(method_family = none)]
pub fn setShowsPaperOrientation(&self, shows_paper_orientation: bool);
#[cfg(feature = "UIPrintPaper")]
#[unsafe(method(printPaper))]
#[unsafe(method_family = none)]
pub fn printPaper(&self) -> Option<Retained<UIPrintPaper>>;
#[cfg(feature = "UIPrintPageRenderer")]
#[unsafe(method(printPageRenderer))]
#[unsafe(method_family = none)]
pub fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;
#[cfg(feature = "UIPrintPageRenderer")]
#[unsafe(method(setPrintPageRenderer:))]
#[unsafe(method_family = none)]
pub fn setPrintPageRenderer(&self, print_page_renderer: Option<&UIPrintPageRenderer>);
#[cfg(feature = "UIPrintFormatter")]
#[unsafe(method(printFormatter))]
#[unsafe(method_family = none)]
pub fn printFormatter(&self) -> Option<Retained<UIPrintFormatter>>;
#[cfg(feature = "UIPrintFormatter")]
#[unsafe(method(setPrintFormatter:))]
#[unsafe(method_family = none)]
pub fn setPrintFormatter(&self, print_formatter: Option<&UIPrintFormatter>);
#[unsafe(method(printingItem))]
#[unsafe(method_family = none)]
pub fn printingItem(&self) -> Option<Retained<AnyObject>>;
#[unsafe(method(setPrintingItem:))]
#[unsafe(method_family = none)]
pub unsafe fn setPrintingItem(&self, printing_item: Option<&AnyObject>);
#[unsafe(method(printingItems))]
#[unsafe(method_family = none)]
pub fn printingItems(&self) -> Option<Retained<NSArray>>;
#[unsafe(method(setPrintingItems:))]
#[unsafe(method_family = none)]
pub unsafe fn setPrintingItems(&self, printing_items: Option<&NSArray>);
#[cfg(feature = "block2")]
#[unsafe(method(presentAnimated:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn presentAnimated_completionHandler(
&self,
animated: bool,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[cfg(all(
feature = "UIResponder",
feature = "UIView",
feature = "block2",
feature = "objc2-core-foundation"
))]
#[unsafe(method(presentFromRect:inView:animated:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn presentFromRect_inView_animated_completionHandler(
&self,
rect: CGRect,
view: &UIView,
animated: bool,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem", feature = "block2"))]
#[unsafe(method(presentFromBarButtonItem:animated:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn presentFromBarButtonItem_animated_completionHandler(
&self,
item: &UIBarButtonItem,
animated: bool,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[cfg(all(feature = "UIPrinter", feature = "block2"))]
#[unsafe(method(printToPrinter:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn printToPrinter_completionHandler(
&self,
printer: &UIPrinter,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[unsafe(method(dismissAnimated:))]
#[unsafe(method_family = none)]
pub fn dismissAnimated(&self, animated: bool);
);
}
impl UIPrintInteractionController {
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(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait UIPrintInteractionControllerDelegate:
NSObjectProtocol + MainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[unsafe(method(printInteractionControllerParentViewController:))]
#[unsafe(method_family = none)]
fn printInteractionControllerParentViewController(
&self,
print_interaction_controller: &UIPrintInteractionController,
) -> Option<Retained<UIViewController>>;
#[cfg(feature = "UIPrintPaper")]
#[optional]
#[unsafe(method(printInteractionController:choosePaper:))]
#[unsafe(method_family = none)]
fn printInteractionController_choosePaper(
&self,
print_interaction_controller: &UIPrintInteractionController,
paper_list: &NSArray<UIPrintPaper>,
) -> Retained<UIPrintPaper>;
#[optional]
#[unsafe(method(printInteractionControllerWillPresentPrinterOptions:))]
#[unsafe(method_family = none)]
fn printInteractionControllerWillPresentPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[unsafe(method(printInteractionControllerDidPresentPrinterOptions:))]
#[unsafe(method_family = none)]
fn printInteractionControllerDidPresentPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[unsafe(method(printInteractionControllerWillDismissPrinterOptions:))]
#[unsafe(method_family = none)]
fn printInteractionControllerWillDismissPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[unsafe(method(printInteractionControllerDidDismissPrinterOptions:))]
#[unsafe(method_family = none)]
fn printInteractionControllerDidDismissPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[unsafe(method(printInteractionControllerWillStartJob:))]
#[unsafe(method_family = none)]
fn printInteractionControllerWillStartJob(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[unsafe(method(printInteractionControllerDidFinishJob:))]
#[unsafe(method_family = none)]
fn printInteractionControllerDidFinishJob(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[cfg(all(feature = "UIPrintPaper", feature = "objc2-core-foundation"))]
#[optional]
#[unsafe(method(printInteractionController:cutLengthForPaper:))]
#[unsafe(method_family = none)]
fn printInteractionController_cutLengthForPaper(
&self,
print_interaction_controller: &UIPrintInteractionController,
paper: &UIPrintPaper,
) -> CGFloat;
#[optional]
#[unsafe(method(printInteractionController:chooseCutterBehavior:))]
#[unsafe(method_family = none)]
unsafe fn printInteractionController_chooseCutterBehavior(
&self,
print_interaction_controller: &UIPrintInteractionController,
available_behaviors: &NSArray,
) -> UIPrinterCutterBehavior;
}
);