//! 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/uikit/uibaritem?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIBarItem;
);

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

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

#[cfg(feature = "UIAppearance")]
extern_conformance!(
    unsafe impl UIAppearance for UIBarItem {}
);

impl UIBarItem {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> 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(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(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Option<Retained<NSString>>;

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

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

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

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

        #[cfg(feature = "UIImage")]
        /// Setter for [`landscapeImagePhone`][Self::landscapeImagePhone].
        #[unsafe(method(setLandscapeImagePhone:))]
        #[unsafe(method_family = none)]
        pub fn setLandscapeImagePhone(&self, landscape_image_phone: Option<&UIImage>);

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

        #[cfg(feature = "UIImage")]
        /// Setter for [`largeContentSizeImage`][Self::largeContentSizeImage].
        #[unsafe(method(setLargeContentSizeImage:))]
        #[unsafe(method_family = none)]
        pub fn setLargeContentSizeImage(&self, large_content_size_image: Option<&UIImage>);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(imageInsets))]
        #[unsafe(method_family = none)]
        pub fn imageInsets(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`imageInsets`][Self::imageInsets].
        #[unsafe(method(setImageInsets:))]
        #[unsafe(method_family = none)]
        pub fn setImageInsets(&self, image_insets: UIEdgeInsets);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(landscapeImagePhoneInsets))]
        #[unsafe(method_family = none)]
        pub fn landscapeImagePhoneInsets(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`landscapeImagePhoneInsets`][Self::landscapeImagePhoneInsets].
        #[unsafe(method(setLandscapeImagePhoneInsets:))]
        #[unsafe(method_family = none)]
        pub fn setLandscapeImagePhoneInsets(&self, landscape_image_phone_insets: UIEdgeInsets);

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        #[unsafe(method(largeContentSizeImageInsets))]
        #[unsafe(method_family = none)]
        pub fn largeContentSizeImageInsets(&self) -> UIEdgeInsets;

        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
        /// Setter for [`largeContentSizeImageInsets`][Self::largeContentSizeImageInsets].
        #[unsafe(method(setLargeContentSizeImageInsets:))]
        #[unsafe(method_family = none)]
        pub fn setLargeContentSizeImageInsets(&self, large_content_size_image_insets: UIEdgeInsets);

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

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

        #[cfg(feature = "UIControl")]
        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(setTitleTextAttributes:forState:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTitleTextAttributes_forState(
            &self,
            attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
            state: UIControlState,
        );

        #[cfg(feature = "UIControl")]
        #[unsafe(method(titleTextAttributesForState:))]
        #[unsafe(method_family = none)]
        pub fn titleTextAttributesForState(
            &self,
            state: UIControlState,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
    );
}

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