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!(
    /// Class representing a timer bound to the display vsync. *
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cadisplaylink?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CADisplayLink;
);

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

impl CADisplayLink {
    extern_methods!(
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `sel` must be a valid selector.
        #[unsafe(method(displayLinkWithTarget:selector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayLinkWithTarget_selector(
            target: &AnyObject,
            sel: Sel,
        ) -> Retained<CADisplayLink>;

        /// # 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);

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

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

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

        #[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);

        #[deprecated = "preferredFramesPerSecond"]
        #[unsafe(method(frameInterval))]
        #[unsafe(method_family = none)]
        pub fn frameInterval(&self) -> NSInteger;

        /// Setter for [`frameInterval`][Self::frameInterval].
        #[deprecated = "preferredFramesPerSecond"]
        #[unsafe(method(setFrameInterval:))]
        #[unsafe(method_family = none)]
        pub fn setFrameInterval(&self, frame_interval: NSInteger);

        #[deprecated]
        #[unsafe(method(preferredFramesPerSecond))]
        #[unsafe(method_family = none)]
        pub fn preferredFramesPerSecond(&self) -> NSInteger;

        /// Setter for [`preferredFramesPerSecond`][Self::preferredFramesPerSecond].
        #[deprecated]
        #[unsafe(method(setPreferredFramesPerSecond:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredFramesPerSecond(&self, preferred_frames_per_second: NSInteger);

        #[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);
    );
}

/// Methods declared on superclass `NSObject`.
impl CADisplayLink {
    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 CADisplayLink {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}