//! 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/nsopenpanel?language=objc)
    #[unsafe(super(NSSavePanel, NSPanel, NSWindow, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "NSPanel",
        feature = "NSResponder",
        feature = "NSSavePanel",
        feature = "NSWindow"
    ))]
    pub struct NSOpenPanel;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSCoding for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSMenu",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSMenuItemValidation for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSUserInterfaceValidation",
    feature = "NSWindow"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceValidations for NSOpenPanel {}
);

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
impl NSOpenPanel {
    extern_methods!(
        #[unsafe(method(openPanel))]
        #[unsafe(method_family = none)]
        pub fn openPanel(mtm: MainThreadMarker) -> Retained<NSOpenPanel>;

        #[unsafe(method(URLs))]
        #[unsafe(method_family = none)]
        pub fn URLs(&self) -> Retained<NSArray<NSURL>>;

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

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

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

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

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

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

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

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

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

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

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

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

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

        /// Setter for [`isAccessoryViewDisclosed`][Self::isAccessoryViewDisclosed].
        #[unsafe(method(setAccessoryViewDisclosed:))]
        #[unsafe(method_family = none)]
        pub fn setAccessoryViewDisclosed(&self, accessory_view_disclosed: bool);
    );
}

/// Methods declared on superclass `NSWindow`.
#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
impl NSOpenPanel {
    extern_methods!(
        #[cfg(feature = "NSGraphics")]
        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
            screen: Option<&NSScreen>,
        ) -> Retained<Self>;

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

        #[cfg(feature = "NSViewController")]
        /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
        #[unsafe(method(windowWithContentViewController:))]
        #[unsafe(method_family = none)]
        pub fn windowWithContentViewController(
            content_view_controller: &NSViewController,
        ) -> Retained<Self>;
    );
}

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

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

/// InheritedAndUnavailable.
#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
impl NSOpenPanel {
    extern_methods!(
        #[unsafe(method(showsContentTypes))]
        #[unsafe(method_family = none)]
        pub unsafe fn showsContentTypes(&self) -> bool;

        /// Setter for [`showsContentTypes`][Self::showsContentTypes].
        #[unsafe(method(setShowsContentTypes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowsContentTypes(&self, shows_content_types: bool);
    );
}

/// NSDeprecated.
#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSSavePanel",
    feature = "NSWindow"
))]
impl NSOpenPanel {
    extern_methods!(
        #[deprecated]
        #[unsafe(method(filenames))]
        #[unsafe(method_family = none)]
        pub fn filenames(&self) -> Retained<NSArray>;

        /// # Safety
        ///
        /// - `file_types` generic should be of the correct type.
        /// - `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(beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo(
            &self,
            path: Option<&NSString>,
            name: Option<&NSString>,
            file_types: Option<&NSArray>,
            doc_window: Option<&NSWindow>,
            delegate: Option<&AnyObject>,
            did_end_selector: Option<Sel>,
            context_info: *mut c_void,
        );

        /// # Safety
        ///
        /// - `file_types` generic should be of the correct type.
        /// - `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(beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo(
            &self,
            path: Option<&NSString>,
            name: Option<&NSString>,
            file_types: Option<&NSArray>,
            delegate: Option<&AnyObject>,
            did_end_selector: Option<Sel>,
            context_info: *mut c_void,
        );

        /// # Safety
        ///
        /// `file_types` generic should be of the correct type.
        #[deprecated]
        #[unsafe(method(runModalForDirectory:file:types:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runModalForDirectory_file_types(
            &self,
            path: Option<&NSString>,
            name: Option<&NSString>,
            file_types: Option<&NSArray>,
        ) -> NSInteger;

        /// # Safety
        ///
        /// `file_types` generic should be of the correct type.
        #[deprecated]
        #[unsafe(method(runModalForTypes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runModalForTypes(&self, file_types: Option<&NSArray>) -> NSInteger;
    );
}
