//! 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 "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxwillpopupnotification?language=objc)
    pub static NSComboBoxWillPopUpNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxwilldismissnotification?language=objc)
    pub static NSComboBoxWillDismissNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxselectiondidchangenotification?language=objc)
    pub static NSComboBoxSelectionDidChangeNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxselectionischangingnotification?language=objc)
    pub static NSComboBoxSelectionIsChangingNotification: &'static NSNotificationName;
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxdatasource?language=objc)
    pub unsafe trait NSComboBoxDataSource: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSTextField",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(numberOfItemsInComboBox:))]
        #[unsafe(method_family = none)]
        unsafe fn numberOfItemsInComboBox(&self, combo_box: &NSComboBox) -> NSInteger;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSTextField",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(comboBox:objectValueForItemAtIndex:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBox_objectValueForItemAtIndex(
            &self,
            combo_box: &NSComboBox,
            index: NSInteger,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSTextField",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(comboBox:indexOfItemWithStringValue:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBox_indexOfItemWithStringValue(
            &self,
            combo_box: &NSComboBox,
            string: &NSString,
        ) -> NSUInteger;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSTextField",
            feature = "NSView"
        ))]
        #[optional]
        #[unsafe(method(comboBox:completedString:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBox_completedString(
            &self,
            combo_box: &NSComboBox,
            string: &NSString,
        ) -> Option<Retained<NSString>>;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscomboboxdelegate?language=objc)
    #[cfg(all(feature = "NSControl", feature = "NSTextField"))]
    pub unsafe trait NSComboBoxDelegate: NSTextFieldDelegate + MainThreadOnly {
        #[optional]
        #[unsafe(method(comboBoxWillPopUp:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBoxWillPopUp(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(comboBoxWillDismiss:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBoxWillDismiss(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(comboBoxSelectionDidChange:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBoxSelectionDidChange(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(comboBoxSelectionIsChanging:))]
        #[unsafe(method_family = none)]
        unsafe fn comboBoxSelectionIsChanging(&self, notification: &NSNotification);
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscombobox?language=objc)
    #[unsafe(super(NSTextField, NSControl, NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "NSControl",
        feature = "NSResponder",
        feature = "NSTextField",
        feature = "NSView"
    ))]
    pub struct NSComboBox;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSComboBox {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSComboBox {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityNavigableStaticText for NSComboBox {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityStaticText for NSComboBox {}
);

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSComboBox {}
);

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSCoding for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSDragging",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextContent",
    feature = "NSTextField",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSTextContent for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSUserInterfaceValidation",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceValidations for NSComboBox {}
);

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
impl NSComboBox {
    extern_methods!(
        #[unsafe(method(hasVerticalScroller))]
        #[unsafe(method_family = none)]
        pub unsafe fn hasVerticalScroller(&self) -> bool;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSComboBoxDelegate>>>;

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

        #[unsafe(method(dataSource))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataSource(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSComboBoxDataSource>>>;

        /// Setter for [`dataSource`][Self::dataSource].
        #[unsafe(method(setDataSource:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDataSource(
            &self,
            data_source: Option<&ProtocolObject<dyn NSComboBoxDataSource>>,
        );

        #[unsafe(method(addItemWithObjectValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addItemWithObjectValue(&self, object: &AnyObject);

        #[unsafe(method(addItemsWithObjectValues:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addItemsWithObjectValues(&self, objects: &NSArray);

        #[unsafe(method(insertItemWithObjectValue:atIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn insertItemWithObjectValue_atIndex(
            &self,
            object: &AnyObject,
            index: NSInteger,
        );

        #[unsafe(method(removeItemWithObjectValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeItemWithObjectValue(&self, object: &AnyObject);

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

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

        #[unsafe(method(selectItemWithObjectValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn selectItemWithObjectValue(&self, object: Option<&AnyObject>);

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

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

        #[unsafe(method(indexOfItemWithObjectValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexOfItemWithObjectValue(&self, object: &AnyObject) -> NSInteger;

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

/// Methods declared on superclass `NSControl`.
#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
impl NSComboBox {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSTextField",
    feature = "NSView"
))]
impl NSComboBox {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

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