1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-metal")]
use objc2_metal::*;

use crate::*;

extern_protocol!(
    #[cfg(feature = "objc2-metal")]
    pub unsafe trait CAMetalDrawable: MTLDrawable {
        #[method_id(@__retain_semantics Other texture)]
        unsafe fn texture(&self) -> Retained<ProtocolObject<dyn MTLTexture>>;

        #[cfg(feature = "CALayer")]
        #[method_id(@__retain_semantics Other layer)]
        unsafe fn layer(&self) -> Retained<CAMetalLayer>;
    }

    #[cfg(feature = "objc2-metal")]
    unsafe impl ProtocolType for dyn CAMetalDrawable {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CALayer")]
    pub struct CAMetalLayer;

    #[cfg(feature = "CALayer")]
    unsafe impl ClassType for CAMetalLayer {
        #[inherits(NSObject)]
        type Super = CALayer;
        type Mutability = InteriorMutable;
    }
);

#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
unsafe impl CAMediaTiming for CAMetalLayer {}

#[cfg(feature = "CALayer")]
unsafe impl NSCoding for CAMetalLayer {}

#[cfg(feature = "CALayer")]
unsafe impl NSObjectProtocol for CAMetalLayer {}

#[cfg(feature = "CALayer")]
unsafe impl NSSecureCoding for CAMetalLayer {}

extern_methods!(
    #[cfg(feature = "CALayer")]
    unsafe impl CAMetalLayer {
        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other device)]
        pub unsafe fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;

        #[cfg(feature = "objc2-metal")]
        #[method(setDevice:)]
        pub unsafe fn setDevice(&self, device: Option<&ProtocolObject<dyn MTLDevice>>);

        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other preferredDevice)]
        pub unsafe fn preferredDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;

        #[cfg(feature = "objc2-metal")]
        #[method(pixelFormat)]
        pub unsafe fn pixelFormat(&self) -> MTLPixelFormat;

        #[cfg(feature = "objc2-metal")]
        #[method(setPixelFormat:)]
        pub unsafe fn setPixelFormat(&self, pixel_format: MTLPixelFormat);

        #[method(framebufferOnly)]
        pub unsafe fn framebufferOnly(&self) -> bool;

        #[method(setFramebufferOnly:)]
        pub unsafe fn setFramebufferOnly(&self, framebuffer_only: bool);

        #[method(drawableSize)]
        pub unsafe fn drawableSize(&self) -> CGSize;

        #[method(setDrawableSize:)]
        pub unsafe fn setDrawableSize(&self, drawable_size: CGSize);

        #[cfg(feature = "objc2-metal")]
        #[method_id(@__retain_semantics Other nextDrawable)]
        pub unsafe fn nextDrawable(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDrawable>>>;

        #[method(maximumDrawableCount)]
        pub unsafe fn maximumDrawableCount(&self) -> NSUInteger;

        #[method(setMaximumDrawableCount:)]
        pub unsafe fn setMaximumDrawableCount(&self, maximum_drawable_count: NSUInteger);

        #[method(presentsWithTransaction)]
        pub unsafe fn presentsWithTransaction(&self) -> bool;

        #[method(setPresentsWithTransaction:)]
        pub unsafe fn setPresentsWithTransaction(&self, presents_with_transaction: bool);

        #[method(wantsExtendedDynamicRangeContent)]
        pub unsafe fn wantsExtendedDynamicRangeContent(&self) -> bool;

        #[method(setWantsExtendedDynamicRangeContent:)]
        pub unsafe fn setWantsExtendedDynamicRangeContent(
            &self,
            wants_extended_dynamic_range_content: bool,
        );

        #[cfg(feature = "CAEDRMetadata")]
        #[method_id(@__retain_semantics Other EDRMetadata)]
        pub unsafe fn EDRMetadata(&self) -> Option<Retained<CAEDRMetadata>>;

        #[cfg(feature = "CAEDRMetadata")]
        #[method(setEDRMetadata:)]
        pub unsafe fn setEDRMetadata(&self, edr_metadata: Option<&CAEDRMetadata>);

        #[method(displaySyncEnabled)]
        pub unsafe fn displaySyncEnabled(&self) -> bool;

        #[method(setDisplaySyncEnabled:)]
        pub unsafe fn setDisplaySyncEnabled(&self, display_sync_enabled: bool);

        #[method(allowsNextDrawableTimeout)]
        pub unsafe fn allowsNextDrawableTimeout(&self) -> bool;

        #[method(setAllowsNextDrawableTimeout:)]
        pub unsafe fn setAllowsNextDrawableTimeout(&self, allows_next_drawable_timeout: bool);

        #[method_id(@__retain_semantics Other developerHUDProperties)]
        pub unsafe fn developerHUDProperties(&self) -> Option<Retained<NSDictionary>>;

        #[method(setDeveloperHUDProperties:)]
        pub unsafe fn setDeveloperHUDProperties(
            &self,
            developer_hud_properties: Option<&NSDictionary>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `CALayer`
    #[cfg(feature = "CALayer")]
    unsafe impl CAMetalLayer {
        #[method_id(@__retain_semantics Other layer)]
        pub unsafe fn layer() -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithLayer:)]
        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "CALayer")]
    unsafe impl CAMetalLayer {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);