objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
//! 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/nspagelayoutresult?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPageLayoutResult(pub NSInteger);
impl NSPageLayoutResult {
    #[doc(alias = "NSPageLayoutResultCancelled")]
    pub const Cancelled: Self = Self(0);
    #[doc(alias = "NSPageLayoutResultChanged")]
    pub const Changed: Self = Self(1);
}

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

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

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

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

impl NSPageLayout {
    extern_methods!(
        #[unsafe(method(pageLayout))]
        #[unsafe(method_family = none)]
        pub fn pageLayout(mtm: MainThreadMarker) -> Retained<NSPageLayout>;

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[unsafe(method(addAccessoryController:))]
        #[unsafe(method_family = none)]
        pub fn addAccessoryController(&self, accessory_controller: &NSViewController);

        #[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
        #[unsafe(method(removeAccessoryController:))]
        #[unsafe(method_family = none)]
        pub 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>>;

        #[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(NSPageLayoutResult)>>,
        );

        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder", feature = "NSWindow"))]
        /// # Safety
        ///
        /// - `delegate` should be of the correct type.
        /// - `did_end_selector` must be a valid selector.
        /// - `context_info` must be a valid pointer or null.
        #[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) -> Option<Retained<NSPrintInfo>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSPageLayout {
    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>;
    );
}

/// NSDeprecated.
impl NSPageLayout {
    extern_methods!(
        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        /// # Safety
        ///
        /// `accessory_view` might not allow `None`.
        #[deprecated]
        #[unsafe(method(setAccessoryView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);

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

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

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

/// NSPageLayoutPanel.
#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
impl NSApplication {
    extern_methods!(
        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(runPageLayout:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runPageLayout(&self, sender: Option<&AnyObject>);
    );
}