use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPrintPanelResult(pub NSInteger);
impl NSPrintPanelResult {
#[doc(alias = "NSPrintPanelResultCancelled")]
pub const Cancelled: Self = Self(0);
#[doc(alias = "NSPrintPanelResultPrinted")]
pub const Printed: Self = Self(1);
}
unsafe impl Encode for NSPrintPanelResult {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSPrintPanelResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPrintPanelOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSPrintPanelOptions: NSUInteger {
#[doc(alias = "NSPrintPanelShowsCopies")]
const ShowsCopies = 1<<0;
#[doc(alias = "NSPrintPanelShowsPageRange")]
const ShowsPageRange = 1<<1;
#[doc(alias = "NSPrintPanelShowsPaperSize")]
const ShowsPaperSize = 1<<2;
#[doc(alias = "NSPrintPanelShowsOrientation")]
const ShowsOrientation = 1<<3;
#[doc(alias = "NSPrintPanelShowsScaling")]
const ShowsScaling = 1<<4;
#[doc(alias = "NSPrintPanelShowsPrintSelection")]
const ShowsPrintSelection = 1<<5;
#[doc(alias = "NSPrintPanelShowsPageSetupAccessory")]
const ShowsPageSetupAccessory = 1<<8;
#[doc(alias = "NSPrintPanelShowsPreview")]
const ShowsPreview = 1<<17;
}
}
unsafe impl Encode for NSPrintPanelOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPrintPanelOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSPrintPanelJobStyleHint = NSString;
extern "C" {
pub static NSPrintPhotoJobStyleHint: &'static NSPrintPanelJobStyleHint;
}
extern "C" {
pub static NSPrintAllPresetsJobStyleHint: &'static NSPrintPanelJobStyleHint;
}
extern "C" {
pub static NSPrintNoPresetsJobStyleHint: &'static NSPrintPanelJobStyleHint;
}
pub type NSPrintPanelAccessorySummaryKey = NSString;
extern "C" {
pub static NSPrintPanelAccessorySummaryItemNameKey: &'static NSPrintPanelAccessorySummaryKey;
}
extern "C" {
pub static NSPrintPanelAccessorySummaryItemDescriptionKey:
&'static NSPrintPanelAccessorySummaryKey;
}
extern_protocol!(
pub unsafe trait NSPrintPanelAccessorizing: MainThreadOnly {
#[unsafe(method(localizedSummaryItems))]
#[unsafe(method_family = none)]
fn localizedSummaryItems(
&self,
) -> Retained<NSArray<NSDictionary<NSPrintPanelAccessorySummaryKey, NSString>>>;
#[optional]
#[unsafe(method(keyPathsForValuesAffectingPreview))]
#[unsafe(method_family = none)]
fn keyPathsForValuesAffectingPreview(&self) -> Retained<NSSet<NSString>>;
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSPrintPanel;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSPrintPanel {}
);
impl NSPrintPanel {
extern_methods!(
#[unsafe(method(printPanel))]
#[unsafe(method_family = none)]
pub fn printPanel(mtm: MainThreadMarker) -> Retained<NSPrintPanel>;
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
#[unsafe(method(addAccessoryController:))]
#[unsafe(method_family = none)]
pub unsafe fn addAccessoryController(&self, accessory_controller: &NSViewController);
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
#[unsafe(method(removeAccessoryController:))]
#[unsafe(method_family = none)]
pub unsafe fn removeAccessoryController(&self, accessory_controller: &NSViewController);
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
#[unsafe(method(accessoryControllers))]
#[unsafe(method_family = none)]
pub fn accessoryControllers(&self) -> Retained<NSArray<NSViewController>>;
#[unsafe(method(options))]
#[unsafe(method_family = none)]
pub fn options(&self) -> NSPrintPanelOptions;
#[unsafe(method(setOptions:))]
#[unsafe(method_family = none)]
pub fn setOptions(&self, options: NSPrintPanelOptions);
#[unsafe(method(setDefaultButtonTitle:))]
#[unsafe(method_family = none)]
pub fn setDefaultButtonTitle(&self, default_button_title: Option<&NSString>);
#[unsafe(method(defaultButtonTitle))]
#[unsafe(method_family = none)]
pub fn defaultButtonTitle(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSHelpManager")]
#[unsafe(method(helpAnchor))]
#[unsafe(method_family = none)]
pub fn helpAnchor(&self) -> Option<Retained<NSHelpAnchorName>>;
#[cfg(feature = "NSHelpManager")]
#[unsafe(method(setHelpAnchor:))]
#[unsafe(method_family = none)]
pub fn setHelpAnchor(&self, help_anchor: Option<&NSHelpAnchorName>);
#[unsafe(method(jobStyleHint))]
#[unsafe(method_family = none)]
pub fn jobStyleHint(&self) -> Option<Retained<NSPrintPanelJobStyleHint>>;
#[unsafe(method(setJobStyleHint:))]
#[unsafe(method_family = none)]
pub fn setJobStyleHint(&self, job_style_hint: Option<&NSPrintPanelJobStyleHint>);
#[cfg(all(
feature = "NSPrintInfo",
feature = "NSResponder",
feature = "NSWindow",
feature = "block2"
))]
#[unsafe(method(beginSheetUsingPrintInfo:onWindow:completionHandler:))]
#[unsafe(method_family = none)]
pub fn beginSheetUsingPrintInfo_onWindow_completionHandler(
&self,
print_info: &NSPrintInfo,
parent_window: &NSWindow,
handler: Option<&block2::DynBlock<dyn Fn(NSPrintPanelResult)>>,
);
#[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSWindow"))]
#[deprecated]
#[unsafe(method(beginSheetWithPrintInfo:modalForWindow:delegate:didEndSelector:contextInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn beginSheetWithPrintInfo_modalForWindow_delegate_didEndSelector_contextInfo(
&self,
print_info: &NSPrintInfo,
doc_window: &NSWindow,
delegate: Option<&AnyObject>,
did_end_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(feature = "NSPrintInfo")]
#[unsafe(method(runModalWithPrintInfo:))]
#[unsafe(method_family = none)]
pub fn runModalWithPrintInfo(&self, print_info: &NSPrintInfo) -> NSInteger;
#[unsafe(method(runModal))]
#[unsafe(method_family = none)]
pub fn runModal(&self) -> NSInteger;
#[cfg(feature = "NSPrintInfo")]
#[unsafe(method(printInfo))]
#[unsafe(method_family = none)]
pub fn printInfo(&self) -> Retained<NSPrintInfo>;
);
}
impl NSPrintPanel {
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>;
);
}
impl NSPrintPanel {
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use -addAccessoryController instead"]
#[unsafe(method(setAccessoryView:))]
#[unsafe(method_family = none)]
pub fn setAccessoryView(&self, accessory_view: Option<&NSView>);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use -accessoryControllers instead. For compatibility this returns the view of the first accessory controller, or nil"]
#[unsafe(method(accessoryView))]
#[unsafe(method_family = none)]
pub fn accessoryView(&self) -> Option<Retained<NSView>>;
#[deprecated]
#[unsafe(method(updateFromPrintInfo))]
#[unsafe(method_family = none)]
pub fn updateFromPrintInfo(&self);
#[deprecated]
#[unsafe(method(finalWritePrintInfo))]
#[unsafe(method_family = none)]
pub fn finalWritePrintInfo(&self);
);
}