objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! 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/uiprogressviewstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIProgressViewStyle(pub NSInteger);
impl UIProgressViewStyle {
    #[doc(alias = "UIProgressViewStyleDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "UIProgressViewStyleBar")]
    pub const Bar: Self = Self(1);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

#[cfg(all(feature = "UIResponder", feature = "UIView"))]
impl UIProgressView {
    extern_methods!(
        #[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,
        ) -> Option<Retained<Self>>;

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

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

        /// Setter for [`progressViewStyle`][Self::progressViewStyle].
        #[unsafe(method(setProgressViewStyle:))]
        #[unsafe(method_family = none)]
        pub fn setProgressViewStyle(&self, progress_view_style: UIProgressViewStyle);

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

        /// Setter for [`progress`][Self::progress].
        #[unsafe(method(setProgress:))]
        #[unsafe(method_family = none)]
        pub fn setProgress(&self, progress: c_float);

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

        #[cfg(feature = "UIColor")]
        /// Setter for [`progressTintColor`][Self::progressTintColor].
        #[unsafe(method(setProgressTintColor:))]
        #[unsafe(method_family = none)]
        pub fn setProgressTintColor(&self, progress_tint_color: Option<&UIColor>);

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

        #[cfg(feature = "UIColor")]
        /// Setter for [`trackTintColor`][Self::trackTintColor].
        #[unsafe(method(setTrackTintColor:))]
        #[unsafe(method_family = none)]
        pub fn setTrackTintColor(&self, track_tint_color: Option<&UIColor>);

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

        #[cfg(feature = "UIImage")]
        /// Setter for [`progressImage`][Self::progressImage].
        #[unsafe(method(setProgressImage:))]
        #[unsafe(method_family = none)]
        pub fn setProgressImage(&self, progress_image: Option<&UIImage>);

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

        #[cfg(feature = "UIImage")]
        /// Setter for [`trackImage`][Self::trackImage].
        #[unsafe(method(setTrackImage:))]
        #[unsafe(method_family = none)]
        pub fn setTrackImage(&self, track_image: Option<&UIImage>);

        #[unsafe(method(setProgress:animated:))]
        #[unsafe(method_family = none)]
        pub fn setProgress_animated(&self, progress: c_float, animated: bool);

        #[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>);
    );
}

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