//! 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/nsprogressindicatorstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSProgressIndicatorStyle(pub NSUInteger);
impl NSProgressIndicatorStyle {
    #[doc(alias = "NSProgressIndicatorStyleBar")]
    pub const Bar: Self = Self(0);
    #[doc(alias = "NSProgressIndicatorStyleSpinning")]
    pub const Spinning: Self = Self(1);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSProgressIndicator {
    extern_methods!(
        #[unsafe(method(isIndeterminate))]
        #[unsafe(method_family = none)]
        pub fn isIndeterminate(&self) -> bool;

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

        #[cfg(feature = "NSCell")]
        #[unsafe(method(controlSize))]
        #[unsafe(method_family = none)]
        pub fn controlSize(&self) -> NSControlSize;

        #[cfg(feature = "NSCell")]
        /// Setter for [`controlSize`][Self::controlSize].
        #[unsafe(method(setControlSize:))]
        #[unsafe(method_family = none)]
        pub fn setControlSize(&self, control_size: NSControlSize);

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

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

        #[unsafe(method(incrementBy:))]
        #[unsafe(method_family = none)]
        pub fn incrementBy(&self, delta: c_double);

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

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

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

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

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

        /// Setter for [`observedProgress`][Self::observedProgress].
        #[unsafe(method(setObservedProgress:))]
        #[unsafe(method_family = none)]
        pub fn setObservedProgress(&self, observed_progress: Option<&NSProgress>);

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

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

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(startAnimation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startAnimation(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(stopAnimation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopAnimation(&self, sender: Option<&AnyObject>);

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

        /// Setter for [`style`][Self::style].
        #[unsafe(method(setStyle:))]
        #[unsafe(method_family = none)]
        pub fn setStyle(&self, style: NSProgressIndicatorStyle);

        #[unsafe(method(sizeToFit))]
        #[unsafe(method_family = none)]
        pub fn sizeToFit(&self);

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

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

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

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorthickness?language=objc)
// NS_ENUM
#[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSProgressIndicatorThickness(pub NSUInteger);
impl NSProgressIndicatorThickness {
    #[doc(alias = "NSProgressIndicatorPreferredThickness")]
    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
    pub const PreferredThickness: Self = Self(14);
    #[doc(alias = "NSProgressIndicatorPreferredSmallThickness")]
    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
    pub const PreferredSmallThickness: Self = Self(10);
    #[doc(alias = "NSProgressIndicatorPreferredLargeThickness")]
    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
    pub const PreferredLargeThickness: Self = Self(18);
    #[doc(alias = "NSProgressIndicatorPreferredAquaThickness")]
    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
    pub const PreferredAquaThickness: Self = Self(12);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorbarstyle?language=objc)
#[deprecated]
pub static NSProgressIndicatorBarStyle: NSProgressIndicatorStyle =
    NSProgressIndicatorStyle(NSProgressIndicatorStyle::Bar.0);

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorspinningstyle?language=objc)
#[deprecated]
pub static NSProgressIndicatorSpinningStyle: NSProgressIndicatorStyle =
    NSProgressIndicatorStyle(NSProgressIndicatorStyle::Spinning.0);

/// NSProgressIndicatorDeprecated.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSProgressIndicator {
    extern_methods!(
        #[deprecated = "The animationDelay property does nothing."]
        #[unsafe(method(animationDelay))]
        #[unsafe(method_family = none)]
        pub fn animationDelay(&self) -> NSTimeInterval;

        #[deprecated = "The animationDelay property does nothing."]
        #[unsafe(method(setAnimationDelay:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationDelay(&self, delay: NSTimeInterval);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[deprecated = "Use -startAnimation and -stopAnimation instead."]
        #[unsafe(method(animate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn animate(&self, sender: Option<&AnyObject>);

        #[deprecated = "The bezeled property is not respected on 10.15 and later"]
        #[unsafe(method(isBezeled))]
        #[unsafe(method_family = none)]
        pub fn isBezeled(&self) -> bool;

        /// Setter for [`isBezeled`][Self::isBezeled].
        #[deprecated = "The bezeled property is not respected on 10.15 and later"]
        #[unsafe(method(setBezeled:))]
        #[unsafe(method_family = none)]
        pub fn setBezeled(&self, bezeled: bool);

        #[cfg(feature = "NSCell")]
        #[deprecated = "The controlTint property is not respected on 10.15 and later"]
        #[unsafe(method(controlTint))]
        #[unsafe(method_family = none)]
        pub fn controlTint(&self) -> NSControlTint;

        #[cfg(feature = "NSCell")]
        /// Setter for [`controlTint`][Self::controlTint].
        #[deprecated = "The controlTint property is not respected on 10.15 and later"]
        #[unsafe(method(setControlTint:))]
        #[unsafe(method_family = none)]
        pub fn setControlTint(&self, control_tint: NSControlTint);
    );
}
