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::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowcontroller?language=objc)
    #[unsafe(super(NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSResponder")]
    pub struct NSWindowController;
);

#[cfg(feature = "NSResponder")]
extern_conformance!(
    unsafe impl NSCoding for NSWindowController {}
);

#[cfg(feature = "NSResponder")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSWindowController {}
);

#[cfg(all(feature = "NSResponder", feature = "NSStoryboardSegue"))]
extern_conformance!(
    unsafe impl NSSeguePerforming for NSWindowController {}
);

#[cfg(feature = "NSResponder")]
impl NSWindowController {
    extern_methods!(
        #[cfg(feature = "NSWindow")]
        #[unsafe(method(initWithWindow:))]
        #[unsafe(method_family = init)]
        pub fn initWithWindow(this: Allocated<Self>, window: Option<&NSWindow>) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSNib")]
        #[unsafe(method(initWithWindowNibName:))]
        #[unsafe(method_family = init)]
        pub fn initWithWindowNibName(
            this: Allocated<Self>,
            window_nib_name: &NSNibName,
        ) -> Retained<Self>;

        #[cfg(feature = "NSNib")]
        /// # Safety
        ///
        /// `owner` should be of the correct type.
        #[unsafe(method(initWithWindowNibName:owner:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithWindowNibName_owner(
            this: Allocated<Self>,
            window_nib_name: &NSNibName,
            owner: &AnyObject,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `owner` should be of the correct type.
        #[unsafe(method(initWithWindowNibPath:owner:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithWindowNibPath_owner(
            this: Allocated<Self>,
            window_nib_path: &NSString,
            owner: &AnyObject,
        ) -> Retained<Self>;

        #[cfg(feature = "NSNib")]
        #[unsafe(method(windowNibName))]
        #[unsafe(method_family = none)]
        pub fn windowNibName(&self) -> Option<Retained<NSNibName>>;

        #[unsafe(method(windowNibPath))]
        #[unsafe(method_family = none)]
        pub fn windowNibPath(&self) -> Option<Retained<NSString>>;

        #[unsafe(method(owner))]
        #[unsafe(method_family = none)]
        pub fn owner(&self) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(windowFrameAutosaveName))]
        #[unsafe(method_family = none)]
        pub fn windowFrameAutosaveName(&self) -> Retained<NSWindowFrameAutosaveName>;

        #[cfg(feature = "NSWindow")]
        /// Setter for [`windowFrameAutosaveName`][Self::windowFrameAutosaveName].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setWindowFrameAutosaveName:))]
        #[unsafe(method_family = none)]
        pub fn setWindowFrameAutosaveName(
            &self,
            window_frame_autosave_name: &NSWindowFrameAutosaveName,
        );

        #[unsafe(method(shouldCascadeWindows))]
        #[unsafe(method_family = none)]
        pub fn shouldCascadeWindows(&self) -> bool;

        /// Setter for [`shouldCascadeWindows`][Self::shouldCascadeWindows].
        #[unsafe(method(setShouldCascadeWindows:))]
        #[unsafe(method_family = none)]
        pub fn setShouldCascadeWindows(&self, should_cascade_windows: bool);

        #[cfg(feature = "NSPreviewRepresentingActivityItem")]
        #[unsafe(method(previewRepresentableActivityItems))]
        #[unsafe(method_family = none)]
        pub fn previewRepresentableActivityItems(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>;

        #[cfg(feature = "NSPreviewRepresentingActivityItem")]
        /// Setter for [`previewRepresentableActivityItems`][Self::previewRepresentableActivityItems].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPreviewRepresentableActivityItems:))]
        #[unsafe(method_family = none)]
        pub fn setPreviewRepresentableActivityItems(
            &self,
            preview_representable_activity_items: Option<
                &NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>,
            >,
        );

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(document))]
        #[unsafe(method_family = none)]
        pub unsafe fn document(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`document`][Self::document].
        ///
        /// # Safety
        ///
        /// - `document` should be of the correct type.
        /// - This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setDocument:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDocument(&self, document: Option<&AnyObject>);

        #[unsafe(method(setDocumentEdited:))]
        #[unsafe(method_family = none)]
        pub fn setDocumentEdited(&self, dirty_flag: bool);

        #[unsafe(method(shouldCloseDocument))]
        #[unsafe(method_family = none)]
        pub fn shouldCloseDocument(&self) -> bool;

        /// Setter for [`shouldCloseDocument`][Self::shouldCloseDocument].
        #[unsafe(method(setShouldCloseDocument:))]
        #[unsafe(method_family = none)]
        pub fn setShouldCloseDocument(&self, should_close_document: bool);

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

        #[unsafe(method(windowTitleForDocumentDisplayName:))]
        #[unsafe(method_family = none)]
        pub fn windowTitleForDocumentDisplayName(
            &self,
            display_name: &NSString,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSViewController")]
        #[unsafe(method(contentViewController))]
        #[unsafe(method_family = none)]
        pub fn contentViewController(&self) -> Option<Retained<NSViewController>>;

        #[cfg(feature = "NSViewController")]
        /// Setter for [`contentViewController`][Self::contentViewController].
        #[unsafe(method(setContentViewController:))]
        #[unsafe(method_family = none)]
        pub fn setContentViewController(&self, content_view_controller: Option<&NSViewController>);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(window))]
        #[unsafe(method_family = none)]
        pub fn window(&self) -> Option<Retained<NSWindow>>;

        #[cfg(feature = "NSWindow")]
        /// Setter for [`window`][Self::window].
        #[unsafe(method(setWindow:))]
        #[unsafe(method_family = none)]
        pub fn setWindow(&self, window: Option<&NSWindow>);

        #[unsafe(method(isWindowLoaded))]
        #[unsafe(method_family = none)]
        pub fn isWindowLoaded(&self) -> bool;

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

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

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

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

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(showWindow:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showWindow(&self, sender: Option<&AnyObject>);
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "NSResponder")]
impl NSWindowController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSResponder")]
impl NSWindowController {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// NSWindowControllerStoryboardingMethods.
///
/// These methods are used to support using Storyboards with your app.
#[cfg(feature = "NSResponder")]
impl NSWindowController {
    extern_methods!(
        #[cfg(feature = "NSStoryboard")]
        #[unsafe(method(storyboard))]
        #[unsafe(method_family = none)]
        pub fn storyboard(&self) -> Option<Retained<NSStoryboard>>;
    );
}

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