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" {
pub static NSComboBoxWillPopUpNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSComboBoxWillDismissNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSComboBoxSelectionDidChangeNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSComboBoxSelectionIsChangingNotification: &'static NSNotificationName;
}
extern_protocol!(
pub unsafe trait NSComboBoxDataSource: NSObjectProtocol + MainThreadOnly {
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
#[optional]
#[unsafe(method(numberOfItemsInComboBox:))]
#[unsafe(method_family = none)]
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)]
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)]
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)]
fn comboBox_completedString(
&self,
combo_box: &NSComboBox,
string: &NSString,
) -> Option<Retained<NSString>>;
}
);
extern_protocol!(
#[cfg(all(feature = "NSControl", feature = "NSTextField"))]
pub unsafe trait NSComboBoxDelegate: NSTextFieldDelegate + MainThreadOnly {
#[optional]
#[unsafe(method(comboBoxWillPopUp:))]
#[unsafe(method_family = none)]
fn comboBoxWillPopUp(&self, notification: &NSNotification);
#[optional]
#[unsafe(method(comboBoxWillDismiss:))]
#[unsafe(method_family = none)]
fn comboBoxWillDismiss(&self, notification: &NSNotification);
#[optional]
#[unsafe(method(comboBoxSelectionDidChange:))]
#[unsafe(method_family = none)]
fn comboBoxSelectionDidChange(&self, notification: &NSNotification);
#[optional]
#[unsafe(method(comboBoxSelectionIsChanging:))]
#[unsafe(method_family = none)]
fn comboBoxSelectionIsChanging(&self, notification: &NSNotification);
}
);
extern_class!(
#[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 fn hasVerticalScroller(&self) -> bool;
#[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;
#[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")]
#[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;
#[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;
#[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;
#[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;
#[unsafe(method(setCompletes:))]
#[unsafe(method_family = none)]
pub fn setCompletes(&self, completes: bool);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSComboBoxDelegate>>>;
#[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>>>;
#[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 fn removeItemAtIndex(&self, index: NSInteger);
#[unsafe(method(removeAllItems))]
#[unsafe(method_family = none)]
pub 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 fn itemObjectValueAtIndex(&self, index: NSInteger) -> Retained<AnyObject>;
#[unsafe(method(objectValueOfSelectedItem))]
#[unsafe(method_family = none)]
pub 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 fn objectValues(&self) -> Retained<NSArray>;
);
}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSComboBox {
extern_methods!(
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub 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>>;
);
}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSComboBox {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
impl NSComboBox {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}