// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IDevice {
  fn as_device(Self) -> Device
  fn get_active_layout_index(Self) -> Int = _
  fn get_caps_lock_state(Self) -> Bool = _
  fn get_display(Self) -> Display = _
  fn get_has_cursor(Self) -> Bool = _
  fn get_modifier_state(Self) -> ModifierType = _
  fn get_name(Self) -> String = _
  fn get_num_lock_state(Self) -> Bool = _
  fn get_num_touches(Self) -> UInt = _
  fn get_product_id(Self) -> String? = _
  fn get_scroll_lock_state(Self) -> Bool = _
  fn get_source(Self) -> InputSource = _
  fn get_surface_at_position(Self) -> (Surface?, Double, Double) = _
  fn get_timestamp(Self) -> UInt = _
  fn get_vendor_id(Self) -> String? = _
  fn has_bidi_layouts(Self) -> Bool = _
  fn connect_changed(Self, (Device) -> Unit) -> UInt64 = _
}

///|
pub impl IDevice for Device with fn as_device(self) {
  self
}

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_display.html).
#borrow(self)
pub extern "c" fn Device::get_display(self : Device) -> Display = "moonbit_gdk_device_get_display"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_modifier_state.html).
pub fn Device::get_modifier_state(self : Device) -> ModifierType {
  ModifierType::from_int(moonbit_gdk_device_get_modifier_state(self))
}

///|
#borrow(self_)
extern "c" fn moonbit_gdk_device_get_name(self_ : Device) -> Bytes = "moonbit_gdk_device_get_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_name.html).
pub fn Device::get_name(self : Device) -> String {
  @encoding/utf8.decode_lossy(moonbit_gdk_device_get_name(self))
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_num_touches.html).
#borrow(self)
pub extern "c" fn Device::get_num_touches(self : Device) -> UInt = "moonbit_gdk_device_get_num_touches"

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_source.html).
#borrow(self)
pub extern "c" fn Device::get_source(self : Device) -> InputSource = "moonbit_gdk_device_get_source"

///|
#borrow(self_, win_x, win_y)
extern "c" fn moonbit_gdk_device_get_surface_at_position(
  self_ : Device,
  win_x : Ref[Double],
  win_y : Ref[Double],
) -> @glib.Nullable[Surface] = "moonbit_gdk_device_get_surface_at_position"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_surface_at_position.html).
pub fn Device::get_surface_at_position(
  self : Device,
) -> (Surface?, Double, Double) {
  let win_x = Ref(0.0)
  let win_y = Ref(0.0)
  let raw_result = moonbit_gdk_device_get_surface_at_position(
    self, win_x, win_y,
  )
  let result = raw_result.to_option()
  (result, win_x.val, win_y.val)
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/method.Device.get_timestamp.html).
#borrow(self)
pub extern "c" fn Device::get_timestamp(self : Device) -> UInt = "moonbit_gdk_device_get_timestamp"

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

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

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

///|
#borrow(instance)
extern "c" fn gdk_device_connect_changed(
  instance : Device,
  function : FuncRef[(Device, (Device) -> Unit) -> Unit],
  closure : (Device) -> Unit,
) -> UInt64 = "moonbit_gdk_device_connect_changed"

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/signal.Device.changed.html).
pub fn Device::connect_changed(self : Device, f : (Device) -> Unit) -> UInt64 {
  gdk_device_connect_changed(self, fn(instance_, f) { f(instance_) }, f)
}

///|
/// [Upstream documentation](https://docs.gtk.org/gdk4/property.Device.n-axes.html).
#borrow(self_)
pub extern "c" fn Device::get_n_axes(self_ : Device) -> UInt = "moonbit_gdk_device_get_n_axes"

///|
impl IDevice with fn get_active_layout_index(self) -> Int {
  self.as_device().get_active_layout_index()
}

///|
impl IDevice with fn get_caps_lock_state(self) -> Bool {
  self.as_device().get_caps_lock_state()
}

///|
impl IDevice with fn get_display(self) -> Display {
  self.as_device().get_display()
}

///|
impl IDevice with fn get_has_cursor(self) -> Bool {
  self.as_device().get_has_cursor()
}

///|
impl IDevice with fn get_modifier_state(self) -> ModifierType {
  self.as_device().get_modifier_state()
}

///|
impl IDevice with fn get_name(self) -> String {
  self.as_device().get_name()
}

///|
impl IDevice with fn get_num_lock_state(self) -> Bool {
  self.as_device().get_num_lock_state()
}

///|
impl IDevice with fn get_num_touches(self) -> UInt {
  self.as_device().get_num_touches()
}

///|
impl IDevice with fn get_product_id(self) -> String? {
  self.as_device().get_product_id()
}

///|
impl IDevice with fn get_scroll_lock_state(self) -> Bool {
  self.as_device().get_scroll_lock_state()
}

///|
impl IDevice with fn get_source(self) -> InputSource {
  self.as_device().get_source()
}

///|
impl IDevice with fn get_surface_at_position(self) -> (Surface?, Double, Double) {
  self.as_device().get_surface_at_position()
}

///|
impl IDevice with fn get_timestamp(self) -> UInt {
  self.as_device().get_timestamp()
}

///|
impl IDevice with fn get_vendor_id(self) -> String? {
  self.as_device().get_vendor_id()
}

///|
impl IDevice with fn has_bidi_layouts(self) -> Bool {
  self.as_device().has_bidi_layouts()
}

///|
impl IDevice with fn connect_changed(self, f) -> UInt64 {
  self.as_device().connect_changed(f)
}

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

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