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/nslevelindicatorplaceholdervisibility?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLevelIndicatorPlaceholderVisibility(pub NSInteger);
impl NSLevelIndicatorPlaceholderVisibility {
    #[doc(alias = "NSLevelIndicatorPlaceholderVisibilityAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "NSLevelIndicatorPlaceholderVisibilityAlways")]
    pub const Always: Self = Self(1);
    #[doc(alias = "NSLevelIndicatorPlaceholderVisibilityWhileEditing")]
    pub const WhileEditing: Self = Self(2);
}

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

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

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

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

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

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

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

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

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

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

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

#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSLevelIndicator {
    extern_methods!(
        #[cfg(feature = "NSLevelIndicatorCell")]
        #[unsafe(method(levelIndicatorStyle))]
        #[unsafe(method_family = none)]
        pub fn levelIndicatorStyle(&self) -> NSLevelIndicatorStyle;

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

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

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

        #[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(tickMarkValueAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;

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

        #[cfg(feature = "NSColor")]
        /// Sets the fill color used by Continuous and Discrete Capacity indicators when drawing the "normal" state, and by the Rating indicator when drawing stars. The default value is a system-defined color which may vary between level indicator styles and OS releases.
        #[unsafe(method(fillColor))]
        #[unsafe(method_family = none)]
        pub fn fillColor(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        /// Setter for [`fillColor`][Self::fillColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFillColor:))]
        #[unsafe(method_family = none)]
        pub fn setFillColor(&self, fill_color: Option<&NSColor>);

        #[cfg(feature = "NSColor")]
        /// Sets the fill color used by Continuous and Discrete Capacity indicators when drawing values above the "warning" threshold. The default value is a system-defined color which may vary between level indicator styles and OS releases.
        #[unsafe(method(warningFillColor))]
        #[unsafe(method_family = none)]
        pub fn warningFillColor(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        /// Setter for [`warningFillColor`][Self::warningFillColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setWarningFillColor:))]
        #[unsafe(method_family = none)]
        pub fn setWarningFillColor(&self, warning_fill_color: Option<&NSColor>);

        #[cfg(feature = "NSColor")]
        /// Sets the fill color used by Continuous and Discrete Capacity indicators when drawing values above the "critical" threshold. The default value is a system-defined color which may vary between level indicator styles and OS releases.
        #[unsafe(method(criticalFillColor))]
        #[unsafe(method_family = none)]
        pub fn criticalFillColor(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        /// Setter for [`criticalFillColor`][Self::criticalFillColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCriticalFillColor:))]
        #[unsafe(method_family = none)]
        pub fn setCriticalFillColor(&self, critical_fill_color: Option<&NSColor>);

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

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

        /// For a Rating-style indicator, sets the conditions under which Rating placeholders are displayed. This property currently has no effect for other indicator styles. The default value is
        /// `NSLevelIndicatorPlaceholderVisibilityAutomatic.`
        #[unsafe(method(placeholderVisibility))]
        #[unsafe(method_family = none)]
        pub fn placeholderVisibility(&self) -> NSLevelIndicatorPlaceholderVisibility;

        /// Setter for [`placeholderVisibility`][Self::placeholderVisibility].
        #[unsafe(method(setPlaceholderVisibility:))]
        #[unsafe(method_family = none)]
        pub fn setPlaceholderVisibility(
            &self,
            placeholder_visibility: NSLevelIndicatorPlaceholderVisibility,
        );

        #[cfg(feature = "NSImage")]
        /// If non-nil, sets the image used by the Rating indicator style in place of the default star image. The default value is nil.
        #[unsafe(method(ratingImage))]
        #[unsafe(method_family = none)]
        pub fn ratingImage(&self) -> Option<Retained<NSImage>>;

        #[cfg(feature = "NSImage")]
        /// Setter for [`ratingImage`][Self::ratingImage].
        #[unsafe(method(setRatingImage:))]
        #[unsafe(method_family = none)]
        pub fn setRatingImage(&self, rating_image: Option<&NSImage>);

        #[cfg(feature = "NSImage")]
        /// If non-nil, sets the image used by the Rating indicator style in place of the default faded placeholder image. The default value is nil.
        ///
        /// If the custom placeholder is a template image, its fill opacity can be adjusted by modifying the opacity of the template image.
        ///
        /// If both a ratingImage and ratingPlaceholderImage are set, each rating position is sized such that either image will fit without scaling (i.e. sized to the maximum width and height of both images).
        #[unsafe(method(ratingPlaceholderImage))]
        #[unsafe(method_family = none)]
        pub fn ratingPlaceholderImage(&self) -> Option<Retained<NSImage>>;

        #[cfg(feature = "NSImage")]
        /// Setter for [`ratingPlaceholderImage`][Self::ratingPlaceholderImage].
        #[unsafe(method(setRatingPlaceholderImage:))]
        #[unsafe(method_family = none)]
        pub fn setRatingPlaceholderImage(&self, rating_placeholder_image: Option<&NSImage>);
    );
}

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