// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IExpander {
  fn as_expander(Self) -> Expander
  fn get_child(Self) -> Widget? = _
  fn get_expanded(Self) -> Bool = _
  fn get_label(Self) -> String? = _
  fn get_label_widget(Self) -> Widget? = _
  fn get_resize_toplevel(Self) -> Bool = _
  fn get_use_markup(Self) -> Bool = _
  fn get_use_underline(Self) -> Bool = _
  fn set_child(Self, &IWidget?) -> Unit = _
  fn set_expanded(Self, Bool) -> Unit = _
  fn set_label(Self, String?) -> Unit = _
  fn set_label_widget(Self, &IWidget?) -> Unit = _
  fn set_resize_toplevel(Self, Bool) -> Unit = _
  fn set_use_markup(Self, Bool) -> Unit = _
  fn set_use_underline(Self, Bool) -> Unit = _
  fn connect_activate(Self, (Expander) -> Unit) -> UInt64 = _
}

///|
pub impl IExpander for Expander with fn as_expander(self) {
  self
}

///|
#borrow(label)
extern "c" fn moonbit_gtk_expander_new(
  label : @glib.Nullable[Bytes],
) -> Expander = "moonbit_gtk_expander_new"

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

///|
#borrow(label)
extern "c" fn moonbit_gtk_expander_new_with_mnemonic(
  label : @glib.Nullable[Bytes],
) -> Expander = "moonbit_gtk_expander_new_with_mnemonic"

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

///|
#borrow(self_)
extern "c" fn moonbit_gtk_expander_get_child(
  self_ : Expander,
) -> @glib.Nullable[Widget] = "moonbit_gtk_expander_get_child"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.get_child.html).
pub fn Expander::get_child(self : Expander) -> Widget? {
  let raw_result = moonbit_gtk_expander_get_child(self)
  raw_result.to_option()
}

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

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

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

///|
#borrow(self_)
extern "c" fn moonbit_gtk_expander_get_label_widget(
  self_ : Expander,
) -> @glib.Nullable[Widget] = "moonbit_gtk_expander_get_label_widget"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.get_label_widget.html).
pub fn Expander::get_label_widget(self : Expander) -> Widget? {
  let raw_result = moonbit_gtk_expander_get_label_widget(self)
  raw_result.to_option()
}

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

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

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

///|
#borrow(self_, child)
extern "c" fn moonbit_gtk_expander_set_child(
  self_ : Expander,
  child : @glib.Nullable[Widget],
) = "moonbit_gtk_expander_set_child"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.set_child.html).
pub fn Expander::set_child(self : Expander, child : &IWidget?) -> Unit {
  moonbit_gtk_expander_set_child(
    self,
    match child {
      Some(v) => @glib.Nullable::some(v.as_widget())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.set_expanded.html).
#borrow(self)
pub extern "c" fn Expander::set_expanded(self : Expander, expanded : Bool) = "moonbit_gtk_expander_set_expanded"

///|
#borrow(self_, label)
extern "c" fn moonbit_gtk_expander_set_label(
  self_ : Expander,
  label : @glib.Nullable[Bytes],
) = "moonbit_gtk_expander_set_label"

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

///|
#borrow(self_, label_widget)
extern "c" fn moonbit_gtk_expander_set_label_widget(
  self_ : Expander,
  label_widget : @glib.Nullable[Widget],
) = "moonbit_gtk_expander_set_label_widget"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.set_label_widget.html).
pub fn Expander::set_label_widget(
  self : Expander,
  label_widget : &IWidget?,
) -> Unit {
  moonbit_gtk_expander_set_label_widget(
    self,
    match label_widget {
      Some(v) => @glib.Nullable::some(v.as_widget())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.set_resize_toplevel.html).
#borrow(self)
pub extern "c" fn Expander::set_resize_toplevel(
  self : Expander,
  resize_toplevel : Bool,
) = "moonbit_gtk_expander_set_resize_toplevel"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.set_use_markup.html).
#borrow(self)
pub extern "c" fn Expander::set_use_markup(self : Expander, use_markup : Bool) = "moonbit_gtk_expander_set_use_markup"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Expander.set_use_underline.html).
#borrow(self)
pub extern "c" fn Expander::set_use_underline(
  self : Expander,
  use_underline : Bool,
) = "moonbit_gtk_expander_set_use_underline"

///|
#borrow(instance)
extern "c" fn gtk_expander_connect_activate(
  instance : Expander,
  function : FuncRef[(Expander, (Expander) -> Unit) -> Unit],
  closure : (Expander) -> Unit,
) -> UInt64 = "moonbit_gtk_expander_connect_activate"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Expander.activate.html).
pub fn Expander::connect_activate(
  self : Expander,
  f : (Expander) -> Unit,
) -> UInt64 {
  gtk_expander_connect_activate(self, fn(instance_, f) { f(instance_) }, f)
}

///|
impl IExpander with fn get_child(self) -> Widget? {
  self.as_expander().get_child()
}

///|
impl IExpander with fn get_expanded(self) -> Bool {
  self.as_expander().get_expanded()
}

///|
impl IExpander with fn get_label(self) -> String? {
  self.as_expander().get_label()
}

///|
impl IExpander with fn get_label_widget(self) -> Widget? {
  self.as_expander().get_label_widget()
}

///|
impl IExpander with fn get_resize_toplevel(self) -> Bool {
  self.as_expander().get_resize_toplevel()
}

///|
impl IExpander with fn get_use_markup(self) -> Bool {
  self.as_expander().get_use_markup()
}

///|
impl IExpander with fn get_use_underline(self) -> Bool {
  self.as_expander().get_use_underline()
}

///|
impl IExpander with fn set_child(self, child) -> Unit {
  self.as_expander().set_child(child)
}

///|
impl IExpander with fn set_expanded(self, expanded) -> Unit {
  self.as_expander().set_expanded(expanded)
}

///|
impl IExpander with fn set_label(self, label) -> Unit {
  self.as_expander().set_label(label)
}

///|
impl IExpander with fn set_label_widget(self, label_widget) -> Unit {
  self.as_expander().set_label_widget(label_widget)
}

///|
impl IExpander with fn set_resize_toplevel(self, resize_toplevel) -> Unit {
  self.as_expander().set_resize_toplevel(resize_toplevel)
}

///|
impl IExpander with fn set_use_markup(self, use_markup) -> Unit {
  self.as_expander().set_use_markup(use_markup)
}

///|
impl IExpander with fn set_use_underline(self, use_underline) -> Unit {
  self.as_expander().set_use_underline(use_underline)
}

///|
impl IExpander with fn connect_activate(self, f) -> UInt64 {
  self.as_expander().connect_activate(f)
}

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

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

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

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