//! 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/nssearchfieldrecentstitlemenuitemtag?language=objc)
pub static NSSearchFieldRecentsTitleMenuItemTag: NSInteger = 1000;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfieldrecentsmenuitemtag?language=objc)
pub static NSSearchFieldRecentsMenuItemTag: NSInteger = 1001;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfieldclearrecentsmenuitemtag?language=objc)
pub static NSSearchFieldClearRecentsMenuItemTag: NSInteger = 1002;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfieldnorecentsmenuitemtag?language=objc)
pub static NSSearchFieldNoRecentsMenuItemTag: NSInteger = 1003;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssearchfieldcell?language=objc)
    #[unsafe(super(NSTextFieldCell, NSActionCell, NSCell, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "NSActionCell",
        feature = "NSCell",
        feature = "NSTextFieldCell"
    ))]
    pub struct NSSearchFieldCell;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSSearchFieldCell {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSSearchFieldCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
extern_conformance!(
    unsafe impl NSCoding for NSSearchFieldCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
extern_conformance!(
    unsafe impl NSCopying for NSSearchFieldCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
unsafe impl CopyingHelper for NSSearchFieldCell {
    type Result = Self;
}

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSSearchFieldCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell",
    feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSSearchFieldCell {}
);

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
impl NSSearchFieldCell {
    extern_methods!(
        #[unsafe(method(initTextCell:))]
        #[unsafe(method_family = init)]
        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[unsafe(method(initImageCell:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initImageCell(
            this: Allocated<Self>,
            image: Option<&NSImage>,
        ) -> Retained<Self>;

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

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

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

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

        #[unsafe(method(resetSearchButtonCell))]
        #[unsafe(method_family = none)]
        pub fn resetSearchButtonCell(&self);

        #[unsafe(method(resetCancelButtonCell))]
        #[unsafe(method_family = none)]
        pub fn resetCancelButtonCell(&self);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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