// GENERATED — DO NOT EDIT

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

///|
pub(open) trait INative {
  fn as_native(Self) -> Native
  fn get_surface(Self) -> @gdk.Surface? = _
  fn get_surface_transform(Self) -> (Double, Double) = _
  fn realize(Self) -> Unit = _
  fn unrealize(Self) -> Unit = _
}

///|
pub impl INative for Native with fn as_native(self) {
  self
}

///|
#borrow(surface)
extern "c" fn moonbit_gtk_native_get_for_surface(
  surface : @gdk.Surface,
) -> @glib.Nullable[Native] = "moonbit_gtk_native_get_for_surface"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/type_func.Native.get_for_surface.html).
pub fn Native::get_for_surface(surface : &@gdk.ISurface) -> Native? {
  let raw_result = moonbit_gtk_native_get_for_surface(surface.as_surface())
  raw_result.to_option()
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Native.get_surface.html).
pub fn Native::get_surface(self : Native) -> @gdk.Surface? {
  let raw_result = moonbit_gtk_native_get_surface(self)
  raw_result.to_option()
}

///|
#borrow(self_, x, y)
extern "c" fn moonbit_gtk_native_get_surface_transform(
  self_ : Native,
  x : Ref[Double],
  y : Ref[Double],
) = "moonbit_gtk_native_get_surface_transform"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Native.get_surface_transform.html).
pub fn Native::get_surface_transform(self : Native) -> (Double, Double) {
  let x = Ref(0.0)
  let y = Ref(0.0)
  moonbit_gtk_native_get_surface_transform(self, x, y)
  (x.val, y.val)
}

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

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

///|
impl INative with fn get_surface(self) -> @gdk.Surface? {
  self.as_native().get_surface()
}

///|
impl INative with fn get_surface_transform(self) -> (Double, Double) {
  self.as_native().get_surface_transform()
}

///|
impl INative with fn realize(self) -> Unit {
  self.as_native().realize()
}

///|
impl INative with fn unrealize(self) -> Unit {
  self.as_native().unrealize()
}

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

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