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(all(feature = "UIGraphicsRenderer", feature = "block2"))]
pub type UIGraphicsPDFDrawingActions =
*mut block2::DynBlock<dyn Fn(NonNull<UIGraphicsPDFRendererContext>)>;
extern_class!(
#[unsafe(super(UIGraphicsRendererFormat, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGraphicsRenderer")]
pub struct UIGraphicsPDFRendererFormat;
);
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSCopying for UIGraphicsPDFRendererFormat {}
);
#[cfg(feature = "UIGraphicsRenderer")]
unsafe impl CopyingHelper for UIGraphicsPDFRendererFormat {
type Result = Self;
}
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIGraphicsPDFRendererFormat {}
);
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRendererFormat {
extern_methods!(
#[unsafe(method(documentInfo))]
#[unsafe(method_family = none)]
pub fn documentInfo(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
#[unsafe(method(setDocumentInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn setDocumentInfo(&self, document_info: &NSDictionary<NSString, AnyObject>);
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRendererFormat {
extern_methods!(
#[deprecated]
#[unsafe(method(defaultFormat))]
#[unsafe(method_family = none)]
pub fn defaultFormat() -> Retained<Self>;
#[unsafe(method(preferredFormat))]
#[unsafe(method_family = none)]
pub fn preferredFormat() -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRendererFormat {
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>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl DefaultRetained for UIGraphicsPDFRendererFormat {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(UIGraphicsRendererContext, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGraphicsRenderer")]
pub struct UIGraphicsPDFRendererContext;
);
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIGraphicsPDFRendererContext {}
);
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRendererContext {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(pdfContextBounds))]
#[unsafe(method_family = none)]
pub fn pdfContextBounds(&self) -> CGRect;
#[unsafe(method(beginPage))]
#[unsafe(method_family = none)]
pub fn beginPage(&self);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(beginPageWithBounds:pageInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn beginPageWithBounds_pageInfo(
&self,
bounds: CGRect,
page_info: &NSDictionary<NSString, AnyObject>,
);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setURL:forRect:))]
#[unsafe(method_family = none)]
pub fn setURL_forRect(&self, url: &NSURL, rect: CGRect);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(addDestinationWithName:atPoint:))]
#[unsafe(method_family = none)]
pub fn addDestinationWithName_atPoint(&self, name: &NSString, point: CGPoint);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setDestinationWithName:forRect:))]
#[unsafe(method_family = none)]
pub fn setDestinationWithName_forRect(&self, name: &NSString, rect: CGRect);
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRendererContext {
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>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl DefaultRetained for UIGraphicsPDFRendererContext {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(UIGraphicsRenderer, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIGraphicsRenderer")]
pub struct UIGraphicsPDFRenderer;
);
#[cfg(feature = "UIGraphicsRenderer")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIGraphicsPDFRenderer {}
);
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRenderer {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithBounds:format:))]
#[unsafe(method_family = init)]
pub fn initWithBounds_format(
this: Allocated<Self>,
bounds: CGRect,
format: &UIGraphicsPDFRendererFormat,
) -> Retained<Self>;
#[cfg(feature = "block2")]
#[unsafe(method(writePDFToURL:withActions:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn writePDFToURL_withActions_error(
&self,
url: &NSURL,
actions: UIGraphicsPDFDrawingActions,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "block2")]
#[unsafe(method(PDFDataWithActions:))]
#[unsafe(method_family = none)]
pub unsafe fn PDFDataWithActions(
&self,
actions: UIGraphicsPDFDrawingActions,
) -> Retained<NSData>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRenderer {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithBounds:))]
#[unsafe(method_family = init)]
pub fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl UIGraphicsPDFRenderer {
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>;
);
}
#[cfg(feature = "UIGraphicsRenderer")]
impl DefaultRetained for UIGraphicsPDFRenderer {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}