objc2-app-kit 0.3.2

Bindings to the AppKit 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::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslevelindicatorstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLevelIndicatorStyle(pub NSUInteger);
impl NSLevelIndicatorStyle {
    #[doc(alias = "NSLevelIndicatorStyleRelevancy")]
    pub const Relevancy: Self = Self(0);
    #[doc(alias = "NSLevelIndicatorStyleContinuousCapacity")]
    pub const ContinuousCapacity: Self = Self(1);
    #[doc(alias = "NSLevelIndicatorStyleDiscreteCapacity")]
    pub const DiscreteCapacity: Self = Self(2);
    #[doc(alias = "NSLevelIndicatorStyleRating")]
    pub const Rating: Self = Self(3);
}

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

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

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

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSLevelIndicatorCell {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSLevelIndicatorCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSCoding for NSLevelIndicatorCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSCopying for NSLevelIndicatorCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl CopyingHelper for NSLevelIndicatorCell {
    type Result = Self;
}

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSLevelIndicatorCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSLevelIndicatorCell {}
);

#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSLevelIndicatorCell {
    extern_methods!(
        #[unsafe(method(initWithLevelIndicatorStyle:))]
        #[unsafe(method_family = init)]
        pub fn initWithLevelIndicatorStyle(
            this: Allocated<Self>,
            level_indicator_style: NSLevelIndicatorStyle,
        ) -> Retained<Self>;

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

        /// Setter for [`levelIndicatorStyle`][Self::levelIndicatorStyle].
        #[unsafe(method(setLevelIndicatorStyle:))]
        #[unsafe(method_family = none)]
        pub fn setLevelIndicatorStyle(&self, level_indicator_style: NSLevelIndicatorStyle);

        #[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(warningValue))]
        #[unsafe(method_family = none)]
        pub fn warningValue(&self) -> c_double;

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

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

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

        #[cfg(feature = "NSSliderCell")]
        #[unsafe(method(tickMarkPosition))]
        #[unsafe(method_family = none)]
        pub fn tickMarkPosition(&self) -> NSTickMarkPosition;

        #[cfg(feature = "NSSliderCell")]
        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
        #[unsafe(method(setTickMarkPosition:))]
        #[unsafe(method_family = none)]
        pub fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);

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

        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
        #[unsafe(method(setNumberOfTickMarks:))]
        #[unsafe(method_family = none)]
        pub fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);

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

        /// Setter for [`numberOfMajorTickMarks`][Self::numberOfMajorTickMarks].
        #[unsafe(method(setNumberOfMajorTickMarks:))]
        #[unsafe(method_family = none)]
        pub fn setNumberOfMajorTickMarks(&self, number_of_major_tick_marks: NSInteger);

        #[unsafe(method(rectOfTickMarkAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;

        #[unsafe(method(tickMarkValueAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
    );
}

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

        #[unsafe(method(initTextCell:))]
        #[unsafe(method_family = init)]
        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[unsafe(method(initImageCell:))]
        #[unsafe(method_family = init)]
        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> 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>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSLevelIndicatorCell {
    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/nsrelevancylevelindicatorstyle?language=objc)
#[deprecated]
pub static NSRelevancyLevelIndicatorStyle: NSLevelIndicatorStyle =
    NSLevelIndicatorStyle(NSLevelIndicatorStyle::Relevancy.0);

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontinuouscapacitylevelindicatorstyle?language=objc)
#[deprecated]
pub static NSContinuousCapacityLevelIndicatorStyle: NSLevelIndicatorStyle =
    NSLevelIndicatorStyle(NSLevelIndicatorStyle::ContinuousCapacity.0);

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdiscretecapacitylevelindicatorstyle?language=objc)
#[deprecated]
pub static NSDiscreteCapacityLevelIndicatorStyle: NSLevelIndicatorStyle =
    NSLevelIndicatorStyle(NSLevelIndicatorStyle::DiscreteCapacity.0);

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsratinglevelindicatorstyle?language=objc)
#[deprecated]
pub static NSRatingLevelIndicatorStyle: NSLevelIndicatorStyle =
    NSLevelIndicatorStyle(NSLevelIndicatorStyle::Rating.0);