objc2_quartz_core/generated/
CADisplayLink.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// Class representing a timer bound to the display vsync. *
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cadisplaylink?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct CADisplayLink;
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for CADisplayLink {}
23);
24
25impl CADisplayLink {
26    extern_methods!(
27        #[unsafe(method(displayLinkWithTarget:selector:))]
28        #[unsafe(method_family = none)]
29        pub unsafe fn displayLinkWithTarget_selector(
30            target: &AnyObject,
31            sel: Sel,
32        ) -> Retained<CADisplayLink>;
33
34        #[unsafe(method(addToRunLoop:forMode:))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn addToRunLoop_forMode(&self, runloop: &NSRunLoop, mode: &NSRunLoopMode);
37
38        #[unsafe(method(removeFromRunLoop:forMode:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn removeFromRunLoop_forMode(&self, runloop: &NSRunLoop, mode: &NSRunLoopMode);
41
42        #[unsafe(method(invalidate))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn invalidate(&self);
45
46        #[cfg(feature = "objc2-core-foundation")]
47        #[unsafe(method(timestamp))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn timestamp(&self) -> CFTimeInterval;
50
51        #[cfg(feature = "objc2-core-foundation")]
52        #[unsafe(method(duration))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn duration(&self) -> CFTimeInterval;
55
56        #[cfg(feature = "objc2-core-foundation")]
57        #[unsafe(method(targetTimestamp))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn targetTimestamp(&self) -> CFTimeInterval;
60
61        #[unsafe(method(isPaused))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn isPaused(&self) -> bool;
64
65        /// Setter for [`isPaused`][Self::isPaused].
66        #[unsafe(method(setPaused:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setPaused(&self, paused: bool);
69
70        #[deprecated = "preferredFramesPerSecond"]
71        #[unsafe(method(frameInterval))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn frameInterval(&self) -> NSInteger;
74
75        /// Setter for [`frameInterval`][Self::frameInterval].
76        #[deprecated = "preferredFramesPerSecond"]
77        #[unsafe(method(setFrameInterval:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setFrameInterval(&self, frame_interval: NSInteger);
80
81        #[deprecated]
82        #[unsafe(method(preferredFramesPerSecond))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn preferredFramesPerSecond(&self) -> NSInteger;
85
86        /// Setter for [`preferredFramesPerSecond`][Self::preferredFramesPerSecond].
87        #[deprecated]
88        #[unsafe(method(setPreferredFramesPerSecond:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setPreferredFramesPerSecond(&self, preferred_frames_per_second: NSInteger);
91
92        #[cfg(feature = "CAFrameRateRange")]
93        #[unsafe(method(preferredFrameRateRange))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn preferredFrameRateRange(&self) -> CAFrameRateRange;
96
97        #[cfg(feature = "CAFrameRateRange")]
98        /// Setter for [`preferredFrameRateRange`][Self::preferredFrameRateRange].
99        #[unsafe(method(setPreferredFrameRateRange:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setPreferredFrameRateRange(
102            &self,
103            preferred_frame_rate_range: CAFrameRateRange,
104        );
105    );
106}
107
108/// Methods declared on superclass `NSObject`.
109impl CADisplayLink {
110    extern_methods!(
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[unsafe(method(new))]
116        #[unsafe(method_family = new)]
117        pub unsafe fn new() -> Retained<Self>;
118    );
119}