//! 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/nscolorpickertouchbaritem?language=objc)
    #[unsafe(super(NSTouchBarItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSTouchBarItem")]
    pub struct NSColorPickerTouchBarItem;
);

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

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

#[cfg(feature = "NSTouchBarItem")]
impl NSColorPickerTouchBarItem {
    extern_methods!(
        /// Creates a bar item containing a button with the standard color picker icon that invokes the color picker.
        #[unsafe(method(colorPickerWithIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn colorPickerWithIdentifier(
            identifier: &NSTouchBarItemIdentifier,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        /// Creates a bar item containing a button with the standard text color picker icon that invokes the color picker. Should be used when the item is used for picking text colors.
        #[unsafe(method(textColorPickerWithIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn textColorPickerWithIdentifier(
            identifier: &NSTouchBarItemIdentifier,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        /// Creates a bar item containing a button with the standard stroke color picker icon that invokes the color picker. Should be used when the item is used for picking stroke colors.
        #[unsafe(method(strokeColorPickerWithIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn strokeColorPickerWithIdentifier(
            identifier: &NSTouchBarItemIdentifier,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[unsafe(method(colorPickerWithIdentifier:buttonImage:))]
        #[unsafe(method_family = none)]
        pub fn colorPickerWithIdentifier_buttonImage(
            identifier: &NSTouchBarItemIdentifier,
            image: &NSImage,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

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

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

        /// Whether or not the picker should allow picking a color with non-1.0 alpha. Defaults to `!NSColor.ignoresAlpha`.
        #[unsafe(method(showsAlpha))]
        #[unsafe(method_family = none)]
        pub fn showsAlpha(&self) -> bool;

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

        #[cfg(feature = "NSColorSpace")]
        /// Controls the color spaces that the receiver is able to produce. If a color outside of the allowed spaces are displayed or selected, it will first be converted to the first color space in the array. `nil` signifies any color space is allowed. Empty array is an invalid value and will raise an exception if set. Defaults to `nil`.
        #[unsafe(method(allowedColorSpaces))]
        #[unsafe(method_family = none)]
        pub fn allowedColorSpaces(&self) -> Option<Retained<NSArray<NSColorSpace>>>;

        #[cfg(feature = "NSColorSpace")]
        /// Setter for [`allowedColorSpaces`][Self::allowedColorSpaces].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAllowedColorSpaces:))]
        #[unsafe(method_family = none)]
        pub fn setAllowedColorSpaces(&self, allowed_color_spaces: Option<&NSArray<NSColorSpace>>);

        #[cfg(feature = "NSColorList")]
        /// The color list displayed in the list color picker. Defaults to the standard system color list. Setting a custom color list will disable the additional tints/shades that appear on long-press.
        #[unsafe(method(colorList))]
        #[unsafe(method_family = none)]
        pub fn colorList(&self) -> Option<Retained<NSColorList>>;

        #[cfg(feature = "NSColorList")]
        /// Setter for [`colorList`][Self::colorList].
        ///
        /// # Safety
        ///
        /// `color_list` might not allow `None`.
        #[unsafe(method(setColorList:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setColorList(&self, color_list: Option<&NSColorList>);

        /// The localized string labelling this item during user customization. The default value is the localized string of "Color Picker".
        #[unsafe(method(customizationLabel))]
        #[unsafe(method_family = none)]
        pub fn customizationLabel(&self) -> Retained<NSString>;

        /// Setter for [`customizationLabel`][Self::customizationLabel].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCustomizationLabel:))]
        #[unsafe(method_family = none)]
        pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);

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

        /// Setter for [`target`][Self::target].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        ///
        /// # Safety
        ///
        /// `target` should be of the correct type.
        #[unsafe(method(setTarget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);

        #[unsafe(method(action))]
        #[unsafe(method_family = none)]
        pub fn action(&self) -> Option<Sel>;

        /// Setter for [`action`][Self::action].
        ///
        /// # Safety
        ///
        /// `action` must be a valid selector.
        #[unsafe(method(setAction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAction(&self, action: Option<Sel>);

        /// Enables or disabled the color picker. If it is currently being shown in a popover, it will be dismissed.
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub fn isEnabled(&self) -> bool;

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

/// Methods declared on superclass `NSTouchBarItem`.
#[cfg(feature = "NSTouchBarItem")]
impl NSColorPickerTouchBarItem {
    extern_methods!(
        #[unsafe(method(initWithIdentifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithIdentifier(
            this: Allocated<Self>,
            identifier: &NSTouchBarItemIdentifier,
        ) -> 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>>;

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

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