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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

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

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

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

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

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

#[cfg(feature = "NSImageRep")]
impl NSCachedImageRep {
    extern_methods!(
        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
        /// # Safety
        ///
        /// `win` might not allow `None`.
        #[deprecated]
        #[unsafe(method(initWithWindow:rect:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithWindow_rect(
            this: Allocated<Self>,
            win: Option<&NSWindow>,
            rect: NSRect,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSGraphics")]
        #[deprecated]
        #[unsafe(method(initWithSize:depth:separate:alpha:))]
        #[unsafe(method_family = init)]
        pub fn initWithSize_depth_separate_alpha(
            this: Allocated<Self>,
            size: NSSize,
            depth: NSWindowDepth,
            flag: bool,
            alpha: bool,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
        #[deprecated]
        #[unsafe(method(window))]
        #[unsafe(method_family = none)]
        pub fn window(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;

        #[deprecated]
        #[unsafe(method(rect))]
        #[unsafe(method_family = none)]
        pub fn rect(&self) -> NSRect;
    );
}

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

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

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

#[cfg(feature = "NSImageRep")]
impl DefaultRetained for NSCachedImageRep {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}