// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IGLArea {
  fn as_gl_area(Self) -> GLArea
  fn attach_buffers(Self) -> Unit = _
  fn get_allowed_apis(Self) -> @gdk.GLAPI = _
  fn get_api(Self) -> @gdk.GLAPI = _
  fn get_auto_render(Self) -> Bool = _
  fn get_context(Self) -> @gdk.GLContext? = _
  fn get_has_depth_buffer(Self) -> Bool = _
  fn get_has_stencil_buffer(Self) -> Bool = _
  fn get_required_version(Self) -> (Int, Int) = _
  fn make_current(Self) -> Unit = _
  fn queue_render(Self) -> Unit = _
  fn set_allowed_apis(Self, @gdk.GLAPI) -> Unit = _
  fn set_auto_render(Self, Bool) -> Unit = _
  fn set_has_depth_buffer(Self, Bool) -> Unit = _
  fn set_has_stencil_buffer(Self, Bool) -> Unit = _
  fn set_required_version(Self, Int, Int) -> Unit = _
  fn connect_render(Self, (GLArea, @gdk.GLContext) -> Bool) -> UInt64 = _
  fn connect_resize(Self, (GLArea, Int, Int) -> Unit) -> UInt64 = _
}

///|
pub impl IGLArea for GLArea with fn as_gl_area(self) {
  self
}

///|
/// Implementation contract for GLArea.resize. Self is the retained MoonBit state; the second parameter is the invoked GLArea object.
pub(open) trait VGLAreaResize {
  fn resize(Self, GLArea, Int, Int) -> Unit
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.GLArea.new.html).
pub extern "c" fn GLArea::new() -> GLArea = "moonbit_gtk_gl_area_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.attach_buffers.html).
#borrow(self)
pub extern "c" fn GLArea::attach_buffers(self : GLArea) = "moonbit_gtk_gl_area_attach_buffers"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.get_allowed_apis.html).
pub fn GLArea::get_allowed_apis(self : GLArea) -> @gdk.GLAPI {
  @gdk.GLAPI::from_int(moonbit_gtk_gl_area_get_allowed_apis(self))
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.get_api.html).
pub fn GLArea::get_api(self : GLArea) -> @gdk.GLAPI {
  @gdk.GLAPI::from_int(moonbit_gtk_gl_area_get_api(self))
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.get_auto_render.html).
#borrow(self)
pub extern "c" fn GLArea::get_auto_render(self : GLArea) -> Bool = "moonbit_gtk_gl_area_get_auto_render"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.get_context.html).
pub fn GLArea::get_context(self : GLArea) -> @gdk.GLContext? {
  let raw_result = moonbit_gtk_gl_area_get_context(self)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.get_has_depth_buffer.html).
#borrow(self)
pub extern "c" fn GLArea::get_has_depth_buffer(self : GLArea) -> Bool = "moonbit_gtk_gl_area_get_has_depth_buffer"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.get_has_stencil_buffer.html).
#borrow(self)
pub extern "c" fn GLArea::get_has_stencil_buffer(self : GLArea) -> Bool = "moonbit_gtk_gl_area_get_has_stencil_buffer"

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.queue_render.html).
#borrow(self)
pub extern "c" fn GLArea::queue_render(self : GLArea) = "moonbit_gtk_gl_area_queue_render"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.set_allowed_apis.html).
pub fn GLArea::set_allowed_apis(self : GLArea, apis : @gdk.GLAPI) -> Unit {
  moonbit_gtk_gl_area_set_allowed_apis(self, apis.to_int())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.set_auto_render.html).
