objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
//! 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/nsmenuitemcell?language=objc)
    #[unsafe(super(NSButtonCell, NSActionCell, NSCell, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
    pub struct NSMenuItemCell;
);

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

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

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

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

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

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

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

#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
impl NSMenuItemCell {
    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 = "NSMenuItem")]
        #[unsafe(method(menuItem))]
        #[unsafe(method_family = none)]
        pub fn menuItem(&self) -> Option<Retained<NSMenuItem>>;

        #[cfg(feature = "NSMenuItem")]
        /// Setter for [`menuItem`][Self::menuItem].
        #[unsafe(method(setMenuItem:))]
        #[unsafe(method_family = none)]
        pub fn setMenuItem(&self, menu_item: Option<&NSMenuItem>);

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

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

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

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

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

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

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

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

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

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

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

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

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawSeparatorItemWithFrame:inView:))]
        #[unsafe(method_family = none)]
        pub fn drawSeparatorItemWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawStateImageWithFrame:inView:))]
        #[unsafe(method_family = none)]
        pub fn drawStateImageWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawImageWithFrame:inView:))]
        #[unsafe(method_family = none)]
        pub fn drawImageWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawTitleWithFrame:inView:))]
        #[unsafe(method_family = none)]
        pub fn drawTitleWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawKeyEquivalentWithFrame:inView:))]
        #[unsafe(method_family = none)]
        pub fn drawKeyEquivalentWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(drawBorderAndBackgroundWithFrame:inView:))]
        #[unsafe(method_family = none)]
        pub fn drawBorderAndBackgroundWithFrame_inView(
            &self,
            cell_frame: NSRect,
            control_view: &NSView,
        );

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

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

/// Methods declared on superclass `NSButtonCell`.
#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
impl NSMenuItemCell {
    extern_methods!(
        #[cfg(feature = "NSImage")]
        #[unsafe(method(initImageCell:))]
        #[unsafe(method_family = init)]
        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> Retained<Self>;
    );
}

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