objc2_app_kit/generated/
NSOpenGLLayer.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::*;
8#[cfg(feature = "objc2-core-video")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_video::*;
11use objc2_foundation::*;
12#[cfg(feature = "objc2-quartz-core")]
13#[cfg(target_vendor = "apple")]
14use objc2_quartz_core::*;
15
16use crate::*;
17
18extern_class!(
19    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopengllayer?language=objc)
20    #[unsafe(super(CAOpenGLLayer, CALayer, NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(feature = "objc2-quartz-core")]
23    #[cfg(target_vendor = "apple")]
24    #[deprecated = "Please use CAMetalLayer instead."]
25    pub struct NSOpenGLLayer;
26);
27
28#[cfg(feature = "objc2-quartz-core")]
29#[cfg(target_vendor = "apple")]
30extern_conformance!(
31    unsafe impl CAMediaTiming for NSOpenGLLayer {}
32);
33
34#[cfg(feature = "objc2-quartz-core")]
35#[cfg(target_vendor = "apple")]
36extern_conformance!(
37    unsafe impl NSCoding for NSOpenGLLayer {}
38);
39
40#[cfg(feature = "objc2-quartz-core")]
41#[cfg(target_vendor = "apple")]
42extern_conformance!(
43    unsafe impl NSObjectProtocol for NSOpenGLLayer {}
44);
45
46#[cfg(feature = "objc2-quartz-core")]
47#[cfg(target_vendor = "apple")]
48extern_conformance!(
49    unsafe impl NSSecureCoding for NSOpenGLLayer {}
50);
51
52#[cfg(feature = "objc2-quartz-core")]
53#[cfg(target_vendor = "apple")]
54impl NSOpenGLLayer {
55    extern_methods!(
56        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
57        #[unsafe(method(view))]
58        #[unsafe(method_family = none)]
59        pub fn view(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
60
61        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
62        /// Setter for [`view`][Self::view].
63        ///
64        /// This is a [weak property][objc2::topics::weak_property].
65        #[unsafe(method(setView:))]
66        #[unsafe(method_family = none)]
67        pub fn setView(&self, view: Option<&NSView>);
68
69        #[cfg(feature = "NSOpenGL")]
70        #[unsafe(method(openGLPixelFormat))]
71        #[unsafe(method_family = none)]
72        pub fn openGLPixelFormat(&self) -> Option<Retained<NSOpenGLPixelFormat>>;
73
74        #[cfg(feature = "NSOpenGL")]
75        /// Setter for [`openGLPixelFormat`][Self::openGLPixelFormat].
76        #[unsafe(method(setOpenGLPixelFormat:))]
77        #[unsafe(method_family = none)]
78        pub fn setOpenGLPixelFormat(&self, open_gl_pixel_format: Option<&NSOpenGLPixelFormat>);
79
80        #[cfg(feature = "NSOpenGL")]
81        #[unsafe(method(openGLContext))]
82        #[unsafe(method_family = none)]
83        pub fn openGLContext(&self) -> Option<Retained<NSOpenGLContext>>;
84
85        #[cfg(feature = "NSOpenGL")]
86        /// Setter for [`openGLContext`][Self::openGLContext].
87        #[unsafe(method(setOpenGLContext:))]
88        #[unsafe(method_family = none)]
89        pub fn setOpenGLContext(&self, open_gl_context: Option<&NSOpenGLContext>);
90
91        #[cfg(feature = "NSOpenGL")]
92        #[unsafe(method(openGLPixelFormatForDisplayMask:))]
93        #[unsafe(method_family = none)]
94        pub fn openGLPixelFormatForDisplayMask(&self, mask: u32) -> Retained<NSOpenGLPixelFormat>;
95
96        #[cfg(feature = "NSOpenGL")]
97        #[unsafe(method(openGLContextForPixelFormat:))]
98        #[unsafe(method_family = none)]
99        pub fn openGLContextForPixelFormat(
100            &self,
101            pixel_format: &NSOpenGLPixelFormat,
102        ) -> Retained<NSOpenGLContext>;
103
104        #[cfg(all(
105            feature = "NSOpenGL",
106            feature = "objc2-core-foundation",
107            feature = "objc2-core-video"
108        ))]
109        /// # Safety
110        ///
111        /// `ts` must be a valid pointer.
112        #[unsafe(method(canDrawInOpenGLContext:pixelFormat:forLayerTime:displayTime:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn canDrawInOpenGLContext_pixelFormat_forLayerTime_displayTime(
115            &self,
116            context: &NSOpenGLContext,
117            pixel_format: &NSOpenGLPixelFormat,
118            t: CFTimeInterval,
119            ts: NonNull<CVTimeStamp>,
120        ) -> bool;
121
122        #[cfg(all(
123            feature = "NSOpenGL",
124            feature = "objc2-core-foundation",
125            feature = "objc2-core-video"
126        ))]
127        /// # Safety
128        ///
129        /// `ts` must be a valid pointer.
130        #[unsafe(method(drawInOpenGLContext:pixelFormat:forLayerTime:displayTime:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn drawInOpenGLContext_pixelFormat_forLayerTime_displayTime(
133            &self,
134            context: &NSOpenGLContext,
135            pixel_format: &NSOpenGLPixelFormat,
136            t: CFTimeInterval,
137            ts: NonNull<CVTimeStamp>,
138        );
139    );
140}
141
142/// Methods declared on superclass `CALayer`.
143#[cfg(feature = "objc2-quartz-core")]
144#[cfg(target_vendor = "apple")]
145impl NSOpenGLLayer {
146    extern_methods!(
147        /// Layer creation and initialization. *
148        #[unsafe(method(layer))]
149        #[unsafe(method_family = none)]
150        pub fn layer() -> Retained<Self>;
151
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        /// # Safety
157        ///
158        /// `layer` should be of the correct type.
159        #[unsafe(method(initWithLayer:))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
162    );
163}
164
165/// Methods declared on superclass `NSObject`.
166#[cfg(feature = "objc2-quartz-core")]
167#[cfg(target_vendor = "apple")]
168impl NSOpenGLLayer {
169    extern_methods!(
170        #[unsafe(method(new))]
171        #[unsafe(method_family = new)]
172        pub fn new() -> Retained<Self>;
173    );
174}
175
176#[cfg(feature = "objc2-quartz-core")]
177#[cfg(target_vendor = "apple")]
178impl DefaultRetained for NSOpenGLLayer {
179    #[inline]
180    fn default_retained() -> Retained<Self> {
181        Self::new()
182    }
183}