//! 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::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactivityindicatorviewstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIActivityIndicatorViewStyle(pub NSInteger);
impl UIActivityIndicatorViewStyle {
    #[doc(alias = "UIActivityIndicatorViewStyleMedium")]
    pub const Medium: Self = Self(100);
    #[doc(alias = "UIActivityIndicatorViewStyleLarge")]
    pub const Large: Self = Self(101);
    #[doc(alias = "UIActivityIndicatorViewStyleWhiteLarge")]
    #[deprecated]
    pub const WhiteLarge: Self = Self(0);
    #[doc(alias = "UIActivityIndicatorViewStyleWhite")]
    #[deprecated]
    pub const White: Self = Self(1);
    #[doc(alias = "UIActivityIndicatorViewStyleGray")]
    #[deprecated]
    pub const Gray: Self = Self(2);
}

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

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

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

#[cfg(all(
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
extern_conformance!(
    unsafe impl CALayerDelegate for UIActivityIndicatorView {}
);

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

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

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

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

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UICoordinateSpace for UIActivityIndicatorView {}
);

#[cfg(all(
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
extern_conformance!(
    unsafe impl UIDynamicItem for UIActivityIndicatorView {}
);

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

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItem for UIActivityIndicatorView {}
);

#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
extern_conformance!(
    unsafe impl UIFocusItemContainer for UIActivityIndicatorView {}
);

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

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

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIActivityIndicatorView {
    extern_methods!(
        #[unsafe(method(initWithActivityIndicatorStyle:))]
        #[unsafe(method_family = init)]
        pub fn initWithActivityIndicatorStyle(
            this: Allocated<Self>,
            style: UIActivityIndicatorViewStyle,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

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

        /// Setter for [`activityIndicatorViewStyle`][Self::activityIndicatorViewStyle].
        #[unsafe(method(setActivityIndicatorViewStyle:))]
        #[unsafe(method_family = none)]
        pub fn setActivityIndicatorViewStyle(
            &self,
            activity_indicator_view_style: UIActivityIndicatorViewStyle,
        );

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

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

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

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

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

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

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

/// Methods declared on superclass `UIView`.
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIActivityIndicatorView {
    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 = "UIResponder", feature = "UIView"))]
impl UIActivityIndicatorView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
