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

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

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

#[cfg(feature = "NSTouchBarItem")]
impl NSPopoverTouchBarItem {
    extern_methods!(
        #[cfg(feature = "NSTouchBar")]
        #[unsafe(method(popoverTouchBar))]
        #[unsafe(method_family = none)]
        pub fn popoverTouchBar(&self) -> Retained<NSTouchBar>;

        #[cfg(feature = "NSTouchBar")]
        /// Setter for [`popoverTouchBar`][Self::popoverTouchBar].
        #[unsafe(method(setPopoverTouchBar:))]
        #[unsafe(method_family = none)]
        pub fn setPopoverTouchBar(&self, popover_touch_bar: &NSTouchBar);

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

        /// Setter for [`customizationLabel`][Self::customizationLabel].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCustomizationLabel:))]
        #[unsafe(method_family = none)]
        pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(collapsedRepresentation))]
        #[unsafe(method_family = none)]
        pub fn collapsedRepresentation(&self) -> Retained<NSView>;

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        /// Setter for [`collapsedRepresentation`][Self::collapsedRepresentation].
        #[unsafe(method(setCollapsedRepresentation:))]
        #[unsafe(method_family = none)]
        pub fn setCollapsedRepresentation(&self, collapsed_representation: &NSView);

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

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

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

        /// Setter for [`collapsedRepresentationLabel`][Self::collapsedRepresentationLabel].
        #[unsafe(method(setCollapsedRepresentationLabel:))]
        #[unsafe(method_family = none)]
        pub fn setCollapsedRepresentationLabel(&self, collapsed_representation_label: &NSString);

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

        #[cfg(feature = "NSTouchBar")]
        /// Setter for [`pressAndHoldTouchBar`][Self::pressAndHoldTouchBar].
        #[unsafe(method(setPressAndHoldTouchBar:))]
        #[unsafe(method_family = none)]
        pub fn setPressAndHoldTouchBar(&self, press_and_hold_touch_bar: Option<&NSTouchBar>);

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

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

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(showPopover:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showPopover(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(dismissPopover:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dismissPopover(&self, sender: Option<&AnyObject>);

        #[cfg(feature = "NSGestureRecognizer")]
        #[unsafe(method(makeStandardActivatePopoverGestureRecognizer))]
        #[unsafe(method_family = none)]
        pub fn makeStandardActivatePopoverGestureRecognizer(&self)
            -> Retained<NSGestureRecognizer>;
    );
}

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