objc2_app_kit/generated/
NSOpenGLView.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglview?language=objc)
12    #[unsafe(super(NSView, NSResponder, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
15    #[deprecated = "Please use MTKView instead."]
16    pub struct NSOpenGLView;
17);
18
19#[cfg(all(
20    feature = "NSAccessibilityProtocols",
21    feature = "NSResponder",
22    feature = "NSView"
23))]
24extern_conformance!(
25    unsafe impl NSAccessibility for NSOpenGLView {}
26);
27
28#[cfg(all(
29    feature = "NSAccessibilityProtocols",
30    feature = "NSResponder",
31    feature = "NSView"
32))]
33extern_conformance!(
34    unsafe impl NSAccessibilityElementProtocol for NSOpenGLView {}
35);
36
37#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
38extern_conformance!(
39    unsafe impl NSAnimatablePropertyContainer for NSOpenGLView {}
40);
41
42#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
43extern_conformance!(
44    unsafe impl NSAppearanceCustomization for NSOpenGLView {}
45);
46
47#[cfg(all(feature = "NSResponder", feature = "NSView"))]
48extern_conformance!(
49    unsafe impl NSCoding for NSOpenGLView {}
50);
51
52#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
53extern_conformance!(
54    unsafe impl NSDraggingDestination for NSOpenGLView {}
55);
56
57#[cfg(all(feature = "NSResponder", feature = "NSView"))]
58extern_conformance!(
59    unsafe impl NSObjectProtocol for NSOpenGLView {}
60);
61
62#[cfg(all(
63    feature = "NSResponder",
64    feature = "NSUserInterfaceItemIdentification",
65    feature = "NSView"
66))]
67extern_conformance!(
68    unsafe impl NSUserInterfaceItemIdentification for NSOpenGLView {}
69);
70
71#[cfg(all(feature = "NSResponder", feature = "NSView"))]
72impl NSOpenGLView {
73    extern_methods!(
74        #[cfg(feature = "NSOpenGL")]
75        #[unsafe(method(defaultPixelFormat))]
76        #[unsafe(method_family = none)]
77        pub fn defaultPixelFormat(mtm: MainThreadMarker) -> Retained<NSOpenGLPixelFormat>;
78
79        #[cfg(feature = "NSOpenGL")]
80        #[unsafe(method(initWithFrame:pixelFormat:))]
81        #[unsafe(method_family = init)]
82        pub fn initWithFrame_pixelFormat(
83            this: Allocated<Self>,
84            frame_rect: NSRect,
85            format: Option<&NSOpenGLPixelFormat>,
86        ) -> Option<Retained<Self>>;
87
88        #[cfg(feature = "NSOpenGL")]
89        #[unsafe(method(openGLContext))]
90        #[unsafe(method_family = none)]
91        pub fn openGLContext(&self) -> Option<Retained<NSOpenGLContext>>;
92
93        #[cfg(feature = "NSOpenGL")]
94        /// Setter for [`openGLContext`][Self::openGLContext].
95        #[unsafe(method(setOpenGLContext:))]
96        #[unsafe(method_family = none)]
97        pub fn setOpenGLContext(&self, open_gl_context: Option<&NSOpenGLContext>);
98
99        #[unsafe(method(clearGLContext))]
100        #[unsafe(method_family = none)]
101        pub fn clearGLContext(&self);
102
103        #[unsafe(method(update))]
104        #[unsafe(method_family = none)]
105        pub fn update(&self);
106
107        #[unsafe(method(reshape))]
108        #[unsafe(method_family = none)]
109        pub fn reshape(&self);
110
111        #[cfg(feature = "NSOpenGL")]
112        #[unsafe(method(pixelFormat))]
113        #[unsafe(method_family = none)]
114        pub fn pixelFormat(&self) -> Option<Retained<NSOpenGLPixelFormat>>;
115
116        #[cfg(feature = "NSOpenGL")]
117        /// Setter for [`pixelFormat`][Self::pixelFormat].
118        #[unsafe(method(setPixelFormat:))]
119        #[unsafe(method_family = none)]
120        pub fn setPixelFormat(&self, pixel_format: Option<&NSOpenGLPixelFormat>);
121
122        #[unsafe(method(prepareOpenGL))]
123        #[unsafe(method_family = none)]
124        pub fn prepareOpenGL(&self);
125
126        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
127        #[unsafe(method(wantsBestResolutionOpenGLSurface))]
128        #[unsafe(method_family = none)]
129        pub fn wantsBestResolutionOpenGLSurface(&self) -> bool;
130
131        /// Setter for [`wantsBestResolutionOpenGLSurface`][Self::wantsBestResolutionOpenGLSurface].
132        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
133        #[unsafe(method(setWantsBestResolutionOpenGLSurface:))]
134        #[unsafe(method_family = none)]
135        pub fn setWantsBestResolutionOpenGLSurface(
136            &self,
137            wants_best_resolution_open_gl_surface: bool,
138        );
139
140        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
141        #[unsafe(method(wantsExtendedDynamicRangeOpenGLSurface))]
142        #[unsafe(method_family = none)]
143        pub fn wantsExtendedDynamicRangeOpenGLSurface(&self) -> bool;
144
145        /// Setter for [`wantsExtendedDynamicRangeOpenGLSurface`][Self::wantsExtendedDynamicRangeOpenGLSurface].
146        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
147        #[unsafe(method(setWantsExtendedDynamicRangeOpenGLSurface:))]
148        #[unsafe(method_family = none)]
149        pub fn setWantsExtendedDynamicRangeOpenGLSurface(
150            &self,
151            wants_extended_dynamic_range_open_gl_surface: bool,
152        );
153    );
154}
155
156/// Methods declared on superclass `NSView`.
157#[cfg(all(feature = "NSResponder", feature = "NSView"))]
158impl NSOpenGLView {
159    extern_methods!(
160        #[unsafe(method(initWithFrame:))]
161        #[unsafe(method_family = init)]
162        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
163
164        /// # Safety
165        ///
166        /// `coder` possibly has further requirements.
167        #[unsafe(method(initWithCoder:))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn initWithCoder(
170            this: Allocated<Self>,
171            coder: &NSCoder,
172        ) -> Option<Retained<Self>>;
173    );
174}
175
176/// Methods declared on superclass `NSResponder`.
177#[cfg(all(feature = "NSResponder", feature = "NSView"))]
178impl NSOpenGLView {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub fn init(this: Allocated<Self>) -> Retained<Self>;
183    );
184}
185
186/// Methods declared on superclass `NSObject`.
187#[cfg(all(feature = "NSResponder", feature = "NSView"))]
188impl NSOpenGLView {
189    extern_methods!(
190        #[unsafe(method(new))]
191        #[unsafe(method_family = new)]
192        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
193    );
194}
195
196/// NSOpenGLSurfaceResolution.
197#[cfg(all(feature = "NSResponder", feature = "NSView"))]
198impl NSView {
199    extern_methods!(
200        #[deprecated = "Use NSOpenGLView instead."]
201        #[unsafe(method(wantsBestResolutionOpenGLSurface))]
202        #[unsafe(method_family = none)]
203        pub fn wantsBestResolutionOpenGLSurface(&self) -> bool;
204
205        /// Setter for [`wantsBestResolutionOpenGLSurface`][Self::wantsBestResolutionOpenGLSurface].
206        #[deprecated = "Use NSOpenGLView instead."]
207        #[unsafe(method(setWantsBestResolutionOpenGLSurface:))]
208        #[unsafe(method_family = none)]
209        pub fn setWantsBestResolutionOpenGLSurface(
210            &self,
211            wants_best_resolution_open_gl_surface: bool,
212        );
213    );
214}
215
216/// NSExtendedDynamicRange.
217#[cfg(all(feature = "NSResponder", feature = "NSView"))]
218impl NSView {
219    extern_methods!(
220        #[deprecated = "Use NSOpenGLView instead."]
221        #[unsafe(method(wantsExtendedDynamicRangeOpenGLSurface))]
222        #[unsafe(method_family = none)]
223        pub fn wantsExtendedDynamicRangeOpenGLSurface(&self) -> bool;
224
225        /// Setter for [`wantsExtendedDynamicRangeOpenGLSurface`][Self::wantsExtendedDynamicRangeOpenGLSurface].
226        #[deprecated = "Use NSOpenGLView instead."]
227        #[unsafe(method(setWantsExtendedDynamicRangeOpenGLSurface:))]
228        #[unsafe(method_family = none)]
229        pub fn setWantsExtendedDynamicRangeOpenGLSurface(
230            &self,
231            wants_extended_dynamic_range_open_gl_surface: bool,
232        );
233    );
234}