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

use crate::*;

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

extern_conformance!(
    unsafe impl NSObjectProtocol for CAMetalDisplayLinkUpdate {}
);

impl CAMetalDisplayLinkUpdate {
    extern_methods!(
        #[cfg(all(feature = "CAMetalLayer", feature = "objc2-metal"))]
        #[unsafe(method(drawable))]
        #[unsafe(method_family = none)]
        pub fn drawable(&self) -> Retained<ProtocolObject<dyn CAMetalDrawable>>;

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

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

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for CAMetalDisplayLinkUpdate {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cametaldisplaylinkdelegate?language=objc)
    pub unsafe trait CAMetalDisplayLinkDelegate {
        #[unsafe(method(metalDisplayLink:needsUpdate:))]
        #[unsafe(method_family = none)]
        fn metalDisplayLink_needsUpdate(
            &self,
            link: &CAMetalDisplayLink,
            update: &CAMetalDisplayLinkUpdate,
        );
    }
);

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

extern_conformance!(
    unsafe impl NSObjectProtocol for CAMetalDisplayLink {}
);

impl CAMetalDisplayLink {
    extern_methods!(
        #[cfg(all(feature = "CALayer", feature = "CAMetalLayer"))]
        #[unsafe(method(initWithMetalLayer:))]
        #[unsafe(method_family = init)]
        pub fn initWithMetalLayer(this: Allocated<Self>, layer: &CAMetalLayer) -> Retained<Self>;

        /// # Safety
        ///
        /// `runloop` possibly has additional threading requirements.
        #[unsafe(method(addToRunLoop:forMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addToRunLoop_forMode(&self, runloop: &NSRunLoop, mode: &NSRunLoopMode);

        /// # Safety
        ///
        /// `runloop` possibly has additional threading requirements.
        #[unsafe(method(removeFromRunLoop:forMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeFromRunLoop_forMode(&self, runloop: &NSRunLoop, mode: &NSRunLoopMode);

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

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDisplayLinkDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn CAMetalDisplayLinkDelegate>>,
        );

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

        /// Setter for [`preferredFrameLatency`][Self::preferredFrameLatency].
        #[unsafe(method(setPreferredFrameLatency:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredFrameLatency(&self, preferred_frame_latency: c_float);

        #[cfg(feature = "CAFrameRateRange")]
        #[unsafe(method(preferredFrameRateRange))]
        #[unsafe(method_family = none)]
        pub fn preferredFrameRateRange(&self) -> CAFrameRateRange;

        #[cfg(feature = "CAFrameRateRange")]
        /// Setter for [`preferredFrameRateRange`][Self::preferredFrameRateRange].
        #[unsafe(method(setPreferredFrameRateRange:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredFrameRateRange(&self, preferred_frame_rate_range: CAFrameRateRange);

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

        /// Setter for [`isPaused`][Self::isPaused].
        #[unsafe(method(setPaused:))]
        #[unsafe(method_family = none)]
        pub fn setPaused(&self, paused: bool);
    );
}

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for CAMetalDisplayLink {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}