// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ICheckButton {
  fn as_check_button(Self) -> CheckButton
  fn get_active(Self) -> Bool = _
  fn get_child(Self) -> Widget? = _
  fn get_inconsistent(Self) -> Bool = _
  fn get_label(Self) -> String? = _
  fn get_use_underline(Self) -> Bool = _
  fn set_active(Self, Bool) -> Unit = _
  fn set_child(Self, &IWidget?) -> Unit = _
  fn set_group(Self, &ICheckButton?) -> Unit = _
  fn set_inconsistent(Self, Bool) -> Unit = _
  fn set_label(Self, String?) -> Unit = _
  fn set_use_underline(Self, Bool) -> Unit = _
  fn connect_activate(Self, (CheckButton) -> Unit) -> UInt64 = _
  fn connect_toggled(Self, (CheckButton) -> Unit) -> UInt64 = _
}

///|
pub impl ICheckButton for CheckButton with fn as_check_button(self) {
  self
}

///|
/// Implementation contract for CheckButton.activate. Self is the retained MoonBit state; the second parameter is the invoked CheckButton object.
pub(open) trait VCheckButtonActivate {
  fn activate(Self, CheckButton) -> Unit
}

///|
/// Implementation contract for CheckButton.toggled. Self is the retained MoonBit state; the second parameter is the invoked CheckButton object.
pub(open) trait VCheckButtonToggled {
  fn toggled(Self, CheckButton) -> Unit
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

///|
#borrow(self_, group)
extern "c" fn moonbit_gtk_check_button_set_group(
  self_ : CheckButton,
  group : @glib.Nullable[CheckButton],
) = "moonbit_gtk_check_button_set_group"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.CheckButton.set_group.html).
pub fn CheckButton::set_group(
  self : CheckButton,
  group : &ICheckButton?,
) -> Unit {
  moonbit_gtk_check_button_set_group(
    self,
    match group {
      Some(v) => @glib.Nullable::some(v.as_check_button())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.CheckButton.set_inconsistent.html).
#borrow(self)
pub extern "c" fn CheckButton::set_inconsistent(
  self : CheckButton,
  inconsistent : Bool,
) = "moonbit_gtk_check_button_set_inconsistent"

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

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

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

///|
#borrow(instance)
extern "c" fn gtk_check_button_connect_activate(
  instance : CheckButton,
  function : FuncRef[(CheckButton, (CheckButton) -> Unit) -> Unit],
  closure : (CheckButton) -> Unit,
) -> UInt64 = "moonbit_gtk_check_button_connect_activate"

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

///|
#borrow(instance)
extern "c" fn gtk_check_button_connect_toggled(
  instance : CheckButton,
  function : FuncRef[(CheckButton, (CheckButton) -> Unit) -> Unit],
  closure : (CheckButton) -> Unit,
) -> UInt64 = "moonbit_gtk_check_button_connect_toggled"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.CheckButton.toggled.html).
pub fn CheckButton::connect_toggled(
  self : CheckButton,
  f : (CheckButton) -> Unit,
) -> UInt64 {
  gtk_check_button_connect_toggled(self, fn(instance_, f) { f(instance_) }, f)
}

///|
impl ICheckButton with fn get_active(self) -> Bool {
  self.as_check_button().get_active()
}

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

///|
impl ICheckButton with fn get_inconsistent(self) -> Bool {
  self.as_check_button().get_inconsistent()
}

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

///|
impl ICheckButton with fn get_use_underline(self) -> Bool {
  self.as_check_button().get_use_underline()
}

///|
impl ICheckButton with fn set_active(self, setting) -> Unit {
  self.as_check_button().set_active(setting)
}

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

///|
impl ICheckButton with fn set_group(self, group) -> Unit {
  self.as_check_button().set_group(group)
}

///|
impl ICheckButton with fn set_inconsistent(self, inconsistent) -> Unit {
  self.as_check_button().set_inconsistent(inconsistent)
}

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

///|
impl ICheckButton with fn set_use_underline(self, setting) -> Unit {
  self.as_check_button().set_use_underline(setting)
}

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

///|
impl ICheckButton with fn connect_toggled(self, f) -> UInt64 {
  self.as_check_button().connect_toggled(f)
}

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

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

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

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