//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontrollerdelegate?language=objc)
    pub unsafe trait UIColorPickerViewControllerDelegate:
        NSObjectProtocol + MainThreadOnly
    {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        /// Called when the `selectedColor` changes.
        #[deprecated]
        #[optional]
        #[unsafe(method(colorPickerViewControllerDidSelectColor:))]
        #[unsafe(method_family = none)]
        fn colorPickerViewControllerDidSelectColor(
            &self,
            view_controller: &UIColorPickerViewController,
        );

        #[cfg(all(
            feature = "UIColor",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        /// Called when the selected color changes.
        ///
        ///
        /// Parameter `viewController`: This color picker.
        ///
        /// Parameter `color`: The new selected color
        ///
        /// Parameter `continuously`: YES, if this update is part of a continuous user interaction (e.g. dragging through the spectrum). It's recommended
        /// to show these updates in your UI but to not include them in any undo operations.
        #[optional]
        #[unsafe(method(colorPickerViewController:didSelectColor:continuously:))]
        #[unsafe(method_family = none)]
        fn colorPickerViewController_didSelectColor_continuously(
            &self,
            view_controller: &UIColorPickerViewController,
            color: &UIColor,
            continuously: bool,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        /// In presentations (except popovers) the color picker shows a close button. If the close button is tapped,
        /// the view controller is dismissed and `colorPickerViewControllerDidFinish:` is called. Can be used to
        /// animate alongside the dismissal.
        #[optional]
        #[unsafe(method(colorPickerViewControllerDidFinish:))]
        #[unsafe(method_family = none)]
        fn colorPickerViewControllerDidFinish(&self, view_controller: &UIColorPickerViewController);
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uicolorpickerviewcontroller?language=objc)
    #[unsafe(super(UIViewController, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    pub struct UIColorPickerViewController;
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl NSCoding for UIColorPickerViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIColorPickerViewController {}
);

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIResponder",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIColorPickerViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl UIContentContainer for UIColorPickerViewController {}
);

#[cfg(all(
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIColorPickerViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIColorPickerViewController {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIColorPickerViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIColorPickerViewController {
    extern_methods!(
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIColorPickerViewControllerDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UIColorPickerViewControllerDelegate>>,
        );

        #[cfg(feature = "UIColor")]
        /// Sets the selected color on the color picker and is updated when the user changes the selection.
        /// Does support KVO.
        #[unsafe(method(selectedColor))]
        #[unsafe(method_family = none)]
        pub fn selectedColor(&self) -> Retained<UIColor>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`selectedColor`][Self::selectedColor].
        #[unsafe(method(setSelectedColor:))]
        #[unsafe(method_family = none)]
        pub fn setSelectedColor(&self, selected_color: &UIColor);

        /// Controls whether the color picker shows an alpha slider or not.
        ///
        /// If set to `NO` users are only able to pick fully opaque colors.
        #[unsafe(method(supportsAlpha))]
        #[unsafe(method_family = none)]
        pub fn supportsAlpha(&self) -> bool;

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

        /// If set to `NO` the eyedropper functionality is not supported for this color picker.
        #[unsafe(method(supportsEyedropper))]
        #[unsafe(method_family = none)]
        pub fn supportsEyedropper(&self) -> bool;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// The maximum exposure to apply to a color when returned by the color picker.
        #[unsafe(method(maximumLinearExposure))]
        #[unsafe(method_family = none)]
        pub fn maximumLinearExposure(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`maximumLinearExposure`][Self::maximumLinearExposure].
        #[unsafe(method(setMaximumLinearExposure:))]
        #[unsafe(method_family = none)]
        pub fn setMaximumLinearExposure(&self, maximum_linear_exposure: CGFloat);

        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

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

/// Methods declared on superclass `UIViewController`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIColorPickerViewController {
    extern_methods!(
        /// # 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>>;
    );
}

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