objc2_open_gl_es/generated/
EAGL.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
10/// [Apple's documentation](https://developer.apple.com/documentation/opengles/eagl_major_version?language=objc)
11pub const EAGL_MAJOR_VERSION: c_uint = 1;
12/// [Apple's documentation](https://developer.apple.com/documentation/opengles/eagl_minor_version?language=objc)
13pub const EAGL_MINOR_VERSION: c_uint = 0;
14/// *********************************************************************
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/opengles/eaglrenderingapi?language=objc)
17// NS_ENUM
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct EAGLRenderingAPI(pub NSUInteger);
21impl EAGLRenderingAPI {
22    #[doc(alias = "kEAGLRenderingAPIOpenGLES1")]
23    pub const OpenGLES1: Self = Self(1);
24    #[doc(alias = "kEAGLRenderingAPIOpenGLES2")]
25    pub const OpenGLES2: Self = Self(2);
26    #[doc(alias = "kEAGLRenderingAPIOpenGLES3")]
27    pub const OpenGLES3: Self = Self(3);
28}
29
30unsafe impl Encode for EAGLRenderingAPI {
31    const ENCODING: Encoding = NSUInteger::ENCODING;
32}
33
34unsafe impl RefEncode for EAGLRenderingAPI {
35    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern "C-unwind" {
39    /// *********************************************************************
40    ///
41    /// # Safety
42    ///
43    /// - `major` must be a valid pointer.
44    /// - `minor` must be a valid pointer.
45    pub fn EAGLGetVersion(major: NonNull<c_uint>, minor: NonNull<c_uint>);
46}
47
48extern_class!(
49    /// *********************************************************************
50    ///
51    /// See also [Apple's documentation](https://developer.apple.com/documentation/opengles/eaglsharegroup?language=objc)
52    #[unsafe(super(NSObject))]
53    #[derive(Debug, PartialEq, Eq, Hash)]
54    pub struct EAGLSharegroup;
55);
56
57extern_conformance!(
58    unsafe impl NSObjectProtocol for EAGLSharegroup {}
59);
60
61impl EAGLSharegroup {
62    extern_methods!(
63        #[unsafe(method(debugLabel))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn debugLabel(&self) -> Option<Retained<NSString>>;
66
67        /// Setter for [`debugLabel`][Self::debugLabel].
68        ///
69        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
70        #[unsafe(method(setDebugLabel:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setDebugLabel(&self, debug_label: Option<&NSString>);
73    );
74}
75
76/// Methods declared on superclass `NSObject`.
77impl EAGLSharegroup {
78    extern_methods!(
79        #[unsafe(method(init))]
80        #[unsafe(method_family = init)]
81        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
82
83        #[unsafe(method(new))]
84        #[unsafe(method_family = new)]
85        pub unsafe fn new() -> Retained<Self>;
86    );
87}
88
89extern_class!(
90    /// *********************************************************************
91    ///
92    /// See also [Apple's documentation](https://developer.apple.com/documentation/opengles/eaglcontext?language=objc)
93    #[unsafe(super(NSObject))]
94    #[derive(Debug, PartialEq, Eq, Hash)]
95    pub struct EAGLContext;
96);
97
98extern_conformance!(
99    unsafe impl NSObjectProtocol for EAGLContext {}
100);
101
102impl EAGLContext {
103    extern_methods!(
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
107
108        #[unsafe(method(initWithAPI:))]
109        #[unsafe(method_family = init)]
110        pub unsafe fn initWithAPI(
111            this: Allocated<Self>,
112            api: EAGLRenderingAPI,
113        ) -> Option<Retained<Self>>;
114
115        #[unsafe(method(initWithAPI:sharegroup:))]
116        #[unsafe(method_family = init)]
117        pub unsafe fn initWithAPI_sharegroup(
118            this: Allocated<Self>,
119            api: EAGLRenderingAPI,
120            sharegroup: &EAGLSharegroup,
121        ) -> Option<Retained<Self>>;
122
123        #[unsafe(method(setCurrentContext:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setCurrentContext(context: Option<&EAGLContext>) -> bool;
126
127        #[unsafe(method(currentContext))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn currentContext() -> Option<Retained<EAGLContext>>;
130
131        #[unsafe(method(API))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn API(&self) -> EAGLRenderingAPI;
134
135        #[unsafe(method(sharegroup))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn sharegroup(&self) -> Retained<EAGLSharegroup>;
138
139        #[unsafe(method(debugLabel))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn debugLabel(&self) -> Option<Retained<NSString>>;
142
143        /// Setter for [`debugLabel`][Self::debugLabel].
144        ///
145        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
146        #[unsafe(method(setDebugLabel:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setDebugLabel(&self, debug_label: Option<&NSString>);
149
150        #[unsafe(method(isMultiThreaded))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn isMultiThreaded(&self) -> bool;
153
154        /// Setter for [`isMultiThreaded`][Self::isMultiThreaded].
155        #[unsafe(method(setMultiThreaded:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setMultiThreaded(&self, multi_threaded: bool);
158    );
159}
160
161/// Methods declared on superclass `NSObject`.
162impl EAGLContext {
163    extern_methods!(
164        #[unsafe(method(new))]
165        #[unsafe(method_family = new)]
166        pub unsafe fn new() -> Retained<Self>;
167    );
168}