objc2-app-kit 0.2.2

Bindings to the AppKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageAlignment(pub NSUInteger);
impl NSImageAlignment {
    pub const NSImageAlignCenter: Self = Self(0);
    pub const NSImageAlignTop: Self = Self(1);
    pub const NSImageAlignTopLeft: Self = Self(2);
    pub const NSImageAlignTopRight: Self = Self(3);
    pub const NSImageAlignLeft: Self = Self(4);
    pub const NSImageAlignBottom: Self = Self(5);
    pub const NSImageAlignBottomLeft: Self = Self(6);
    pub const NSImageAlignBottomRight: Self = Self(7);
    pub const NSImageAlignRight: 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);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageFrameStyle(pub NSUInteger);
impl NSImageFrameStyle {
    pub const NSImageFrameNone: Self = Self(0);
    pub const NSImageFramePhoto: Self = Self(1);
    pub const NSImageFrameGrayBezel: Self = Self(2);
    pub const NSImageFrameGroove: Self = Self(3);
    pub const NSImageFrameButton: 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!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSCell")]
    pub struct NSImageCell;

    #[cfg(feature = "NSCell")]
    unsafe impl ClassType for NSImageCell {
        #[inherits(NSObject)]
        type Super = NSCell;
        type Mutability = MainThreadOnly;
    }
);

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

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

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

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

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

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

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

        #[method(setImageAlignment:)]
        pub unsafe fn setImageAlignment(&self, image_alignment: NSImageAlignment);

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

        #[method(setImageScaling:)]
        pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);

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

        #[method(setImageFrameStyle:)]
        pub unsafe fn setImageFrameStyle(&self, image_frame_style: NSImageFrameStyle);
    }
);

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

        #[method_id(@__retain_semantics Init initTextCell:)]
        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;

        #[cfg(feature = "NSImage")]
        #[method_id(@__retain_semantics Init initImageCell:)]
        pub unsafe fn initImageCell(
            this: Allocated<Self>,
            image: Option<&NSImage>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
    }
);

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