use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[cfg(feature = "block2")]
pub type UIPrintInteractionCompletionHandler =
*mut block2::Block<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!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIPrintInteractionController;
unsafe impl ClassType for UIPrintInteractionController {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSObjectProtocol for UIPrintInteractionController {}
extern_methods!(
unsafe impl UIPrintInteractionController {
#[method(isPrintingAvailable)]
pub unsafe fn isPrintingAvailable(mtm: MainThreadMarker) -> bool;
#[method_id(@__retain_semantics Other printableUTIs)]
pub unsafe fn printableUTIs(mtm: MainThreadMarker) -> Retained<NSSet<NSString>>;
#[method(canPrintURL:)]
pub unsafe fn canPrintURL(url: &NSURL, mtm: MainThreadMarker) -> bool;
#[method(canPrintData:)]
pub unsafe fn canPrintData(data: &NSData, mtm: MainThreadMarker) -> bool;
#[method_id(@__retain_semantics Other sharedPrintController)]
pub unsafe fn sharedPrintController(
mtm: MainThreadMarker,
) -> Retained<UIPrintInteractionController>;
#[cfg(feature = "UIPrintInfo")]
#[method_id(@__retain_semantics Other printInfo)]
pub unsafe fn printInfo(&self) -> Option<Retained<UIPrintInfo>>;
#[cfg(feature = "UIPrintInfo")]
#[method(setPrintInfo:)]
pub unsafe fn setPrintInfo(&self, print_info: Option<&UIPrintInfo>);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPrintInteractionControllerDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn UIPrintInteractionControllerDelegate>>,
);
#[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
#[method(showsPageRange)]
pub unsafe fn showsPageRange(&self) -> bool;
#[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
#[method(setShowsPageRange:)]
pub unsafe fn setShowsPageRange(&self, shows_page_range: bool);
#[method(showsNumberOfCopies)]
pub unsafe fn showsNumberOfCopies(&self) -> bool;
#[method(setShowsNumberOfCopies:)]
pub unsafe fn setShowsNumberOfCopies(&self, shows_number_of_copies: bool);
#[method(showsPaperSelectionForLoadedPapers)]
pub unsafe fn showsPaperSelectionForLoadedPapers(&self) -> bool;
#[method(setShowsPaperSelectionForLoadedPapers:)]
pub unsafe fn setShowsPaperSelectionForLoadedPapers(
&self,
shows_paper_selection_for_loaded_papers: bool,
);
#[method(showsPaperOrientation)]
pub unsafe fn showsPaperOrientation(&self) -> bool;
#[method(setShowsPaperOrientation:)]
pub unsafe fn setShowsPaperOrientation(&self, shows_paper_orientation: bool);
#[cfg(feature = "UIPrintPaper")]
#[method_id(@__retain_semantics Other printPaper)]
pub unsafe fn printPaper(&self) -> Option<Retained<UIPrintPaper>>;
#[cfg(feature = "UIPrintPageRenderer")]
#[method_id(@__retain_semantics Other printPageRenderer)]
pub unsafe fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;
#[cfg(feature = "UIPrintPageRenderer")]
#[method(setPrintPageRenderer:)]
pub unsafe fn setPrintPageRenderer(
&self,
print_page_renderer: Option<&UIPrintPageRenderer>,
);
#[cfg(feature = "UIPrintFormatter")]
#[method_id(@__retain_semantics Other printFormatter)]
pub unsafe fn printFormatter(&self) -> Option<Retained<UIPrintFormatter>>;
#[cfg(feature = "UIPrintFormatter")]
#[method(setPrintFormatter:)]
pub unsafe fn setPrintFormatter(&self, print_formatter: Option<&UIPrintFormatter>);
#[method_id(@__retain_semantics Other printingItem)]
pub unsafe fn printingItem(&self) -> Option<Retained<AnyObject>>;
#[method(setPrintingItem:)]
pub unsafe fn setPrintingItem(&self, printing_item: Option<&AnyObject>);
#[method_id(@__retain_semantics Other printingItems)]
pub unsafe fn printingItems(&self) -> Option<Retained<NSArray>>;
#[method(setPrintingItems:)]
pub unsafe fn setPrintingItems(&self, printing_items: Option<&NSArray>);
#[cfg(feature = "block2")]
#[method(presentAnimated:completionHandler:)]
pub unsafe fn presentAnimated_completionHandler(
&self,
animated: bool,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
#[method(presentFromRect:inView:animated:completionHandler:)]
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"))]
#[method(presentFromBarButtonItem:animated:completionHandler:)]
pub unsafe fn presentFromBarButtonItem_animated_completionHandler(
&self,
item: &UIBarButtonItem,
animated: bool,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[cfg(all(feature = "UIPrinter", feature = "block2"))]
#[method(printToPrinter:completionHandler:)]
pub unsafe fn printToPrinter_completionHandler(
&self,
printer: &UIPrinter,
completion: UIPrintInteractionCompletionHandler,
) -> bool;
#[method(dismissAnimated:)]
pub unsafe fn dismissAnimated(&self, animated: bool);
}
);
extern_methods!(
unsafe impl UIPrintInteractionController {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait UIPrintInteractionControllerDelegate:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
#[optional]
#[method_id(@__retain_semantics Other printInteractionControllerParentViewController:)]
unsafe fn printInteractionControllerParentViewController(
&self,
print_interaction_controller: &UIPrintInteractionController,
) -> Option<Retained<UIViewController>>;
#[cfg(feature = "UIPrintPaper")]
#[optional]
#[method_id(@__retain_semantics Other printInteractionController:choosePaper:)]
unsafe fn printInteractionController_choosePaper(
&self,
print_interaction_controller: &UIPrintInteractionController,
paper_list: &NSArray<UIPrintPaper>,
) -> Retained<UIPrintPaper>;
#[optional]
#[method(printInteractionControllerWillPresentPrinterOptions:)]
unsafe fn printInteractionControllerWillPresentPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[method(printInteractionControllerDidPresentPrinterOptions:)]
unsafe fn printInteractionControllerDidPresentPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[method(printInteractionControllerWillDismissPrinterOptions:)]
unsafe fn printInteractionControllerWillDismissPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[method(printInteractionControllerDidDismissPrinterOptions:)]
unsafe fn printInteractionControllerDidDismissPrinterOptions(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[method(printInteractionControllerWillStartJob:)]
unsafe fn printInteractionControllerWillStartJob(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[optional]
#[method(printInteractionControllerDidFinishJob:)]
unsafe fn printInteractionControllerDidFinishJob(
&self,
print_interaction_controller: &UIPrintInteractionController,
);
#[cfg(feature = "UIPrintPaper")]
#[optional]
#[method(printInteractionController:cutLengthForPaper:)]
unsafe fn printInteractionController_cutLengthForPaper(
&self,
print_interaction_controller: &UIPrintInteractionController,
paper: &UIPrintPaper,
) -> CGFloat;
#[optional]
#[method(printInteractionController:chooseCutterBehavior:)]
unsafe fn printInteractionController_chooseCutterBehavior(
&self,
print_interaction_controller: &UIPrintInteractionController,
available_behaviors: &NSArray,
) -> UIPrinterCutterBehavior;
}
unsafe impl ProtocolType for dyn UIPrintInteractionControllerDelegate {}
);