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::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsimagealignment?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageAlignment(pub NSUInteger);
impl NSImageAlignment {
    #[doc(alias = "NSImageAlignCenter")]
    pub const AlignCenter: Self = Self(0);
    #[doc(alias = "NSImageAlignTop")]
    pub const AlignTop: Self = Self(1);
    #[doc(alias = "NSImageAlignTopLeft")]
    pub const AlignTopLeft: Self = Self(2);
    #[doc(alias = "NSImageAlignTopRight")]
    pub const AlignTopRight: Self = Self(3);
    #[doc(alias = "NSImageAlignLeft")]
    pub const AlignLeft: Self = Self(4);
    #[doc(alias = "NSImageAlignBottom")]
    pub const AlignBottom: Self = Self(5);
    #[doc(alias = "NSImageAlignBottomLeft")]
    pub const AlignBottomLeft: Self = Self(6);
    #[doc(alias = "NSImageAlignBottomRight")]
    pub const AlignBottomRight: Self = Self(7);
    #[doc(alias = "NSImageAlignRight")]
    pub const AlignRight: Self = Self(8);
}

unsafe impl Encode for NSImageAlignment {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSImageAlignment {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsimageframestyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageFrameStyle(pub NSUInteger);
impl NSImageFrameStyle {
    #[doc(alias = "NSImageFrameNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "NSImageFramePhoto")]
    pub const Photo: Self = Self(1);
    #[doc(alias = "NSImageFrameGrayBezel")]
    pub const GrayBezel: Self = Self(2);
    #[doc(alias = "NSImageFrameGroove")]
    pub const Groove: Self = Self(3);
    #[doc(alias = "NSImageFrameButton")]
    pub const Button: Self = Self(4);
}

unsafe impl Encode for NSImageFrameStyle {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSImageFrameStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

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

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

#[cfg(feature = "NSCell")]
extern_conformance!(
    unsafe impl NSCoding for NSImageCell {}
);

#[cfg(feature = "NSCell")]
extern_conformance!(
    unsafe impl NSCopying for NSImageCell {}
);

#[cfg(feature = "NSCell")]
unsafe impl CopyingHelper for NSImageCell {
    type Result = Self;
}

#[cfg(feature = "NSCell")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSImageCell {}
);

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

#[cfg(feature = "NSCell")]
impl NSImageCell {
    extern_methods!(
        #[unsafe(method(imageAlignment))]
        #[unsafe(method_family = none)]
        pub fn imageAlignment(&self) -> NSImageAlignment;

        /// Setter for [`imageAlignment`][Self::imageAlignment].
        #[unsafe(method(setImageAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setImageAlignment(&self, image_alignment: NSImageAlignment);

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

        /// Setter for [`imageScaling`][Self::imageScaling].
        #[unsafe(method(setImageScaling:))]
        #[unsafe(method_family = none)]
        pub fn setImageScaling(&self, image_scaling: NSImageScaling);

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

        /// Setter for [`imageFrameStyle`][Self::imageFrameStyle].
        #[unsafe(method(setImageFrameStyle:))]
        #[unsafe(method_family = none)]
        pub fn setImageFrameStyle(&self, image_frame_style: NSImageFrameStyle);
    );
}

/// Methods declared on superclass `NSCell`.
#[cfg(feature = "NSCell")]
impl NSImageCell {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initTextCell:))]
        #[unsafe(method_family = init)]
        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[unsafe(method(initImageCell:))]
        #[unsafe(method_family = init)]
        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> 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>;
    );
}

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