//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorywidth?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
#[cfg(feature = "objc2-core-foundation")]
pub type NSSliderAccessoryWidth = CGFloat;

extern "C" {
    /// The default width for slider accessories.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorywidthdefault?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static NSSliderAccessoryWidthDefault: NSSliderAccessoryWidth;
}

extern "C" {
    /// The standard "wide" width for slider accessories.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorywidthwide?language=objc)
    #[cfg(feature = "objc2-core-foundation")]
    pub static NSSliderAccessoryWidthWide: NSSliderAccessoryWidth;
}

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

#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCoding for NSSliderTouchBarItem {}

#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSObjectProtocol for NSSliderTouchBarItem {}

#[cfg(feature = "NSTouchBarItem")]
impl NSSliderTouchBarItem {
    extern_methods!(
        #[cfg(all(
            feature = "NSResponder",
            feature = "NSUserInterfaceCompression",
            feature = "NSView"
        ))]
        #[unsafe(method(view))]
        #[unsafe(method_family = none)]
        pub unsafe fn view(&self) -> Retained<NSView>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSSlider",
            feature = "NSView"
        ))]
        /// The slider displayed by the bar item. It is automatically created, but can be set to a custom subclass. doubleValue, minValue, maxValue, etc can all be read and set through the slider.
        #[unsafe(method(slider))]
        #[unsafe(method_family = none)]
        pub unsafe fn slider(&self) -> Retained<NSSlider>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSSlider",
            feature = "NSView"
        ))]
        /// Setter for [`slider`][Self::slider].
        #[unsafe(method(setSlider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSlider(&self, slider: &NSSlider);

        /// The double value of the control
        #[unsafe(method(doubleValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn doubleValue(&self) -> c_double;

        /// Setter for [`doubleValue`][Self::doubleValue].
        #[unsafe(method(setDoubleValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDoubleValue(&self, double_value: c_double);

        #[cfg(feature = "objc2-core-foundation")]
        /// The width boundaries of the slider track of this item.
        /// The system defines the default minimum. The maximum defaults to MAXFLOAT
        #[unsafe(method(minimumSliderWidth))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumSliderWidth(&self) -> CGFloat;

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(maximumSliderWidth))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumSliderWidth(&self) -> CGFloat;

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

        /// The text label displayed along with the slider. If set to nil, the label will not have space reserved in the item.
        #[unsafe(method(label))]
        #[unsafe(method_family = none)]
        pub unsafe fn label(&self) -> Option<Retained<NSString>>;

        /// Setter for [`label`][Self::label].
        #[unsafe(method(setLabel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLabel(&self, label: Option<&NSString>);

        #[cfg(feature = "NSSliderAccessory")]
        /// The accessory that appears on the end of the slider with the minimum value
        #[unsafe(method(minimumValueAccessory))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;

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

        #[cfg(feature = "NSSliderAccessory")]
        /// The accessory that appears on the end of the slider with the maximum value
        #[unsafe(method(maximumValueAccessory))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;

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

        #[cfg(feature = "objc2-core-foundation")]
        /// The width of the value accessories. Defaults to `.default`, but can be set to `.wide` or a custom value.
        #[unsafe(method(valueAccessoryWidth))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueAccessoryWidth(&self) -> NSSliderAccessoryWidth;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`valueAccessoryWidth`][Self::valueAccessoryWidth].
        #[unsafe(method(setValueAccessoryWidth:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValueAccessoryWidth(&self, value_accessory_width: NSSliderAccessoryWidth);

        /// The target of the item, notified when the slider or accessories receive user interaction.
        #[unsafe(method(target))]
        #[unsafe(method_family = none)]
        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;

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

        /// The action of the item, called when the slider or accessories receive user interaction.
        #[unsafe(method(action))]
        #[unsafe(method_family = none)]
        pub unsafe fn action(&self) -> Option<Sel>;

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

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

        /// Setter for [`customizationLabel`][Self::customizationLabel].
        #[unsafe(method(setCustomizationLabel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
    );
}

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

        #[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 NSSliderTouchBarItem {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
