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"))]
40unsafe impl CAMediaTiming for CAMetalLayer {}
41
42#[cfg(feature = "CALayer")]
43unsafe impl NSCoding for CAMetalLayer {}
44
45#[cfg(feature = "CALayer")]
46unsafe impl NSObjectProtocol for CAMetalLayer {}
47
48#[cfg(feature = "CALayer")]
49unsafe impl NSSecureCoding for CAMetalLayer {}
50
51#[cfg(feature = "CALayer")]
52impl CAMetalLayer {
53    extern_methods!(
54        #[cfg(feature = "objc2-metal")]
55        #[unsafe(method(device))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
58
59        #[cfg(feature = "objc2-metal")]
60        /// Setter for [`device`][Self::device].
61        #[unsafe(method(setDevice:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn setDevice(&self, device: Option<&ProtocolObject<dyn MTLDevice>>);
64
65        #[cfg(feature = "objc2-metal")]
66        #[unsafe(method(preferredDevice))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn preferredDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;
69
70        #[cfg(feature = "objc2-metal")]
71        #[unsafe(method(pixelFormat))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn pixelFormat(&self) -> MTLPixelFormat;
74
75        #[cfg(feature = "objc2-metal")]
76        /// Setter for [`pixelFormat`][Self::pixelFormat].
77        #[unsafe(method(setPixelFormat:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setPixelFormat(&self, pixel_format: MTLPixelFormat);
80
81        #[unsafe(method(framebufferOnly))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn framebufferOnly(&self) -> bool;
84
85        /// Setter for [`framebufferOnly`][Self::framebufferOnly].
86        #[unsafe(method(setFramebufferOnly:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setFramebufferOnly(&self, framebuffer_only: bool);
89
90        #[cfg(feature = "objc2-core-foundation")]
91        #[unsafe(method(drawableSize))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn drawableSize(&self) -> CGSize;
94
95        #[cfg(feature = "objc2-core-foundation")]
96        /// Setter for [`drawableSize`][Self::drawableSize].
97        #[unsafe(method(setDrawableSize:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setDrawableSize(&self, drawable_size: CGSize);
100
101        #[cfg(feature = "objc2-metal")]
102        #[unsafe(method(nextDrawable))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn nextDrawable(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDrawable>>>;
105
106        #[unsafe(method(maximumDrawableCount))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn maximumDrawableCount(&self) -> NSUInteger;
109
110        /// Setter for [`maximumDrawableCount`][Self::maximumDrawableCount].
111        #[unsafe(method(setMaximumDrawableCount:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setMaximumDrawableCount(&self, maximum_drawable_count: NSUInteger);
114
115        #[unsafe(method(presentsWithTransaction))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn presentsWithTransaction(&self) -> bool;
118
119        /// Setter for [`presentsWithTransaction`][Self::presentsWithTransaction].
120        #[unsafe(method(setPresentsWithTransaction:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setPresentsWithTransaction(&self, presents_with_transaction: bool);
123
124        #[cfg(feature = "objc2-core-graphics")]
125        #[unsafe(method(colorspace))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn colorspace(&self) -> Option<Retained<CGColorSpace>>;
128
129        #[cfg(feature = "objc2-core-graphics")]
130        /// Setter for [`colorspace`][Self::colorspace].
131        #[unsafe(method(setColorspace:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setColorspace(&self, colorspace: Option<&CGColorSpace>);
134
135        #[unsafe(method(wantsExtendedDynamicRangeContent))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn wantsExtendedDynamicRangeContent(&self) -> bool;
138
139        /// Setter for [`wantsExtendedDynamicRangeContent`][Self::wantsExtendedDynamicRangeContent].
140        #[unsafe(method(setWantsExtendedDynamicRangeContent:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setWantsExtendedDynamicRangeContent(
143            &self,
144            wants_extended_dynamic_range_content: bool,
145        );
146
147        #[cfg(feature = "CAEDRMetadata")]
148        #[unsafe(method(EDRMetadata))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn EDRMetadata(&self) -> Option<Retained<CAEDRMetadata>>;
151
152        #[cfg(feature = "CAEDRMetadata")]
153        /// Setter for [`EDRMetadata`][Self::EDRMetadata].
154        #[unsafe(method(setEDRMetadata:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setEDRMetadata(&self, edr_metadata: Option<&CAEDRMetadata>);
157
158        #[unsafe(method(displaySyncEnabled))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn displaySyncEnabled(&self) -> bool;
161
162        /// Setter for [`displaySyncEnabled`][Self::displaySyncEnabled].
163        #[unsafe(method(setDisplaySyncEnabled:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setDisplaySyncEnabled(&self, display_sync_enabled: bool);
166
167        #[unsafe(method(allowsNextDrawableTimeout))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn allowsNextDrawableTimeout(&self) -> bool;
170
171        /// Setter for [`allowsNextDrawableTimeout`][Self::allowsNextDrawableTimeout].
172        #[unsafe(method(setAllowsNextDrawableTimeout:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn setAllowsNextDrawableTimeout(&self, allows_next_drawable_timeout: bool);
175
176        #[unsafe(method(developerHUDProperties))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn developerHUDProperties(&self) -> Option<Retained<NSDictionary>>;
179
180        /// Setter for [`developerHUDProperties`][Self::developerHUDProperties].
181        #[unsafe(method(setDeveloperHUDProperties:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn setDeveloperHUDProperties(
184            &self,
185            developer_hud_properties: Option<&NSDictionary>,
186        );
187    );
188}
189
190/// Methods declared on superclass `CALayer`.
191#[cfg(feature = "CALayer")]
192impl CAMetalLayer {
193    extern_methods!(
194        /// Layer creation and initialization. *
195        #[unsafe(method(layer))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn layer() -> Retained<Self>;
198
199        #[unsafe(method(init))]
200        #[unsafe(method_family = init)]
201        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203        #[unsafe(method(initWithLayer:))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
206    );
207}
208
209/// Methods declared on superclass `NSObject`.
210#[cfg(feature = "CALayer")]
211impl CAMetalLayer {
212    extern_methods!(
213        #[unsafe(method(new))]
214        #[unsafe(method_family = new)]
215        pub unsafe fn new() -> Retained<Self>;
216    );
217}