// GENERATED — DO NOT EDIT

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/class.GLContext.html).
pub type GLContext

///|
pub(open) trait IGLContext {
  fn as_gl_context(Self) -> GLContext
  fn get_allowed_apis(Self) -> GLAPI = _
  fn get_api(Self) -> GLAPI = _
  fn get_debug_enabled(Self) -> Bool = _
  fn get_display(Self) -> Display? = _
  fn get_forward_compatible(Self) -> Bool = _
  fn get_required_version(Self) -> (Int, Int) = _
  fn get_surface(Self) -> Surface? = _
  fn get_use_es(Self) -> Bool = _
  fn get_version(Self) -> (Int, Int) = _
  fn is_legacy(Self) -> Bool = _
  fn is_shared(Self, &IGLContext) -> Bool = _
  fn make_current(Self) -> Unit = _
  fn realize(Self) -> Bool raise @glib.Error_ = _
  fn set_allowed_apis(Self, GLAPI) -> Unit = _
  fn set_debug_enabled(Self, Bool) -> Unit = _
  fn set_forward_compatible(Self, Bool) -> Unit = _
  fn set_required_version(Self, Int, Int) -> Unit = _
  fn set_use_es(Self, Int) -> Unit = _
}

///|
pub impl IGLContext for GLContext with fn as_gl_context(self) {
  self
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/type_func.GLContext.clear_current.html).
pub extern "c" fn GLContext::clear_current() -> Unit = "moonbit_gdk_gl_context_clear_current"

///|
extern "c" fn moonbit_gdk_gl_context_get_current() -> @glib.Nullable[GLContext] = "moonbit_gdk_gl_context_get_current"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/type_func.GLContext.get_current.html).
pub fn GLContext::get_current() -> GLContext? {
  let raw_result = moonbit_gdk_gl_context_get_current()
  raw_result.to_option()
}

///|
#borrow(self_)
extern "c" fn moonbit_gdk_gl_context_get_allowed_apis(self_ : GLContext) -> Int = "moonbit_gdk_gl_context_get_allowed_apis"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_allowed_apis.html).
pub fn GLContext::get_allowed_apis(self : GLContext) -> GLAPI {
  GLAPI::from_int(moonbit_gdk_gl_context_get_allowed_apis(self))
}

///|
#borrow(self_)
extern "c" fn moonbit_gdk_gl_context_get_api(self_ : GLContext) -> Int = "moonbit_gdk_gl_context_get_api"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_api.html).
pub fn GLContext::get_api(self : GLContext) -> GLAPI {
  GLAPI::from_int(moonbit_gdk_gl_context_get_api(self))
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_debug_enabled.html).
#borrow(self)
pub extern "c" fn GLContext::get_debug_enabled(self : GLContext) -> Bool = "moonbit_gdk_gl_context_get_debug_enabled"

///|
#borrow(self_)
extern "c" fn moonbit_gdk_gl_context_get_display(
  self_ : GLContext,
) -> @glib.Nullable[Display] = "moonbit_gdk_gl_context_get_display"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_display.html).
pub fn GLContext::get_display(self : GLContext) -> Display? {
  let raw_result = moonbit_gdk_gl_context_get_display(self)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_forward_compatible.html).
#borrow(self)
pub extern "c" fn GLContext::get_forward_compatible(self : GLContext) -> Bool = "moonbit_gdk_gl_context_get_forward_compatible"

///|
#borrow(self_, major, minor)
extern "c" fn moonbit_gdk_gl_context_get_required_version(
  self_ : GLContext,
  major : Ref[Int],
  minor : Ref[Int],
) = "moonbit_gdk_gl_context_get_required_version"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_required_version.html).
pub fn GLContext::get_required_version(self : GLContext) -> (Int, Int) {
  let major = Ref(0)
  let minor = Ref(0)
  moonbit_gdk_gl_context_get_required_version(self, major, minor)
  (major.val, minor.val)
}

///|
#borrow(self_)
extern "c" fn moonbit_gdk_gl_context_get_surface(
  self_ : GLContext,
) -> @glib.Nullable[Surface] = "moonbit_gdk_gl_context_get_surface"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_surface.html).
pub fn GLContext::get_surface(self : GLContext) -> Surface? {
  let raw_result = moonbit_gdk_gl_context_get_surface(self)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_use_es.html).
#borrow(self)
pub extern "c" fn GLContext::get_use_es(self : GLContext) -> Bool = "moonbit_gdk_gl_context_get_use_es"

///|
#borrow(self_, major, minor)
extern "c" fn moonbit_gdk_gl_context_get_version(
  self_ : GLContext,
  major : Ref[Int],
  minor : Ref[Int],
) = "moonbit_gdk_gl_context_get_version"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.get_version.html).
pub fn GLContext::get_version(self : GLContext) -> (Int, Int) {
  let major = Ref(0)
  let minor = Ref(0)
  moonbit_gdk_gl_context_get_version(self, major, minor)
  (major.val, minor.val)
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.is_legacy.html).
#borrow(self)
pub extern "c" fn GLContext::is_legacy(self : GLContext) -> Bool = "moonbit_gdk_gl_context_is_legacy"

