//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorPanelMode(pub NSInteger);
impl NSColorPanelMode {
    #[doc(alias = "NSColorPanelModeNone")]
    pub const None: Self = Self(-1);
    #[doc(alias = "NSColorPanelModeGray")]
    pub const Gray: Self = Self(0);
    #[doc(alias = "NSColorPanelModeRGB")]
    pub const RGB: Self = Self(1);
    #[doc(alias = "NSColorPanelModeCMYK")]
    pub const CMYK: Self = Self(2);
    #[doc(alias = "NSColorPanelModeHSB")]
    pub const HSB: Self = Self(3);
    #[doc(alias = "NSColorPanelModeCustomPalette")]
    pub const CustomPalette: Self = Self(4);
    #[doc(alias = "NSColorPanelModeColorList")]
    pub const ColorList: Self = Self(5);
    #[doc(alias = "NSColorPanelModeWheel")]
    pub const Wheel: Self = Self(6);
    #[doc(alias = "NSColorPanelModeCrayon")]
    pub const Crayon: Self = Self(7);
}

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

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorPanelOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSColorPanelOptions: NSUInteger {
        const NSColorPanelGrayModeMask = 0x00000001;
        const NSColorPanelRGBModeMask = 0x00000002;
        const NSColorPanelCMYKModeMask = 0x00000004;
        const NSColorPanelHSBModeMask = 0x00000008;
        const NSColorPanelCustomPaletteModeMask = 0x00000010;
        const NSColorPanelColorListModeMask = 0x00000020;
        const NSColorPanelWheelModeMask = 0x00000040;
        const NSColorPanelCrayonModeMask = 0x00000080;
        const NSColorPanelAllModesMask = 0x0000ffff;
    }
}

unsafe impl Encode for NSColorPanelOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    pub struct NSColorPanel;

    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl ClassType for NSColorPanel {
        #[inherits(NSWindow, NSResponder, NSObject)]
        type Super = NSPanel;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAccessibility for NSColorPanel {}

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAccessibilityElementProtocol for NSColorPanel {}

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAnimatablePropertyContainer for NSColorPanel {}

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAppearanceCustomization for NSColorPanel {}

#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSCoding for NSColorPanel {}

#[cfg(all(
    feature = "NSMenu",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSMenuItemValidation for NSColorPanel {}

#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSObjectProtocol for NSColorPanel {}

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSWindow"
))]
unsafe impl NSUserInterfaceItemIdentification for NSColorPanel {}

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSUserInterfaceValidation",
    feature = "NSWindow"
))]
unsafe impl NSUserInterfaceValidations for NSColorPanel {}

extern_methods!(
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSColorPanel {
        #[method_id(@__retain_semantics Other sharedColorPanel)]
        pub unsafe fn sharedColorPanel(mtm: MainThreadMarker) -> Retained<NSColorPanel>;

        #[method(sharedColorPanelExists)]
        pub unsafe fn sharedColorPanelExists(mtm: MainThreadMarker) -> bool;

        #[cfg(all(feature = "NSColor", feature = "NSEvent", feature = "NSView"))]
        #[method(dragColor:withEvent:fromView:)]
        pub unsafe fn dragColor_withEvent_fromView(
            color: &NSColor,
            event: &NSEvent,
            source_view: &NSView,
        ) -> bool;

        #[method(setPickerMask:)]
        pub unsafe fn setPickerMask(mask: NSColorPanelOptions, mtm: MainThreadMarker);

        #[method(setPickerMode:)]
        pub unsafe fn setPickerMode(mode: NSColorPanelMode, mtm: MainThreadMarker);

        #[cfg(feature = "NSView")]
        #[method_id(@__retain_semantics Other accessoryView)]
        pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;

        #[cfg(feature = "NSView")]
        #[method(setAccessoryView:)]
        pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);

        #[method(isContinuous)]
        pub unsafe fn isContinuous(&self) -> bool;

        #[method(setContinuous:)]
        pub unsafe fn setContinuous(&self, continuous: bool);

        #[method(showsAlpha)]
        pub unsafe fn showsAlpha(&self) -> bool;

        #[method(setShowsAlpha:)]
        pub unsafe fn setShowsAlpha(&self, shows_alpha: bool);

        #[method(mode)]
        pub unsafe fn mode(&self) -> NSColorPanelMode;

        #[method(setMode:)]
        pub unsafe fn setMode(&self, mode: NSColorPanelMode);

        #[cfg(feature = "NSColor")]
        #[method_id(@__retain_semantics Other color)]
        pub unsafe fn color(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        #[method(setColor:)]
        pub unsafe fn setColor(&self, color: &NSColor);

        #[method(alpha)]
        pub unsafe fn alpha(&self) -> CGFloat;

        #[method(setAction:)]
        pub unsafe fn setAction(&self, selector: Option<Sel>);

        #[method(setTarget:)]
        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);

        #[cfg(feature = "NSColorList")]
        #[method(attachColorList:)]
        pub unsafe fn attachColorList(&self, color_list: &NSColorList);

        #[cfg(feature = "NSColorList")]
        #[method(detachColorList:)]
        pub unsafe fn detachColorList(&self, color_list: &NSColorList);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSWindow`
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSColorPanel {
        #[cfg(feature = "NSGraphics")]
        #[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:)]
        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"))]
        #[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:screen:)]
        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>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[cfg(feature = "NSViewController")]
        #[method_id(@__retain_semantics Other windowWithContentViewController:)]
        pub unsafe fn windowWithContentViewController(
            content_view_controller: &NSViewController,
        ) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSResponder`
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSColorPanel {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSColorPanel {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_methods!(
    /// NSColorPanel
    #[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
    unsafe impl NSApplication {
        #[method(orderFrontColorPanel:)]
        pub unsafe fn orderFrontColorPanel(&self, sender: Option<&AnyObject>);
    }
);

extern_protocol!(
    pub unsafe trait NSColorChanging: NSObjectProtocol {
        #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
        #[method(changeColor:)]
        unsafe fn changeColor(&self, sender: Option<&NSColorPanel>);
    }

    unsafe impl ProtocolType for dyn NSColorChanging {}
);

extern "C" {
    pub static NSColorPanelColorDidChangeNotification: &'static NSNotificationName;
}

pub static NSNoModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::None.0);

pub static NSGrayModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Gray.0);

pub static NSRGBModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::RGB.0);

pub static NSCMYKModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::CMYK.0);

pub static NSHSBModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::HSB.0);

pub static NSCustomPaletteModeColorPanel: NSColorPanelMode =
    NSColorPanelMode(NSColorPanelMode::CustomPalette.0);

pub static NSColorListModeColorPanel: NSColorPanelMode =
    NSColorPanelMode(NSColorPanelMode::ColorList.0);

pub static NSWheelModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Wheel.0);

pub static NSCrayonModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Crayon.0);
