//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

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

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

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

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

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

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

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

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

#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
impl NSComboBoxCell {
    extern_methods!(
        #[unsafe(method(hasVerticalScroller))]
        #[unsafe(method_family = none)]
        pub fn hasVerticalScroller(&self) -> bool;

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

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

        /// Setter for [`intercellSpacing`][Self::intercellSpacing].
        #[unsafe(method(setIntercellSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setIntercellSpacing(&self, intercell_spacing: NSSize);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(itemHeight))]
        #[unsafe(method_family = none)]
        pub fn itemHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`itemHeight`][Self::itemHeight].
        #[unsafe(method(setItemHeight:))]
        #[unsafe(method_family = none)]
        pub fn setItemHeight(&self, item_height: CGFloat);

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

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

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

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

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

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

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

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

        #[unsafe(method(scrollItemAtIndexToTop:))]
        #[unsafe(method_family = none)]
        pub fn scrollItemAtIndexToTop(&self, index: NSInteger);

        #[unsafe(method(scrollItemAtIndexToVisible:))]
        #[unsafe(method_family = none)]
        pub fn scrollItemAtIndexToVisible(&self, index: NSInteger);

        #[unsafe(method(selectItemAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn selectItemAtIndex(&self, index: NSInteger);

        #[unsafe(method(deselectItemAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn deselectItemAtIndex(&self, index: NSInteger);

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

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

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

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

        #[unsafe(method(completedString:))]
        #[unsafe(method_family = none)]
        pub fn completedString(&self, string: &NSString) -> Option<Retained<NSString>>;

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(dataSource))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataSource(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSComboBoxCellDataSource>>>;

        /// Setter for [`dataSource`][Self::dataSource].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setDataSource:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDataSource(
            &self,
            data_source: Option<&ProtocolObject<dyn NSComboBoxCellDataSource>>,
        );

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

        /// # Safety
        ///
        /// `objects` generic should be of the correct type.
        #[unsafe(method(addItemsWithObjectValues:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addItemsWithObjectValues(&self, objects: &NSArray);

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(insertItemWithObjectValue:atIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertItemWithObjectValue_atIndex(
            &self,
            object: &AnyObject,
            index: NSInteger,
        );

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

        #[unsafe(method(removeItemAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn removeItemAtIndex(&self, index: NSInteger);

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

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

        #[unsafe(method(itemObjectValueAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn itemObjectValueAtIndex(&self, index: NSInteger) -> Retained<AnyObject>;

        #[unsafe(method(objectValueOfSelectedItem))]
        #[unsafe(method_family = none)]
        pub fn objectValueOfSelectedItem(&self) -> Option<Retained<AnyObject>>;

        /// # Safety
        ///
        /// `object` should be of the correct type.
        #[unsafe(method(indexOfItemWithObjectValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexOfItemWithObjectValue(&self, object: &AnyObject) -> NSInteger;

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

/// Methods declared on superclass `NSTextFieldCell`.
#[cfg(all(
    feature = "NSActionCell",
    feature = "NSCell",
    feature = "NSTextFieldCell"
))]
impl NSComboBoxCell {
    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>;
    );
}

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxcelldatasource?language=objc)
    pub unsafe trait NSComboBoxCellDataSource: NSObjectProtocol {
        #[cfg(all(
            feature = "NSActionCell",
            feature = "NSCell",
            feature = "NSTextFieldCell"
        ))]
        #[optional]
        #[unsafe(method(numberOfItemsInComboBoxCell:))]
        #[unsafe(method_family = none)]
        fn numberOfItemsInComboBoxCell(&self, combo_box_cell: &NSComboBoxCell) -> NSInteger;

        #[cfg(all(
            feature = "NSActionCell",
            feature = "NSCell",
            feature = "NSTextFieldCell"
        ))]
        #[optional]
        #[unsafe(method(comboBoxCell:objectValueForItemAtIndex:))]
        #[unsafe(method_family = none)]
        fn comboBoxCell_objectValueForItemAtIndex(
            &self,
            combo_box_cell: &NSComboBoxCell,
            index: NSInteger,
        ) -> Retained<AnyObject>;

        #[cfg(all(
            feature = "NSActionCell",
            feature = "NSCell",
            feature = "NSTextFieldCell"
        ))]
        #[optional]
        #[unsafe(method(comboBoxCell:indexOfItemWithStringValue:))]
        #[unsafe(method_family = none)]
        fn comboBoxCell_indexOfItemWithStringValue(
            &self,
            combo_box_cell: &NSComboBoxCell,
            string: &NSString,
        ) -> NSUInteger;

        #[cfg(all(
            feature = "NSActionCell",
            feature = "NSCell",
            feature = "NSTextFieldCell"
        ))]
        #[optional]
        #[unsafe(method(comboBoxCell:completedString:))]
        #[unsafe(method_family = none)]
        fn comboBoxCell_completedString(
            &self,
            combo_box_cell: &NSComboBoxCell,
            uncompleted_string: &NSString,
        ) -> Option<Retained<NSString>>;
    }
);