///|
#borrow(self_, other)
extern "c" fn moonbit_gdk_gl_context_is_shared(
  self_ : GLContext,
  other : GLContext,
) -> Bool = "moonbit_gdk_gl_context_is_shared"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.is_shared.html).
pub fn GLContext::is_shared(self : GLContext, other : &IGLContext) -> Bool {
  moonbit_gdk_gl_context_is_shared(self, other.as_gl_context())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.make_current.html).
#borrow(self)
pub extern "c" fn GLContext::make_current(self : GLContext) = "moonbit_gdk_gl_context_make_current"

///|
#borrow(self_, error)
extern "c" fn moonbit_gdk_gl_context_realize(
  self_ : GLContext,
  error : Ref[@glib.Nullable[@glib.Error_]],
) -> Bool = "moonbit_gdk_gl_context_realize"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.realize.html).
pub fn GLContext::realize(self : GLContext) -> Bool raise @glib.Error_ {
  let error_ : Ref[@glib.Nullable[@glib.Error_]] = Ref(@glib.Nullable::null())
  let result = moonbit_gdk_gl_context_realize(self, error_)
  match error_.val.to_option() {
    Some(e) => raise e
    None => ()
  }
  result
}

///|
#borrow(self_)
extern "c" fn moonbit_gdk_gl_context_set_allowed_apis(
  self_ : GLContext,
  apis : Int,
) = "moonbit_gdk_gl_context_set_allowed_apis"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.set_allowed_apis.html).
pub fn GLContext::set_allowed_apis(self : GLContext, apis : GLAPI) -> Unit {
  moonbit_gdk_gl_context_set_allowed_apis(self, apis.to_int())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.set_debug_enabled.html).
#borrow(self)
pub extern "c" fn GLContext::set_debug_enabled(
  self : GLContext,
  enabled : Bool,
) = "moonbit_gdk_gl_context_set_debug_enabled"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.set_forward_compatible.html).
#borrow(self)
pub extern "c" fn GLContext::set_forward_compatible(
  self : GLContext,
  compatible : Bool,
) = "moonbit_gdk_gl_context_set_forward_compatible"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.set_required_version.html).
#borrow(self)
pub extern "c" fn GLContext::set_required_version(
  self : GLContext,
  major : Int,
  minor : Int,
) = "moonbit_gdk_gl_context_set_required_version"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.GLContext.set_use_es.html).
#borrow(self)
pub extern "c" fn GLContext::set_use_es(self : GLContext, use_es : Int) = "moonbit_gdk_gl_context_set_use_es"

///|
impl IGLContext with fn get_allowed_apis(self) -> GLAPI {
  self.as_gl_context().get_allowed_apis()
}

///|
impl IGLContext with fn get_api(self) -> GLAPI {
  self.as_gl_context().get_api()
}

///|
impl IGLContext with fn get_debug_enabled(self) -> Bool {
  self.as_gl_context().get_debug_enabled()
}

///|
impl IGLContext with fn get_display(self) -> Display? {
  self.as_gl_context().get_display()
}

///|
impl IGLContext with fn get_forward_compatible(self) -> Bool {
  self.as_gl_context().get_forward_compatible()
}

///|
impl IGLContext with fn get_required_version(self) -> (Int, Int) {
  self.as_gl_context().get_required_version()
}

///|
impl IGLContext with fn get_surface(self) -> Surface? {
  self.as_gl_context().get_surface()
}

///|
impl IGLContext with fn get_use_es(self) -> Bool {
  self.as_gl_context().get_use_es()
}

///|
impl IGLContext with fn get_version(self) -> (Int, Int) {
  self.as_gl_context().get_version()
}

///|
impl IGLContext with fn is_legacy(self) -> Bool {
  self.as_gl_context().is_legacy()
}

///|
impl IGLContext with fn is_shared(self, other) -> Bool {
  self.as_gl_context().is_shared(other)
}

///|
impl IGLContext with fn make_current(self) -> Unit {
  self.as_gl_context().make_current()
}

///|
impl IGLContext with fn realize(self) -> Bool raise @glib.Error_ {
  self.as_gl_context().realize()
}

///|
impl IGLContext with fn set_allowed_apis(self, apis) -> Unit {
  self.as_gl_context().set_allowed_apis(apis)
}

///|
impl IGLContext with fn set_debug_enabled(self, enabled) -> Unit {
  self.as_gl_context().set_debug_enabled(enabled)
}

///|
impl IGLContext with fn set_forward_compatible(self, compatible) -> Unit {
  self.as_gl_context().set_forward_compatible(compatible)
}

///|
impl IGLContext with fn set_required_version(self, major, minor) -> Unit {
  self.as_gl_context().set_required_version(major, minor)
}

///|
impl IGLContext with fn set_use_es(self, use_es) -> Unit {
  self.as_gl_context().set_use_es(use_es)
}

///|
pub fn GLContext::as_gobject_object(self : GLContext) -> @gobject.Object = "%identity"

///|
pub impl @gobject.IObject for GLContext with fn as_object(self) {
  self.as_gobject_object()
}