use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPopUpArrowPosition(pub NSUInteger);
impl NSPopUpArrowPosition {
#[doc(alias = "NSPopUpNoArrow")]
pub const NoArrow: Self = Self(0);
#[doc(alias = "NSPopUpArrowAtCenter")]
pub const ArrowAtCenter: Self = Self(1);
#[doc(alias = "NSPopUpArrowAtBottom")]
pub const ArrowAtBottom: Self = Self(2);
}
unsafe impl Encode for NSPopUpArrowPosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPopUpArrowPosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSMenuItemCell, NSButtonCell, NSActionCell, NSCell, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
pub struct NSPopUpButtonCell;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
extern_conformance!(
unsafe impl NSCoding for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
extern_conformance!(
unsafe impl NSCopying for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
unsafe impl CopyingHelper for NSPopUpButtonCell {
type Result = Self;
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenu",
feature = "NSMenuItemCell"
))]
extern_conformance!(
unsafe impl NSMenuItemValidation for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell",
feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSPopUpButtonCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
impl NSPopUpButtonCell {
extern_methods!(
#[unsafe(method(initTextCell:pullsDown:))]
#[unsafe(method_family = init)]
pub fn initTextCell_pullsDown(
this: Allocated<Self>,
string_value: &NSString,
pull_down: bool,
) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSMenu")]
#[unsafe(method(menu))]
#[unsafe(method_family = none)]
pub fn menu(&self) -> Option<Retained<NSMenu>>;
#[cfg(feature = "NSMenu")]
#[unsafe(method(setMenu:))]
#[unsafe(method_family = none)]
pub fn setMenu(&self, menu: Option<&NSMenu>);
#[unsafe(method(pullsDown))]
#[unsafe(method_family = none)]
pub fn pullsDown(&self) -> bool;
#[unsafe(method(setPullsDown:))]
#[unsafe(method_family = none)]
pub fn setPullsDown(&self, pulls_down: bool);
#[unsafe(method(autoenablesItems))]
#[unsafe(method_family = none)]
pub fn autoenablesItems(&self) -> bool;
#[unsafe(method(setAutoenablesItems:))]
#[unsafe(method_family = none)]
pub fn setAutoenablesItems(&self, autoenables_items: bool);
#[unsafe(method(preferredEdge))]
#[unsafe(method_family = none)]
pub fn preferredEdge(&self) -> NSRectEdge;
#[unsafe(method(setPreferredEdge:))]
#[unsafe(method_family = none)]
pub fn setPreferredEdge(&self, preferred_edge: NSRectEdge);
#[unsafe(method(usesItemFromMenu))]
#[unsafe(method_family = none)]
pub fn usesItemFromMenu(&self) -> bool;
#[unsafe(method(setUsesItemFromMenu:))]
#[unsafe(method_family = none)]
pub fn setUsesItemFromMenu(&self, uses_item_from_menu: bool);
#[unsafe(method(altersStateOfSelectedItem))]
#[unsafe(method_family = none)]
pub fn altersStateOfSelectedItem(&self) -> bool;
#[unsafe(method(setAltersStateOfSelectedItem:))]
#[unsafe(method_family = none)]
pub fn setAltersStateOfSelectedItem(&self, alters_state_of_selected_item: bool);
#[unsafe(method(addItemWithTitle:))]
#[unsafe(method_family = none)]
pub fn addItemWithTitle(&self, title: &NSString);
#[unsafe(method(addItemsWithTitles:))]
#[unsafe(method_family = none)]
pub fn addItemsWithTitles(&self, item_titles: &NSArray<NSString>);
#[unsafe(method(insertItemWithTitle:atIndex:))]
#[unsafe(method_family = none)]
pub fn insertItemWithTitle_atIndex(&self, title: &NSString, index: NSInteger);
#[unsafe(method(removeItemWithTitle:))]
#[unsafe(method_family = none)]
pub fn removeItemWithTitle(&self, title: &NSString);
#[unsafe(method(removeItemAtIndex:))]
#[unsafe(method_family = none)]
pub fn removeItemAtIndex(&self, index: NSInteger);
#[unsafe(method(removeAllItems))]
#[unsafe(method_family = none)]
pub fn removeAllItems(&self);
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(itemArray))]
#[unsafe(method_family = none)]
pub fn itemArray(&self) -> Retained<NSArray<NSMenuItem>>;
#[unsafe(method(numberOfItems))]
#[unsafe(method_family = none)]
pub fn numberOfItems(&self) -> NSInteger;
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(indexOfItem:))]
#[unsafe(method_family = none)]
pub fn indexOfItem(&self, item: &NSMenuItem) -> NSInteger;
#[unsafe(method(indexOfItemWithTitle:))]
#[unsafe(method_family = none)]
pub fn indexOfItemWithTitle(&self, title: &NSString) -> NSInteger;
#[unsafe(method(indexOfItemWithTag:))]
#[unsafe(method_family = none)]
pub fn indexOfItemWithTag(&self, tag: NSInteger) -> NSInteger;
#[unsafe(method(indexOfItemWithRepresentedObject:))]
#[unsafe(method_family = none)]
pub unsafe fn indexOfItemWithRepresentedObject(&self, obj: Option<&AnyObject>)
-> NSInteger;
#[unsafe(method(indexOfItemWithTarget:andAction:))]
#[unsafe(method_family = none)]
pub unsafe fn indexOfItemWithTarget_andAction(
&self,
target: Option<&AnyObject>,
action_selector: Option<Sel>,
) -> NSInteger;
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(itemAtIndex:))]
#[unsafe(method_family = none)]
pub fn itemAtIndex(&self, index: NSInteger) -> Option<Retained<NSMenuItem>>;
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(itemWithTitle:))]
#[unsafe(method_family = none)]
pub fn itemWithTitle(&self, title: &NSString) -> Option<Retained<NSMenuItem>>;
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(lastItem))]
#[unsafe(method_family = none)]
pub fn lastItem(&self) -> Option<Retained<NSMenuItem>>;
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(selectItem:))]
#[unsafe(method_family = none)]
pub fn selectItem(&self, item: Option<&NSMenuItem>);
#[unsafe(method(selectItemAtIndex:))]
#[unsafe(method_family = none)]
pub fn selectItemAtIndex(&self, index: NSInteger);
#[unsafe(method(selectItemWithTitle:))]
#[unsafe(method_family = none)]
pub fn selectItemWithTitle(&self, title: &NSString);
#[unsafe(method(selectItemWithTag:))]
#[unsafe(method_family = none)]
pub fn selectItemWithTag(&self, tag: NSInteger) -> bool;
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, string: Option<&NSString>);
#[cfg(feature = "NSMenuItem")]
#[unsafe(method(selectedItem))]
#[unsafe(method_family = none)]
pub fn selectedItem(&self) -> Option<Retained<NSMenuItem>>;
#[unsafe(method(indexOfSelectedItem))]
#[unsafe(method_family = none)]
pub fn indexOfSelectedItem(&self) -> NSInteger;
#[unsafe(method(synchronizeTitleAndSelectedItem))]
#[unsafe(method_family = none)]
pub fn synchronizeTitleAndSelectedItem(&self);
#[unsafe(method(itemTitleAtIndex:))]
#[unsafe(method_family = none)]
pub fn itemTitleAtIndex(&self, index: NSInteger) -> Retained<NSString>;
#[unsafe(method(itemTitles))]
#[unsafe(method_family = none)]
pub fn itemTitles(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(titleOfSelectedItem))]
#[unsafe(method_family = none)]
pub fn titleOfSelectedItem(&self) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[unsafe(method(attachPopUpWithFrame:inView:))]
#[unsafe(method_family = none)]
pub fn attachPopUpWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
#[unsafe(method(dismissPopUp))]
#[unsafe(method_family = none)]
pub fn dismissPopUp(&self);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[unsafe(method(performClickWithFrame:inView:))]
#[unsafe(method_family = none)]
pub fn performClickWithFrame_inView(&self, frame: NSRect, control_view: &NSView);
#[unsafe(method(arrowPosition))]
#[unsafe(method_family = none)]
pub fn arrowPosition(&self) -> NSPopUpArrowPosition;
#[unsafe(method(setArrowPosition:))]
#[unsafe(method_family = none)]
pub fn setArrowPosition(&self, arrow_position: NSPopUpArrowPosition);
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
impl NSPopUpButtonCell {
extern_methods!(
#[unsafe(method(initTextCell:))]
#[unsafe(method_family = init)]
pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
impl NSPopUpButtonCell {
extern_methods!(
#[cfg(feature = "NSImage")]
#[unsafe(method(initImageCell:))]
#[unsafe(method_family = init)]
pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
impl NSPopUpButtonCell {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSMenuItemCell"
))]
impl NSPopUpButtonCell {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern "C" {
pub static NSPopUpButtonCellWillPopUpNotification: &'static NSNotificationName;
}