//! 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/nssharingservicepickertouchbaritem?language=objc)
    #[unsafe(super(NSTouchBarItem, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSTouchBarItem")]
    pub struct NSSharingServicePickerTouchBarItem;
);

#[cfg(feature = "NSTouchBarItem")]
extern_conformance!(
    unsafe impl NSCoding for NSSharingServicePickerTouchBarItem {}
);

#[cfg(feature = "NSTouchBarItem")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSSharingServicePickerTouchBarItem {}
);

#[cfg(feature = "NSTouchBarItem")]
impl NSSharingServicePickerTouchBarItem {
    extern_methods!(
        #[cfg(feature = "NSSharingService")]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSSharingServicePickerTouchBarItemDelegate>>>;

        #[cfg(feature = "NSSharingService")]
        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSSharingServicePickerTouchBarItemDelegate>>,
        );

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

        #[unsafe(method(buttonTitle))]
        #[unsafe(method_family = none)]
        pub fn buttonTitle(&self) -> Retained<NSString>;

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

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

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

/// Methods declared on superclass `NSTouchBarItem`.
#[cfg(feature = "NSTouchBarItem")]
impl NSSharingServicePickerTouchBarItem {
    extern_methods!(
        #[unsafe(method(initWithIdentifier:))]
        #[unsafe(method_family = init)]
        pub fn initWithIdentifier(
            this: Allocated<Self>,
            identifier: &NSTouchBarItemIdentifier,
        ) -> 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(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSTouchBarItem")]
impl NSSharingServicePickerTouchBarItem {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssharingservicepickertouchbaritemdelegate?language=objc)
    #[cfg(feature = "NSSharingService")]
    pub unsafe trait NSSharingServicePickerTouchBarItemDelegate:
        NSSharingServicePickerDelegate + MainThreadOnly
    {
        #[cfg(feature = "NSTouchBarItem")]
        #[unsafe(method(itemsForSharingServicePickerTouchBarItem:))]
        #[unsafe(method_family = none)]
        fn itemsForSharingServicePickerTouchBarItem(
            &self,
            picker_touch_bar_item: &NSSharingServicePickerTouchBarItem,
        ) -> Retained<NSArray>;
    }
);
