//! 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::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenglview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    #[deprecated = "Please use MTKView instead."]
    pub struct NSOpenGLView;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSOpenGLView {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSOpenGLView {}
);

#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSOpenGLView {}
);

#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSOpenGLView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSCoding for NSOpenGLView {}
);

#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSOpenGLView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSOpenGLView {}
);

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSOpenGLView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSOpenGLView {
    extern_methods!(
        #[cfg(feature = "NSOpenGL")]
        #[unsafe(method(defaultPixelFormat))]
        #[unsafe(method_family = none)]
        pub fn defaultPixelFormat(mtm: MainThreadMarker) -> Retained<NSOpenGLPixelFormat>;

        #[cfg(feature = "NSOpenGL")]
        #[unsafe(method(initWithFrame:pixelFormat:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame_pixelFormat(
            this: Allocated<Self>,
            frame_rect: NSRect,
            format: Option<&NSOpenGLPixelFormat>,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSOpenGL")]
        #[unsafe(method(openGLContext))]
        #[unsafe(method_family = none)]
        pub fn openGLContext(&self) -> Option<Retained<NSOpenGLContext>>;

        #[cfg(feature = "NSOpenGL")]
        /// Setter for [`openGLContext`][Self::openGLContext].
        #[unsafe(method(setOpenGLContext:))]
        #[unsafe(method_family = none)]
        pub fn setOpenGLContext(&self, open_gl_context: Option<&NSOpenGLContext>);

        #[unsafe(method(clearGLContext))]
        #[unsafe(method_family = none)]
        pub fn clearGLContext(&self);

        #[unsafe(method(update))]
        #[unsafe(method_family = none)]
        pub fn update(&self);

        #[unsafe(method(reshape))]
        #[unsafe(method_family = none)]
        pub fn reshape(&self);

        #[cfg(feature = "NSOpenGL")]
        #[unsafe(method(pixelFormat))]
        #[unsafe(method_family = none)]
        pub fn pixelFormat(&self) -> Option<Retained<NSOpenGLPixelFormat>>;

        #[cfg(feature = "NSOpenGL")]
        /// Setter for [`pixelFormat`][Self::pixelFormat].
        #[unsafe(method(setPixelFormat:))]
        #[unsafe(method_family = none)]
        pub fn setPixelFormat(&self, pixel_format: Option<&NSOpenGLPixelFormat>);

        #[unsafe(method(prepareOpenGL))]
        #[unsafe(method_family = none)]
        pub fn prepareOpenGL(&self);

        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
        #[unsafe(method(wantsBestResolutionOpenGLSurface))]
        #[unsafe(method_family = none)]
        pub fn wantsBestResolutionOpenGLSurface(&self) -> bool;

        /// Setter for [`wantsBestResolutionOpenGLSurface`][Self::wantsBestResolutionOpenGLSurface].
        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
        #[unsafe(method(setWantsBestResolutionOpenGLSurface:))]
        #[unsafe(method_family = none)]
        pub fn setWantsBestResolutionOpenGLSurface(
            &self,
            wants_best_resolution_open_gl_surface: bool,
        );

        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
        #[unsafe(method(wantsExtendedDynamicRangeOpenGLSurface))]
        #[unsafe(method_family = none)]
        pub fn wantsExtendedDynamicRangeOpenGLSurface(&self) -> bool;

        /// Setter for [`wantsExtendedDynamicRangeOpenGLSurface`][Self::wantsExtendedDynamicRangeOpenGLSurface].
        #[deprecated = "OpenGL API deprecated; please use Metal and MetalKit.  (Define GL_SILENCE_DEPRECATION to silence these warnings.)"]
        #[unsafe(method(setWantsExtendedDynamicRangeOpenGLSurface:))]
        #[unsafe(method_family = none)]
        pub fn setWantsExtendedDynamicRangeOpenGLSurface(
            &self,
            wants_extended_dynamic_range_open_gl_surface: bool,
        );
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSOpenGLView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSOpenGLView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSOpenGLView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// NSOpenGLSurfaceResolution.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSView {
    extern_methods!(
        #[deprecated = "Use NSOpenGLView instead."]
        #[unsafe(method(wantsBestResolutionOpenGLSurface))]
        #[unsafe(method_family = none)]
        pub fn wantsBestResolutionOpenGLSurface(&self) -> bool;

        /// Setter for [`wantsBestResolutionOpenGLSurface`][Self::wantsBestResolutionOpenGLSurface].
        #[deprecated = "Use NSOpenGLView instead."]
        #[unsafe(method(setWantsBestResolutionOpenGLSurface:))]
        #[unsafe(method_family = none)]
        pub fn setWantsBestResolutionOpenGLSurface(
            &self,
            wants_best_resolution_open_gl_surface: bool,
        );
    );
}

/// NSExtendedDynamicRange.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSView {
    extern_methods!(
        #[deprecated = "Use NSOpenGLView instead."]
        #[unsafe(method(wantsExtendedDynamicRangeOpenGLSurface))]
        #[unsafe(method_family = none)]
        pub fn wantsExtendedDynamicRangeOpenGLSurface(&self) -> bool;

        /// Setter for [`wantsExtendedDynamicRangeOpenGLSurface`][Self::wantsExtendedDynamicRangeOpenGLSurface].
        #[deprecated = "Use NSOpenGLView instead."]
        #[unsafe(method(setWantsExtendedDynamicRangeOpenGLSurface:))]
        #[unsafe(method_family = none)]
        pub fn setWantsExtendedDynamicRangeOpenGLSurface(
            &self,
            wants_extended_dynamic_range_open_gl_surface: bool,
        );
    );
}