#borrow(self)
pub extern "c" fn GLArea::set_auto_render(self : GLArea, auto_render : Bool) = "moonbit_gtk_gl_area_set_auto_render"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.set_has_depth_buffer.html).
#borrow(self)
pub extern "c" fn GLArea::set_has_depth_buffer(
  self : GLArea,
  has_depth_buffer : Bool,
) = "moonbit_gtk_gl_area_set_has_depth_buffer"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.GLArea.set_has_stencil_buffer.html).
#borrow(self)
pub extern "c" fn GLArea::set_has_stencil_buffer(
  self : GLArea,
  has_stencil_buffer : Bool,
) = "moonbit_gtk_gl_area_set_has_stencil_buffer"

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

///|
#borrow(instance)
extern "c" fn gtk_gl_area_connect_render(
  instance : GLArea,
  function : FuncRef[
    (GLArea, @gdk.GLContext, (GLArea, @gdk.GLContext) -> Bool) -> Bool,
  ],
  closure : (GLArea, @gdk.GLContext) -> Bool,
) -> UInt64 = "moonbit_gtk_gl_area_connect_render"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.GLArea.render.html).
pub fn GLArea::connect_render(
  self : GLArea,
  f : (GLArea, @gdk.GLContext) -> Bool,
) -> UInt64 {
  gtk_gl_area_connect_render(
    self,
    fn(instance_, context, f) { f(instance_, context) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_gl_area_connect_resize(
  instance : GLArea,
  function : FuncRef[(GLArea, Int, Int, (GLArea, Int, Int) -> Unit) -> Unit],
  closure : (GLArea, Int, Int) -> Unit,
) -> UInt64 = "moonbit_gtk_gl_area_connect_resize"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.GLArea.resize.html).
pub fn GLArea::connect_resize(
  self : GLArea,
  f : (GLArea, Int, Int) -> Unit,
) -> UInt64 {
  gtk_gl_area_connect_resize(
    self,
    fn(instance_, width, height, f) { f(instance_, width, height) },
    f,
  )
}

///|
impl IGLArea with fn attach_buffers(self) -> Unit {
  self.as_gl_area().attach_buffers()
}

///|
impl IGLArea with fn get_allowed_apis(self) -> @gdk.GLAPI {
  self.as_gl_area().get_allowed_apis()
}

///|
impl IGLArea with fn get_api(self) -> @gdk.GLAPI {
  self.as_gl_area().get_api()
}

///|
impl IGLArea with fn get_auto_render(self) -> Bool {
  self.as_gl_area().get_auto_render()
}

///|
impl IGLArea with fn get_context(self) -> @gdk.GLContext? {
  self.as_gl_area().get_context()
}

///|
impl IGLArea with fn get_has_depth_buffer(self) -> Bool {
  self.as_gl_area().get_has_depth_buffer()
}

///|
impl IGLArea with fn get_has_stencil_buffer(self) -> Bool {
  self.as_gl_area().get_has_stencil_buffer()
}

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

///|
impl IGLArea with fn make_current(self) -> Unit {
  self.as_gl_area().make_current()
}

///|
impl IGLArea with fn queue_render(self) -> Unit {
  self.as_gl_area().queue_render()
}

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

///|
impl IGLArea with fn set_auto_render(self, auto_render) -> Unit {
  self.as_gl_area().set_auto_render(auto_render)
}

///|
impl IGLArea with fn set_has_depth_buffer(self, has_depth_buffer) -> Unit {
  self.as_gl_area().set_has_depth_buffer(has_depth_buffer)
}

///|
impl IGLArea with fn set_has_stencil_buffer(self, has_stencil_buffer) -> Unit {
  self.as_gl_area().set_has_stencil_buffer(has_stencil_buffer)
}

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

///|
impl IGLArea with fn connect_render(self, f) -> UInt64 {
  self.as_gl_area().connect_render(f)
}

///|
impl IGLArea with fn connect_resize(self, f) -> UInt64 {
  self.as_gl_area().connect_resize(f)
}

///|
pub fn GLArea::as_widget(self : GLArea) -> Widget = "%identity"

///|
pub impl IWidget for GLArea with fn as_widget(self) {
  self.as_widget()
}

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

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