objc2_quartz_core/generated/
CAMetalLayer.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-graphics")]
9use objc2_core_graphics::*;
10use objc2_foundation::*;
11#[cfg(feature = "objc2-metal")]
12use objc2_metal::*;
13
14use crate::*;
15
16extern_protocol!(
17    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cametaldrawable?language=objc)
18    #[cfg(feature = "objc2-metal")]
19    pub unsafe trait CAMetalDrawable: MTLDrawable {
20        #[unsafe(method(texture))]
21        #[unsafe(method_family = none)]
22        unsafe fn texture(&self) -> Retained<ProtocolObject<dyn MTLTexture>>;
23
24        #[cfg(feature = "CALayer")]
25        #[unsafe(method(layer))]
26        #[unsafe(method_family = none)]
27        unsafe fn layer(&self) -> Retained<CAMetalLayer>;
28    }
29);
30
31extern_class!(
32    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cametallayer?language=objc)
33    #[unsafe(super(CALayer, NSObject))]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    #[cfg(feature = "CALayer")]
36    pub struct CAMetalLayer;
37);
38
39#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
40extern_conformance!(
41    unsafe impl CAMediaTiming for CAMetalLayer {}
42);
43
44#[cfg(feature = "CALayer")]
45extern_conformance!(
46    unsafe impl NSCoding for CAMetalLayer {}
47);
48
49#[cfg(feature = "CALayer")]
50extern_conformance!(
51    unsafe impl NSObjectProtocol for CAMetalLayer {}
52);
53
54#[cfg(feature = "CALayer")]
55extern_conformance!(
56    unsafe impl NSSecureCoding for CAMetalLayer {}
57);
58
59#[cfg(feature = "CALayer")]
60impl CAMetalLayer {
61    extern_methods!(
62        #[cfg(feature = "objc2-metal")]
63        #[unsafe(method(device))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
66
67        #[cfg(feature = "objc2-metal")]
68        /// Setter for [`device`][Self::device].
69        #[unsafe(method(setDevice:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn setDevice(&self, device: Option<&ProtocolObject<dyn MTLDevice>>);
72
73        #[cfg(feature = "objc2-metal")]
74        #[unsafe(method(preferredDevice))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn preferredDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
77
78        #[cfg(feature = "objc2-metal")]
79        #[unsafe(method(pixelFormat))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn pixelFormat(&self) -> MTLPixelFormat;
82
83        #[cfg(feature = "objc2-metal")]
84        /// Setter for [`pixelFormat`][Self::pixelFormat].
85        #[unsafe(method(setPixelFormat:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
88
89        #[unsafe(method(framebufferOnly))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn framebufferOnly(&self) -> bool;
92
93        /// Setter for [`framebufferOnly`][Self::framebufferOnly].
94        #[unsafe(method(setFramebufferOnly:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn setFramebufferOnly(&self, framebuffer_only: bool);
97
98        #[cfg(feature = "objc2-core-foundation")]
99        #[unsafe(method(drawableSize))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn drawableSize(&self) -> CGSize;
102
103        #[cfg(feature = "objc2-core-foundation")]
104        /// Setter for [`drawableSize`][Self::drawableSize].
105        #[unsafe(method(setDrawableSize:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn setDrawableSize(&self, drawable_size: CGSize);
108
109        #[cfg(feature = "objc2-metal")]
110        #[unsafe(method(nextDrawable))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn nextDrawable(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDrawable>>>;
113
114        #[unsafe(method(maximumDrawableCount))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn maximumDrawableCount(&self) -> NSUInteger;
117
118        /// Setter for [`maximumDrawableCount`][Self::maximumDrawableCount].
119        #[unsafe(method(setMaximumDrawableCount:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setMaximumDrawableCount(&self, maximum_drawable_count: NSUInteger);
122
123        #[unsafe(method(presentsWithTransaction))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn presentsWithTransaction(&self) -> bool;
126
127        /// Setter for [`presentsWithTransaction`][Self::presentsWithTransaction].
128        #[unsafe(method(setPresentsWithTransaction:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setPresentsWithTransaction(&self, presents_with_transaction: bool);
131
132        #[cfg(feature = "objc2-core-graphics")]
133        #[unsafe(method(colorspace))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn colorspace(&self) -> Option<Retained<CGColorSpace>>;
136
137        #[cfg(feature = "objc2-core-graphics")]
138        /// Setter for [`colorspace`][Self::colorspace].
139        #[unsafe(method(setColorspace:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn setColorspace(&self, colorspace: Option<&CGColorSpace>);
142
143        #[unsafe(method(wantsExtendedDynamicRangeContent))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn wantsExtendedDynamicRangeContent(&self) -> bool;
146
147        /// Setter for [`wantsExtendedDynamicRangeContent`][Self::wantsExtendedDynamicRangeContent].
148        #[unsafe(method(setWantsExtendedDynamicRangeContent:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn setWantsExtendedDynamicRangeContent(
151            &self,
152            wants_extended_dynamic_range_content: bool,
153        );
154
155        #[cfg(feature = "CAEDRMetadata")]
156        #[unsafe(method(EDRMetadata))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn EDRMetadata(&self) -> Option<Retained<CAEDRMetadata>>;
159
160        #[cfg(feature = "CAEDRMetadata")]
161        /// Setter for [`EDRMetadata`][Self::EDRMetadata].
162        #[unsafe(method(setEDRMetadata:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setEDRMetadata(&self, edr_metadata: Option<&CAEDRMetadata>);
165
166        #[unsafe(method(displaySyncEnabled))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn displaySyncEnabled(&self) -> bool;
169
170        /// Setter for [`displaySyncEnabled`][Self::displaySyncEnabled].
171        #[unsafe(method(setDisplaySyncEnabled:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setDisplaySyncEnabled(&self, display_sync_enabled: bool);
174
175        #[unsafe(method(allowsNextDrawableTimeout))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn allowsNextDrawableTimeout(&self) -> bool;
178
179        /// Setter for [`allowsNextDrawableTimeout`][Self::allowsNextDrawableTimeout].
180        #[unsafe(method(setAllowsNextDrawableTimeout:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn setAllowsNextDrawableTimeout(&self, allows_next_drawable_timeout: bool);
183
184        #[unsafe(method(developerHUDProperties))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn developerHUDProperties(&self) -> Option<Retained<NSDictionary>>;
187
188        /// Setter for [`developerHUDProperties`][Self::developerHUDProperties].
189        #[unsafe(method(setDeveloperHUDProperties:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setDeveloperHUDProperties(
192            &self,
193            developer_hud_properties: Option<&NSDictionary>,
194        );
195    );
196}
197
198/// Methods declared on superclass `CALayer`.
199#[cfg(feature = "CALayer")]
200impl CAMetalLayer {
201    extern_methods!(
202        /// Layer creation and initialization. *
203        #[unsafe(method(layer))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn layer() -> Retained<Self>;
206
207        #[unsafe(method(init))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
210
211        #[unsafe(method(initWithLayer:))]
212        #[unsafe(method_family = init)]
213        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
214    );
215}
216
217/// Methods declared on superclass `NSObject`.
218#[cfg(feature = "CALayer")]
219impl CAMetalLayer {
220    extern_methods!(
221        #[unsafe(method(new))]
222        #[unsafe(method_family = new)]
223        pub unsafe fn new() -> Retained<Self>;
224    );
225}