objc2-quartz-core 0.3.2

Bindings to the QuartzCore/CoreAnimation 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::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-metal")]
use objc2_metal::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cametaldrawable?language=objc)
    #[cfg(feature = "objc2-metal")]
    pub unsafe trait CAMetalDrawable: MTLDrawable {
        #[unsafe(method(texture))]
        #[unsafe(method_family = none)]
        fn texture(&self) -> Retained<ProtocolObject<dyn MTLTexture>>;

        #[cfg(feature = "CALayer")]
        #[unsafe(method(layer))]
        #[unsafe(method_family = none)]
        fn layer(&self) -> Retained<CAMetalLayer>;
    }
);

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

#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
extern_conformance!(
    unsafe impl CAMediaTiming for CAMetalLayer {}
);

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

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

#[cfg(feature = "CALayer")]
extern_conformance!(
    unsafe impl NSSecureCoding for CAMetalLayer {}
);

#[cfg(feature = "CALayer")]
impl CAMetalLayer {
    extern_methods!(
        #[cfg(feature = "objc2-metal")]
        #[unsafe(method(device))]
        #[unsafe(method_family = none)]
        pub fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;

        #[cfg(feature = "objc2-metal")]
        /// Setter for [`device`][Self::device].
        #[unsafe(method(setDevice:))]
        #[unsafe(method_family = none)]
        pub fn setDevice(&self, device: Option<&ProtocolObject<dyn MTLDevice>>);

        #[cfg(feature = "objc2-metal")]
        #[unsafe(method(preferredDevice))]
        #[unsafe(method_family = none)]
        pub fn preferredDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;

        #[cfg(feature = "objc2-metal")]
        #[unsafe(method(pixelFormat))]
        #[unsafe(method_family = none)]
        pub fn pixelFormat(&self) -> MTLPixelFormat;

        #[cfg(feature = "objc2-metal")]
        /// Setter for [`pixelFormat`][Self::pixelFormat].
        #[unsafe(method(setPixelFormat:))]
        #[unsafe(method_family = none)]
        pub fn setPixelFormat(&self, pixel_format: MTLPixelFormat);

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`drawableSize`][Self::drawableSize].
        #[unsafe(method(setDrawableSize:))]
        #[unsafe(method_family = none)]
        pub fn setDrawableSize(&self, drawable_size: CGSize);

        #[cfg(feature = "objc2-metal")]
        #[unsafe(method(nextDrawable))]
        #[unsafe(method_family = none)]
        pub fn nextDrawable(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDrawable>>>;

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

        /// Setter for [`maximumDrawableCount`][Self::maximumDrawableCount].
        #[unsafe(method(setMaximumDrawableCount:))]
        #[unsafe(method_family = none)]
        pub fn setMaximumDrawableCount(&self, maximum_drawable_count: NSUInteger);

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

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

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(colorspace))]
        #[unsafe(method_family = none)]
        pub fn colorspace(&self) -> Option<Retained<CGColorSpace>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`colorspace`][Self::colorspace].
        #[unsafe(method(setColorspace:))]
        #[unsafe(method_family = none)]
        pub fn setColorspace(&self, colorspace: Option<&CGColorSpace>);

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

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

        #[cfg(feature = "CAEDRMetadata")]
        #[unsafe(method(EDRMetadata))]
        #[unsafe(method_family = none)]
        pub fn EDRMetadata(&self) -> Option<Retained<CAEDRMetadata>>;

        #[cfg(feature = "CAEDRMetadata")]
        /// Setter for [`EDRMetadata`][Self::EDRMetadata].
        #[unsafe(method(setEDRMetadata:))]
        #[unsafe(method_family = none)]
        pub fn setEDRMetadata(&self, edr_metadata: Option<&CAEDRMetadata>);

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

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

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

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

        #[unsafe(method(developerHUDProperties))]
        #[unsafe(method_family = none)]
        pub fn developerHUDProperties(&self) -> Option<Retained<NSDictionary>>;

        /// Setter for [`developerHUDProperties`][Self::developerHUDProperties].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `developer_hud_properties` generic should be of the correct type.
        #[unsafe(method(setDeveloperHUDProperties:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDeveloperHUDProperties(
            &self,
            developer_hud_properties: Option<&NSDictionary>,
        );

        #[cfg(feature = "objc2-metal")]
        #[unsafe(method(residencySet))]
        #[unsafe(method_family = none)]
        pub fn residencySet(&self) -> Retained<ProtocolObject<dyn MTLResidencySet>>;
    );
}

/// Methods declared on superclass `CALayer`.
#[cfg(feature = "CALayer")]
impl CAMetalLayer {
    extern_methods!(
        /// Layer creation and initialization. *
        #[unsafe(method(layer))]
        #[unsafe(method_family = none)]
        pub fn layer() -> Retained<Self>;

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

        /// # Safety
        ///
        /// `layer` should be of the correct type.
        #[unsafe(method(initWithLayer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
    );
}

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

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