// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ITextMark {
  fn as_text_mark(Self) -> TextMark
  fn get_buffer(Self) -> TextBuffer? = _
  fn get_deleted(Self) -> Bool = _
  fn get_left_gravity(Self) -> Bool = _
  fn get_name(Self) -> String? = _
  fn get_visible(Self) -> Bool = _
  fn set_visible(Self, Bool) -> Unit = _
}

///|
pub impl ITextMark for TextMark with fn as_text_mark(self) {
  self
}

///|
#borrow(name)
extern "c" fn moonbit_gtk_text_mark_new(
  name : @glib.Nullable[Bytes],
  left_gravity : Bool,
) -> TextMark = "moonbit_gtk_text_mark_new"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/ctor.TextMark.new.html).
pub fn TextMark::new(name : String?, left_gravity : Bool) -> TextMark {
  moonbit_gtk_text_mark_new(
    match name {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
    left_gravity,
  )
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.TextMark.get_buffer.html).
pub fn TextMark::get_buffer(self : TextMark) -> TextBuffer? {
  let raw_result = moonbit_gtk_text_mark_get_buffer(self)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.TextMark.get_deleted.html).
#borrow(self)
pub extern "c" fn TextMark::get_deleted(self : TextMark) -> Bool = "moonbit_gtk_text_mark_get_deleted"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.TextMark.get_left_gravity.html).
#borrow(self)
pub extern "c" fn TextMark::get_left_gravity(self : TextMark) -> Bool = "moonbit_gtk_text_mark_get_left_gravity"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.TextMark.get_visible.html).
#borrow(self)
pub extern "c" fn TextMark::get_visible(self : TextMark) -> Bool = "moonbit_gtk_text_mark_get_visible"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.TextMark.set_visible.html).
#borrow(self)
pub extern "c" fn TextMark::set_visible(self : TextMark, setting : Bool) = "moonbit_gtk_text_mark_set_visible"

///|
impl ITextMark with fn get_buffer(self) -> TextBuffer? {
  self.as_text_mark().get_buffer()
}

///|
impl ITextMark with fn get_deleted(self) -> Bool {
  self.as_text_mark().get_deleted()
}

///|
impl ITextMark with fn get_left_gravity(self) -> Bool {
  self.as_text_mark().get_left_gravity()
}

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

///|
impl ITextMark with fn get_visible(self) -> Bool {
  self.as_text_mark().get_visible()
}

///|
impl ITextMark with fn set_visible(self, setting) -> Unit {
  self.as_text_mark().set_visible(setting)
}

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

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