// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IListModel {
  fn as_list_model(Self) -> ListModel
  fn get_n_items(Self) -> UInt = _
  fn get_object(Self, UInt) -> @gobject.Object? = _
  fn items_changed(Self, UInt, UInt, UInt) -> Unit = _
}

///|
pub impl IListModel for ListModel with fn as_list_model(self) {
  self
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.ListModel.get_n_items.html).
#borrow(self)
pub extern "c" fn ListModel::get_n_items(self : ListModel) -> UInt = "moonbit_g_list_model_get_n_items"

///|
#borrow(self_)
extern "c" fn moonbit_g_list_model_get_object(
  self_ : ListModel,
  position : UInt,
) -> @glib.Nullable[@gobject.Object] = "moonbit_g_list_model_get_object"

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.ListModel.get_object.html).
pub fn ListModel::get_object(
  self : ListModel,
  position : UInt,
) -> @gobject.Object? {
  let raw_result = moonbit_g_list_model_get_object(self, position)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gio/method.ListModel.items_changed.html).
#borrow(self)
pub extern "c" fn ListModel::items_changed(
  self : ListModel,
  position : UInt,
  removed : UInt,
  added : UInt,
) = "moonbit_g_list_model_items_changed"

///|
impl IListModel with fn get_n_items(self) -> UInt {
  self.as_list_model().get_n_items()
}

///|
impl IListModel with fn get_object(self, position) -> @gobject.Object? {
  self.as_list_model().get_object(position)
}

///|
impl IListModel with fn items_changed(self, position, removed, added) -> Unit {
  self.as_list_model().items_changed(position, removed, added)
}