//! 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/nscolorwellstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorWellStyle(pub NSInteger);
impl NSColorWellStyle {
    #[doc(alias = "NSColorWellStyleDefault")]
    pub const Default: Self = Self(0);
    /// The default `colorWellStyle`. A well that accepts drag/drop of colors as well as reveals the color panel when clicked.
    #[doc(alias = "NSColorWellStyleMinimal")]
    pub const Minimal: Self = Self(1);
    /// A minimally adorned well. By default shows a popover color picker when clicked; this interaction behavior can be customized.
    #[doc(alias = "NSColorWellStyleExpanded")]
    pub const Expanded: Self = Self(2);
}

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

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

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

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSColorWell {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSColorWell {}
);

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSColorWell {}
);

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSColorWell {}
);

#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSCoding for NSColorWell {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSDragging",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSColorWell {}
);

#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSColorWell {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSColorWell {}
);

#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSColorWell {
    extern_methods!(
        #[unsafe(method(colorWellWithStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn colorWellWithStyle(
            style: NSColorWellStyle,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        /// Instantiates a well in the given style with a default configuration.
        #[unsafe(method(deactivate))]
        #[unsafe(method_family = none)]
        pub unsafe fn deactivate(&self);

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

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

        #[unsafe(method(drawWellInside:))]
        #[unsafe(method_family = none)]
        pub unsafe fn drawWellInside(&self, inside_rect: NSRect);

        #[deprecated = "This property will be deprecated in a future release."]
        #[unsafe(method(isBordered))]
        #[unsafe(method_family = none)]
        pub unsafe fn isBordered(&self) -> bool;

        /// Setter for [`isBordered`][Self::isBordered].
        #[deprecated = "This property will be deprecated in a future release."]
        #[unsafe(method(setBordered:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBordered(&self, bordered: bool);

        #[unsafe(method(takeColorFrom:))]
        #[unsafe(method_family = none)]
        pub unsafe fn takeColorFrom(&self, sender: Option<&AnyObject>);

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

        #[cfg(feature = "NSColor")]
        /// Setter for [`color`][Self::color].
        #[unsafe(method(setColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setColor(&self, color: &NSColor);

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

        /// Setter for [`colorWellStyle`][Self::colorWellStyle].
        #[unsafe(method(setColorWellStyle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setColorWellStyle(&self, color_well_style: NSColorWellStyle);

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

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

        /// The image that appears on the button portion of the expanded control. This property only applicable when `colorWellStyle` is `NSColorWellStyleExpanded`.
        #[unsafe(method(pulldownTarget))]
        #[unsafe(method_family = none)]
        pub unsafe fn pulldownTarget(&self) -> Option<Retained<AnyObject>>;

        /// This is a [weak property][objc2::topics::weak_property].
        /// Setter for [`pulldownTarget`][Self::pulldownTarget].
        #[unsafe(method(setPulldownTarget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPulldownTarget(&self, pulldown_target: Option<&AnyObject>);

        /// The target which `pulldownAction` is sent to. This property only applicable when `colorWellStyle` is `NSColorWellStyleExpanded` or `NSColorWellStyleMinimal`.
        #[unsafe(method(pulldownAction))]
        #[unsafe(method_family = none)]
        pub unsafe fn pulldownAction(&self) -> Option<Sel>;

        /// Setter for [`pulldownAction`][Self::pulldownAction].
        #[unsafe(method(setPulldownAction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPulldownAction(&self, pulldown_action: Option<Sel>);

        /// Controls alpha support for the current color well, and the visibility of alpha slider in the color panel.
        /// When `NSColor.ignoresAlpha` (deprecated) is set to `YES`, this property will always return `NO` and alpha is not supported globally.
        #[unsafe(method(supportsAlpha))]
        #[unsafe(method_family = none)]
        pub unsafe fn supportsAlpha(&self) -> bool;

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

/// Methods declared on superclass `NSControl`.
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSColorWell {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

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

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