// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ICursor {
  fn as_cursor(Self) -> Cursor
  fn get_fallback(Self) -> Cursor? = _
  fn get_hotspot_x(Self) -> Int = _
  fn get_hotspot_y(Self) -> Int = _
  fn get_name(Self) -> String? = _
  fn get_texture(Self) -> Texture? = _
}

///|
pub impl ICursor for Cursor with fn as_cursor(self) {
  self
}

///|
#borrow(name, fallback)
extern "c" fn moonbit_gdk_cursor_new_from_name(
  name : Bytes,
  fallback : @glib.Nullable[Cursor],
) -> @glib.Nullable[Cursor] = "moonbit_gdk_cursor_new_from_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/ctor.Cursor.new_from_name.html).
pub fn Cursor::new_from_name(name : String, fallback : &ICursor?) -> Cursor? {
  let raw_result = moonbit_gdk_cursor_new_from_name(
    @encoding/utf8.encode(name),
    match fallback {
      Some(v) => @glib.Nullable::some(v.as_cursor())
      None => @glib.Nullable::null()
    },
  )
  raw_result.to_option()
}

///|
#borrow(texture, fallback)
extern "c" fn moonbit_gdk_cursor_new_from_texture(
  texture : Texture,
  hotspot_x : Int,
  hotspot_y : Int,
  fallback : @glib.Nullable[Cursor],
) -> Cursor = "moonbit_gdk_cursor_new_from_texture"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/ctor.Cursor.new_from_texture.html).
pub fn Cursor::new_from_texture(
  texture : &ITexture,
  hotspot_x : Int,
  hotspot_y : Int,
  fallback : &ICursor?,
) -> Cursor {
  moonbit_gdk_cursor_new_from_texture(
    texture.as_texture(),
    hotspot_x,
    hotspot_y,
    match fallback {
      Some(v) => @glib.Nullable::some(v.as_cursor())
      None => @glib.Nullable::null()
    },
  )
}

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Cursor.get_hotspot_x.html).
#borrow(self)
pub extern "c" fn Cursor::get_hotspot_x(self : Cursor) -> Int = "moonbit_gdk_cursor_get_hotspot_x"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Cursor.get_hotspot_y.html).
#borrow(self)
pub extern "c" fn Cursor::get_hotspot_y(self : Cursor) -> Int = "moonbit_gdk_cursor_get_hotspot_y"

///|
#borrow(self_)
extern "c" fn moonbit_gdk_cursor_get_name(
  self_ : Cursor,
) -> @glib.Nullable[Bytes] = "moonbit_gdk_cursor_get_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Cursor.get_name.html).
pub fn Cursor::get_name(self : Cursor) -> String? {
  let result = moonbit_gdk_cursor_get_name(self)
  match result.to_option() {
    Some(bytes) => Some(@encoding/utf8.decode_lossy(bytes))
    None => None
  }
}

///|
#borrow(self_)
extern "c" fn moonbit_gdk_cursor_get_texture(
  self_ : Cursor,
) -> @glib.Nullable[Texture] = "moonbit_gdk_cursor_get_texture"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Cursor.get_texture.html).
pub fn Cursor::get_texture(self : Cursor) -> Texture? {
  let raw_result = moonbit_gdk_cursor_get_texture(self)
  raw_result.to_option()
}

///|
impl ICursor with fn get_fallback(self) -> Cursor? {
  self.as_cursor().get_fallback()
}

///|
impl ICursor with fn get_hotspot_x(self) -> Int {
  self.as_cursor().get_hotspot_x()
}

///|
impl ICursor with fn get_hotspot_y(self) -> Int {
  self.as_cursor().get_hotspot_y()
}

///|
impl ICursor with fn get_name(self) -> String? {
  self.as_cursor().get_name()
}

///|
impl ICursor with fn get_texture(self) -> Texture? {
  self.as_cursor().get_texture()
}

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

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