// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IImage {
  fn as_image(Self) -> Image
  fn clear(Self) -> Unit = _
  fn get_gicon(Self) -> @gio.Icon? = _
  fn get_icon_name(Self) -> String? = _
  fn get_icon_size(Self) -> IconSize = _
  fn get_paintable(Self) -> @gdk.Paintable? = _
  fn get_pixel_size(Self) -> Int = _
  fn get_storage_type(Self) -> ImageType = _
  fn set_from_file(Self, String?) -> Unit = _
  fn set_from_gicon(Self, &@gio.IIcon) -> Unit = _
  fn set_from_icon_name(Self, String?) -> Unit = _
  fn set_from_paintable(Self, &@gdk.IPaintable?) -> Unit = _
  fn set_from_resource(Self, String?) -> Unit = _
  fn set_icon_size(Self, IconSize) -> Unit = _
  fn set_pixel_size(Self, Int) -> Unit = _
}

///|
pub impl IImage for Image with fn as_image(self) {
  self
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Image.new.html).
pub extern "c" fn Image::new() -> Image = "moonbit_gtk_image_new"

///|
#borrow(filename)
extern "c" fn moonbit_gtk_image_new_from_file(filename : Bytes) -> Image = "moonbit_gtk_image_new_from_file"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Image.new_from_file.html).
pub fn Image::new_from_file(filename : String) -> Image {
  moonbit_gtk_image_new_from_file(@encoding/utf8.encode(filename))
}

///|
#borrow(icon)
extern "c" fn moonbit_gtk_image_new_from_gicon(icon : @gio.Icon) -> Image = "moonbit_gtk_image_new_from_gicon"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Image.new_from_gicon.html).
pub fn Image::new_from_gicon(icon : &@gio.IIcon) -> Image {
  moonbit_gtk_image_new_from_gicon(icon.as_icon())
}

///|
#borrow(icon_name)
extern "c" fn moonbit_gtk_image_new_from_icon_name(
  icon_name : @glib.Nullable[Bytes],
) -> Image = "moonbit_gtk_image_new_from_icon_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Image.new_from_icon_name.html).
pub fn Image::new_from_icon_name(icon_name : String?) -> Image {
  moonbit_gtk_image_new_from_icon_name(
    match icon_name {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(paintable)
extern "c" fn moonbit_gtk_image_new_from_paintable(
  paintable : @glib.Nullable[@gdk.Paintable],
) -> Image = "moonbit_gtk_image_new_from_paintable"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Image.new_from_paintable.html).
pub fn Image::new_from_paintable(paintable : &@gdk.IPaintable?) -> Image {
  moonbit_gtk_image_new_from_paintable(
    match paintable {
      Some(v) => @glib.Nullable::some(v.as_paintable())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(resource_path)
extern "c" fn moonbit_gtk_image_new_from_resource(
  resource_path : Bytes,
) -> Image = "moonbit_gtk_image_new_from_resource"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.Image.new_from_resource.html).
pub fn Image::new_from_resource(resource_path : String) -> Image {
  moonbit_gtk_image_new_from_resource(@encoding/utf8.encode(resource_path))
}

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

///|
#borrow(self_)
extern "c" fn moonbit_gtk_image_get_gicon(
  self_ : Image,
) -> @glib.Nullable[@gio.Icon] = "moonbit_gtk_image_get_gicon"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.get_gicon.html).
pub fn Image::get_gicon(self : Image) -> @gio.Icon? {
  let raw_result = moonbit_gtk_image_get_gicon(self)
  raw_result.to_option()
}

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.get_icon_size.html).
#borrow(self)
pub extern "c" fn Image::get_icon_size(self : Image) -> IconSize = "moonbit_gtk_image_get_icon_size"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_image_get_paintable(
  self_ : Image,
) -> @glib.Nullable[@gdk.Paintable] = "moonbit_gtk_image_get_paintable"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.get_paintable.html).
pub fn Image::get_paintable(self : Image) -> @gdk.Paintable? {
  let raw_result = moonbit_gtk_image_get_paintable(self)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.get_pixel_size.html).
#borrow(self)
pub extern "c" fn Image::get_pixel_size(self : Image) -> Int = "moonbit_gtk_image_get_pixel_size"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.get_storage_type.html).
#borrow(self)
pub extern "c" fn Image::get_storage_type(self : Image) -> ImageType = "moonbit_gtk_image_get_storage_type"

