//! 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::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessory?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSSliderAccessory;
);

extern_conformance!(
    unsafe impl NSCoding for NSSliderAccessory {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSSliderAccessory {}
);

impl NSSliderAccessory {
    extern_methods!(
        #[cfg(feature = "NSImage")]
        #[unsafe(method(accessoryWithImage:))]
        #[unsafe(method_family = none)]
        pub fn accessoryWithImage(
            image: &NSImage,
            mtm: MainThreadMarker,
        ) -> Retained<NSSliderAccessory>;

        /// The effect on interaction with the accessory. Defaults to `automaticBehavior`
        #[unsafe(method(behavior))]
        #[unsafe(method_family = none)]
        pub fn behavior(&self) -> Retained<NSSliderAccessoryBehavior>;

        /// Setter for [`behavior`][Self::behavior].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBehavior:))]
        #[unsafe(method_family = none)]
        pub fn setBehavior(&self, behavior: &NSSliderAccessoryBehavior);

        /// Whether or not the accessory is interactive and draws with an enabled appearance. Defaults to YES.
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub fn isEnabled(&self) -> bool;

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

/// Methods declared on superclass `NSObject`.
impl NSSliderAccessory {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

impl NSSliderAccessory {
    extern_methods!();
}

#[cfg(feature = "NSAccessibilityProtocols")]
extern_conformance!(
    unsafe impl NSAccessibility for NSSliderAccessory {}
);

#[cfg(feature = "NSAccessibilityProtocols")]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSSliderAccessory {}
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorybehavior?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSSliderAccessoryBehavior;
);

extern_conformance!(
    unsafe impl NSCoding for NSSliderAccessoryBehavior {}
);

extern_conformance!(
    unsafe impl NSCopying for NSSliderAccessoryBehavior {}
);

unsafe impl CopyingHelper for NSSliderAccessoryBehavior {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSSliderAccessoryBehavior {}
);

impl NSSliderAccessoryBehavior {
    extern_methods!(
        /// The behavior is automatically picked to be the system standard for the slider's current context, e.g. NSTouchBarItems have `.valueStep` behavior.
        #[unsafe(method(automaticBehavior))]
        #[unsafe(method_family = none)]
        pub fn automaticBehavior(mtm: MainThreadMarker) -> Retained<NSSliderAccessoryBehavior>;

        /// The value of the slider moves towards the associated value for the accessory with by a delta of the slider's `altIncrementValue`.
        #[unsafe(method(valueStepBehavior))]
        #[unsafe(method_family = none)]
        pub fn valueStepBehavior(mtm: MainThreadMarker) -> Retained<NSSliderAccessoryBehavior>;

        /// The value of the slider is reset to the associated value for the accessory.
        #[unsafe(method(valueResetBehavior))]
        #[unsafe(method_family = none)]
        pub fn valueResetBehavior(mtm: MainThreadMarker) -> Retained<NSSliderAccessoryBehavior>;

        /// The action is sent to the target on interaction. The optional first parameter is an NSSliderAccessory.
        ///
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `action` must be a valid selector.
        #[unsafe(method(behaviorWithTarget:action:))]
        #[unsafe(method_family = none)]
        pub unsafe fn behaviorWithTarget_action(
            target: Option<&AnyObject>,
            action: Sel,
            mtm: MainThreadMarker,
        ) -> Retained<NSSliderAccessoryBehavior>;

        #[cfg(feature = "block2")]
        /// The handler block is invoked on interaction. This variant is not codable and will assert in `-encodeWithCoder:`.
        #[unsafe(method(behaviorWithHandler:))]
        #[unsafe(method_family = none)]
        pub fn behaviorWithHandler(
            handler: &block2::DynBlock<dyn Fn(NonNull<NSSliderAccessory>)>,
            mtm: MainThreadMarker,
        ) -> Retained<NSSliderAccessoryBehavior>;

        /// Override point for custom subclasses to handle interaction.
        #[unsafe(method(handleAction:))]
        #[unsafe(method_family = none)]
        pub fn handleAction(&self, sender: &NSSliderAccessory);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSSliderAccessoryBehavior {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
