objc2-open-gl-es 0.3.2

Bindings to the OpenGLES framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/opengles/eagl_major_version?language=objc)
pub const EAGL_MAJOR_VERSION: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/opengles/eagl_minor_version?language=objc)
pub const EAGL_MINOR_VERSION: c_uint = 0;
/// *********************************************************************
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/opengles/eaglrenderingapi?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct EAGLRenderingAPI(pub NSUInteger);
impl EAGLRenderingAPI {
    #[doc(alias = "kEAGLRenderingAPIOpenGLES1")]
    pub const OpenGLES1: Self = Self(1);
    #[doc(alias = "kEAGLRenderingAPIOpenGLES2")]
    pub const OpenGLES2: Self = Self(2);
    #[doc(alias = "kEAGLRenderingAPIOpenGLES3")]
    pub const OpenGLES3: Self = Self(3);
}

unsafe impl Encode for EAGLRenderingAPI {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for EAGLRenderingAPI {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C-unwind" {
    /// *********************************************************************
    ///
    /// # Safety
    ///
    /// - `major` must be a valid pointer.
    /// - `minor` must be a valid pointer.
    pub fn EAGLGetVersion(major: NonNull<c_uint>, minor: NonNull<c_uint>);
}

extern_class!(
    /// *********************************************************************
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/opengles/eaglsharegroup?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct EAGLSharegroup;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for EAGLSharegroup {}
);

impl EAGLSharegroup {
    extern_methods!(
        #[unsafe(method(debugLabel))]
        #[unsafe(method_family = none)]
        pub unsafe fn debugLabel(&self) -> Option<Retained<NSString>>;

        /// Setter for [`debugLabel`][Self::debugLabel].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setDebugLabel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDebugLabel(&self, debug_label: Option<&NSString>);
    );
}

/// Methods declared on superclass `NSObject`.
impl EAGLSharegroup {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// *********************************************************************
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/opengles/eaglcontext?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct EAGLContext;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for EAGLContext {}
);

impl EAGLContext {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;

        #[unsafe(method(initWithAPI:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAPI(
            this: Allocated<Self>,
            api: EAGLRenderingAPI,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(initWithAPI:sharegroup:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAPI_sharegroup(
            this: Allocated<Self>,
            api: EAGLRenderingAPI,
            sharegroup: &EAGLSharegroup,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(setCurrentContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCurrentContext(context: Option<&EAGLContext>) -> bool;

        #[unsafe(method(currentContext))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentContext() -> Option<Retained<EAGLContext>>;

        #[unsafe(method(API))]
        #[unsafe(method_family = none)]
        pub unsafe fn API(&self) -> EAGLRenderingAPI;

        #[unsafe(method(sharegroup))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharegroup(&self) -> Retained<EAGLSharegroup>;

        #[unsafe(method(debugLabel))]
        #[unsafe(method_family = none)]
        pub unsafe fn debugLabel(&self) -> Option<Retained<NSString>>;

        /// Setter for [`debugLabel`][Self::debugLabel].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setDebugLabel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDebugLabel(&self, debug_label: Option<&NSString>);

        #[unsafe(method(isMultiThreaded))]
        #[unsafe(method_family = none)]
        pub unsafe fn isMultiThreaded(&self) -> bool;

        /// Setter for [`isMultiThreaded`][Self::isMultiThreaded].
        #[unsafe(method(setMultiThreaded:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMultiThreaded(&self, multi_threaded: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl EAGLContext {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}