//! 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/nsdraggingimagecomponentkey?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSDraggingImageComponentKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingimagecomponenticonkey?language=objc)
    pub static NSDraggingImageComponentIconKey: &'static NSDraggingImageComponentKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingimagecomponentlabelkey?language=objc)
    pub static NSDraggingImageComponentLabelKey: &'static NSDraggingImageComponentKey;
}

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

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

impl NSDraggingImageComponent {
    extern_methods!(
        #[unsafe(method(draggingImageComponentWithKey:))]
        #[unsafe(method_family = none)]
        pub fn draggingImageComponentWithKey(
            key: &NSDraggingImageComponentKey,
        ) -> Retained<NSDraggingImageComponent>;

        #[unsafe(method(initWithKey:))]
        #[unsafe(method_family = init)]
        pub fn initWithKey(
            this: Allocated<Self>,
            key: &NSDraggingImageComponentKey,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(key))]
        #[unsafe(method_family = none)]
        pub fn key(&self) -> Retained<NSDraggingImageComponentKey>;

        /// Setter for [`key`][Self::key].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setKey:))]
        #[unsafe(method_family = none)]
        pub fn setKey(&self, key: &NSDraggingImageComponentKey);

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

        /// Setter for [`contents`][Self::contents].
        ///
        /// # Safety
        ///
        /// `contents` should be of the correct type.
        #[unsafe(method(setContents:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContents(&self, contents: Option<&AnyObject>);

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

        /// Setter for [`frame`][Self::frame].
        #[unsafe(method(setFrame:))]
        #[unsafe(method_family = none)]
        pub fn setFrame(&self, frame: NSRect);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSDraggingImageComponent {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

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

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

impl NSDraggingItem {
    extern_methods!(
        #[cfg(feature = "NSPasteboard")]
        #[unsafe(method(initWithPasteboardWriter:))]
        #[unsafe(method_family = init)]
        pub fn initWithPasteboardWriter(
            this: Allocated<Self>,
            pasteboard_writer: &ProtocolObject<dyn NSPasteboardWriting>,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

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

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

        /// Setter for [`draggingFrame`][Self::draggingFrame].
        #[unsafe(method(setDraggingFrame:))]
        #[unsafe(method_family = none)]
        pub fn setDraggingFrame(&self, dragging_frame: NSRect);

        #[cfg(feature = "block2")]
        #[unsafe(method(imageComponentsProvider))]
        #[unsafe(method_family = none)]
        pub fn imageComponentsProvider(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>;

        #[cfg(feature = "block2")]
        /// Setter for [`imageComponentsProvider`][Self::imageComponentsProvider].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `image_components_provider` block's return must be a valid pointer.
        #[unsafe(method(setImageComponentsProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setImageComponentsProvider(
            &self,
            image_components_provider: Option<
                &block2::DynBlock<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>,
            >,
        );

        /// # Safety
        ///
        /// `contents` should be of the correct type.
        #[unsafe(method(setDraggingFrame:contents:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDraggingFrame_contents(&self, frame: NSRect, contents: Option<&AnyObject>);

        #[unsafe(method(imageComponents))]
        #[unsafe(method_family = none)]
        pub fn imageComponents(&self) -> Option<Retained<NSArray<NSDraggingImageComponent>>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSDraggingItem {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