///|
#borrow(self_, filename)
extern "c" fn moonbit_gtk_image_set_from_file(
  self_ : Image,
  filename : @glib.Nullable[Bytes],
) = "moonbit_gtk_image_set_from_file"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_from_file.html).
pub fn Image::set_from_file(self : Image, filename : String?) -> Unit {
  moonbit_gtk_image_set_from_file(
    self,
    match filename {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, icon)
extern "c" fn moonbit_gtk_image_set_from_gicon(self_ : Image, icon : @gio.Icon) = "moonbit_gtk_image_set_from_gicon"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_from_gicon.html).
pub fn Image::set_from_gicon(self : Image, icon : &@gio.IIcon) -> Unit {
  moonbit_gtk_image_set_from_gicon(self, icon.as_icon())
}

///|
#borrow(self_, icon_name)
extern "c" fn moonbit_gtk_image_set_from_icon_name(
  self_ : Image,
  icon_name : @glib.Nullable[Bytes],
) = "moonbit_gtk_image_set_from_icon_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_from_icon_name.html).
pub fn Image::set_from_icon_name(self : Image, icon_name : String?) -> Unit {
  moonbit_gtk_image_set_from_icon_name(
    self,
    match icon_name {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, paintable)
extern "c" fn moonbit_gtk_image_set_from_paintable(
  self_ : Image,
  paintable : @glib.Nullable[@gdk.Paintable],
) = "moonbit_gtk_image_set_from_paintable"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_from_paintable.html).
pub fn Image::set_from_paintable(
  self : Image,
  paintable : &@gdk.IPaintable?,
) -> Unit {
  moonbit_gtk_image_set_from_paintable(
    self,
    match paintable {
      Some(v) => @glib.Nullable::some(v.as_paintable())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, resource_path)
extern "c" fn moonbit_gtk_image_set_from_resource(
  self_ : Image,
  resource_path : @glib.Nullable[Bytes],
) = "moonbit_gtk_image_set_from_resource"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_from_resource.html).
pub fn Image::set_from_resource(self : Image, resource_path : String?) -> Unit {
  moonbit_gtk_image_set_from_resource(
    self,
    match resource_path {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_icon_size.html).
#borrow(self)
pub extern "c" fn Image::set_icon_size(self : Image, icon_size : IconSize) = "moonbit_gtk_image_set_icon_size"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Image.set_pixel_size.html).
#borrow(self)
pub extern "c" fn Image::set_pixel_size(self : Image, pixel_size : Int) = "moonbit_gtk_image_set_pixel_size"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.Image.file.html).
pub fn Image::get_file(self : Image) -> String {
  @encoding/utf8.decode_lossy(moonbit_gtk_image_get_file(self))
}

///|
#borrow(self_, value)
extern "c" fn moonbit_gtk_image_set_file(self_ : Image, value : Bytes) = "moonbit_gtk_image_set_file"

///|
pub fn Image::set_file(self : Image, value : String) -> Unit {
  moonbit_gtk_image_set_file(self, @encoding/utf8.encode(value))
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.Image.resource.html).
pub fn Image::get_resource(self : Image) -> String {
  @encoding/utf8.decode_lossy(moonbit_gtk_image_get_resource(self))
}

///|
#borrow(self_, value)
extern "c" fn moonbit_gtk_image_set_resource(self_ : Image, value : Bytes) = "moonbit_gtk_image_set_resource"

///|
pub fn Image::set_resource(self : Image, value : String) -> Unit {
  moonbit_gtk_image_set_resource(self, @encoding/utf8.encode(value))
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.Image.use-fallback.html).
pub fn Image::get_use_fallback(self : Image) -> Bool {
  moonbit_gtk_image_get_use_fallback(self) != 0
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_image_set_use_fallback(self_ : Image, value : Int) = "moonbit_gtk_image_set_use_fallback"

///|
pub fn Image::set_use_fallback(self : Image, value : Bool) -> Unit {
  moonbit_gtk_image_set_use_fallback(self, if value { 1 } else { 0 })
}

///|
impl IImage with fn clear(self) -> Unit {
  self.as_image().clear()
}

///|
impl IImage with fn get_gicon(self) -> @gio.Icon? {
  self.as_image().get_gicon()
}

///|
impl IImage with fn get_icon_name(self) -> String? {
  self.as_image().get_icon_name()
}

///|
impl IImage with fn get_icon_size(self) -> IconSize {
  self.as_image().get_icon_size()
}

///|
impl IImage with fn get_paintable(self) -> @gdk.Paintable? {
  self.as_image().get_paintable()
}

///|
impl IImage with fn get_pixel_size(self) -> Int {
  self.as_image().get_pixel_size()
}

///|
impl IImage with fn get_storage_type(self) -> ImageType {
  self.as_image().get_storage_type()
}

///|
impl IImage with fn set_from_file(self, filename) -> Unit {
  self.as_image().set_from_file(filename)
}

///|
impl IImage with fn set_from_gicon(self, icon) -> Unit {
  self.as_image().set_from_gicon(icon)
}

///|
impl IImage with fn set_from_icon_name(self, icon_name) -> Unit {
  self.as_image().set_from_icon_name(icon_name)
}

///|
impl IImage with fn set_from_paintable(self, paintable) -> Unit {
  self.as_image().set_from_paintable(paintable)
}

///|
impl IImage with fn set_from_resource(self, resource_path) -> Unit {
  self.as_image().set_from_resource(resource_path)
}

///|
impl IImage with fn set_icon_size(self, icon_size) -> Unit {
  self.as_image().set_icon_size(icon_size)
}

///|
impl IImage with fn set_pixel_size(self, pixel_size) -> Unit {
  self.as_image().set_pixel_size(pixel_size)
}

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

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

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

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