// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IFileMonitor {
  fn as_file_monitor(Self) -> FileMonitor
  fn cancel(Self) -> Bool = _
  fn emit_event(Self, &IFile, &IFile?, FileMonitorEvent) -> Unit = _
  fn is_cancelled(Self) -> Bool = _
  fn set_rate_limit(Self, Int) -> Unit = _
  fn connect_changed(Self, (FileMonitor, File, File?, FileMonitorEvent) -> Unit) -> UInt64 = _
}

///|
pub impl IFileMonitor for FileMonitor with fn as_file_monitor(self) {
  self
}

///|
/// Implementation contract for FileMonitor.changed. Self is the retained MoonBit state; the second parameter is the invoked FileMonitor object.
pub(open) trait VFileMonitorChanged {
  fn changed(Self, FileMonitor, &IFile, &IFile, FileMonitorEvent) -> Unit
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileMonitor.cancel.html).
#borrow(self)
pub extern "c" fn FileMonitor::cancel(self : FileMonitor) -> Bool = "moonbit_g_file_monitor_cancel"

///|
#borrow(self_, child, other_file)
extern "c" fn moonbit_g_file_monitor_emit_event(
  self_ : FileMonitor,
  child : File,
  other_file : @glib.Nullable[File],
  event_type : FileMonitorEvent,
) = "moonbit_g_file_monitor_emit_event"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileMonitor.emit_event.html).
pub fn FileMonitor::emit_event(
  self : FileMonitor,
  child : &IFile,
  other_file : &IFile?,
  event_type : FileMonitorEvent,
) -> Unit {
  moonbit_g_file_monitor_emit_event(
    self,
    child.as_file(),
    match other_file {
      Some(v) => @glib.Nullable::some(v.as_file())
      None => @glib.Nullable::null()
    },
    event_type,
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileMonitor.is_cancelled.html).
#borrow(self)
pub extern "c" fn FileMonitor::is_cancelled(self : FileMonitor) -> Bool = "moonbit_g_file_monitor_is_cancelled"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.FileMonitor.set_rate_limit.html).
#borrow(self)
pub extern "c" fn FileMonitor::set_rate_limit(
  self : FileMonitor,
  limit_msecs : Int,
) = "moonbit_g_file_monitor_set_rate_limit"

///|
#borrow(instance)
extern "c" fn g_file_monitor_connect_changed(
  instance : FileMonitor,
  function : FuncRef[
    (
      FileMonitor,
      File,
      File?,
      FileMonitorEvent,
      (FileMonitor, File, File?, FileMonitorEvent) -> Unit,
    ) -> Unit,
  ],
  closure : (FileMonitor, File, File?, FileMonitorEvent) -> Unit,
) -> UInt64 = "moonbit_g_file_monitor_connect_changed"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/signal.FileMonitor.changed.html).
pub fn FileMonitor::connect_changed(
  self : FileMonitor,
  f : (FileMonitor, File, File?, FileMonitorEvent) -> Unit,
) -> UInt64 {
  g_file_monitor_connect_changed(
    self,
    fn(instance_, file, other_file, event_type, f) {
      f(instance_, file, other_file, event_type)
    },
    f,
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/property.FileMonitor.rate-limit.html).
#borrow(self_)
pub extern "c" fn FileMonitor::get_rate_limit(self_ : FileMonitor) -> Int = "moonbit_g_file_monitor_get_rate_limit"

///|
impl IFileMonitor with fn cancel(self) -> Bool {
  self.as_file_monitor().cancel()
}

///|
impl IFileMonitor with fn emit_event(self, child, other_file, event_type) -> Unit {
  self.as_file_monitor().emit_event(child, other_file, event_type)
}

///|
impl IFileMonitor with fn is_cancelled(self) -> Bool {
  self.as_file_monitor().is_cancelled()
}

///|
impl IFileMonitor with fn set_rate_limit(self, limit_msecs) -> Unit {
  self.as_file_monitor().set_rate_limit(limit_msecs)
}

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

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

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