// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IMenuButton {
  fn as_menu_button(Self) -> MenuButton
  fn get_active(Self) -> Bool = _
  fn get_always_show_arrow(Self) -> Bool = _
  fn get_can_shrink(Self) -> Bool = _
  fn get_child(Self) -> Widget? = _
  fn get_direction(Self) -> ArrowType = _
  fn get_has_frame(Self) -> Bool = _
  fn get_icon_name(Self) -> String? = _
  fn get_label(Self) -> String? = _
  fn get_menu_model(Self) -> @gio.MenuModel? = _
  fn get_popover(Self) -> Popover? = _
  fn get_primary(Self) -> Bool = _
  fn get_use_underline(Self) -> Bool = _
  fn popdown(Self) -> Unit = _
  fn popup(Self) -> Unit = _
  fn set_active(Self, Bool) -> Unit = _
  fn set_always_show_arrow(Self, Bool) -> Unit = _
  fn set_can_shrink(Self, Bool) -> Unit = _
  fn set_child(Self, &IWidget?) -> Unit = _
  fn set_direction(Self, ArrowType) -> Unit = _
  fn set_has_frame(Self, Bool) -> Unit = _
  fn set_icon_name(Self, String) -> Unit = _
  fn set_label(Self, String) -> Unit = _
  fn set_menu_model(Self, &@gio.IMenuModel?) -> Unit = _
  fn set_popover(Self, &IPopover?) -> Unit = _
  fn set_primary(Self, Bool) -> Unit = _
  fn set_use_underline(Self, Bool) -> Unit = _
  fn connect_activate(Self, (MenuButton) -> Unit) -> UInt64 = _
  fn set_create_popup_func(Self, (MenuButton) -> Unit) -> Unit = _
}

///|
pub impl IMenuButton for MenuButton with fn as_menu_button(self) {
  self
}

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

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

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.get_direction.html).
#borrow(self)
pub extern "c" fn MenuButton::get_direction(self : MenuButton) -> ArrowType = "moonbit_gtk_menu_button_get_direction"

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

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

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

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

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

///|
#borrow(self_)
extern "c" fn moonbit_gtk_menu_button_get_menu_model(
  self_ : MenuButton,
) -> @glib.Nullable[@gio.MenuModel] = "moonbit_gtk_menu_button_get_menu_model"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.get_menu_model.html).
pub fn MenuButton::get_menu_model(self : MenuButton) -> @gio.MenuModel? {
  let raw_result = moonbit_gtk_menu_button_get_menu_model(self)
  raw_result.to_option()
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_menu_button_get_popover(
  self_ : MenuButton,
) -> @glib.Nullable[Popover] = "moonbit_gtk_menu_button_get_popover"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.get_popover.html).
pub fn MenuButton::get_popover(self : MenuButton) -> Popover? {
  let raw_result = moonbit_gtk_menu_button_get_popover(self)
  raw_result.to_option()
}

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

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_always_show_arrow.html).
#borrow(self)
pub extern "c" fn MenuButton::set_always_show_arrow(
  self : MenuButton,
  always_show_arrow : Bool,
) = "moonbit_gtk_menu_button_set_always_show_arrow"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_can_shrink.html).
#borrow(self)
pub extern "c" fn MenuButton::set_can_shrink(
  self : MenuButton,
  can_shrink : Bool,
) = "moonbit_gtk_menu_button_set_can_shrink"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_child.html).
pub fn MenuButton::set_child(self : MenuButton, child : &IWidget?) -> Unit {
  moonbit_gtk_menu_button_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.MenuButton.set_direction.html).
#borrow(self)
pub extern "c" fn MenuButton::set_direction(
  self : MenuButton,
  direction : ArrowType,
) = "moonbit_gtk_menu_button_set_direction"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_has_frame.html).
#borrow(self)
pub extern "c" fn MenuButton::set_has_frame(
  self : MenuButton,
  has_frame : Bool,
) = "moonbit_gtk_menu_button_set_has_frame"

///|
#borrow(self_, icon_name)
extern "c" fn moonbit_gtk_menu_button_set_icon_name(
  self_ : MenuButton,
  icon_name : Bytes,
) = "moonbit_gtk_menu_button_set_icon_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_icon_name.html).
pub fn MenuButton::set_icon_name(self : MenuButton, icon_name : String) -> Unit {
  moonbit_gtk_menu_button_set_icon_name(self, @encoding/utf8.encode(icon_name))
}

///|
#borrow(self_, label)
extern "c" fn moonbit_gtk_menu_button_set_label(
  self_ : MenuButton,
  label : Bytes,
) = "moonbit_gtk_menu_button_set_label"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_label.html).
pub fn MenuButton::set_label(self : MenuButton, label : String) -> Unit {
  moonbit_gtk_menu_button_set_label(self, @encoding/utf8.encode(label))
}

///|
#borrow(self_, menu_model)
extern "c" fn moonbit_gtk_menu_button_set_menu_model(
  self_ : MenuButton,
  menu_model : @glib.Nullable[@gio.MenuModel],
) = "moonbit_gtk_menu_button_set_menu_model"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_menu_model.html).
pub fn MenuButton::set_menu_model(
  self : MenuButton,
  menu_model : &@gio.IMenuModel?,
) -> Unit {
  moonbit_gtk_menu_button_set_menu_model(
    self,
    match menu_model {
      Some(v) => @glib.Nullable::some(v.as_menu_model())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, popover)
extern "c" fn moonbit_gtk_menu_button_set_popover(
  self_ : MenuButton,
  popover : @glib.Nullable[Popover],
) = "moonbit_gtk_menu_button_set_popover"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_popover.html).
pub fn MenuButton::set_popover(self : MenuButton, popover : &IPopover?) -> Unit {
  moonbit_gtk_menu_button_set_popover(
    self,
    match popover {
      Some(v) => @glib.Nullable::some(v.as_popover())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_primary.html).
#borrow(self)
pub extern "c" fn MenuButton::set_primary(self : MenuButton, primary : Bool) = "moonbit_gtk_menu_button_set_primary"

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

///|
#borrow(instance)
extern "c" fn gtk_menu_button_connect_activate(
  instance : MenuButton,
  function : FuncRef[(MenuButton, (MenuButton) -> Unit) -> Unit],
  closure : (MenuButton) -> Unit,
) -> UInt64 = "moonbit_gtk_menu_button_connect_activate"

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

///|
#borrow(instance)
extern "c" fn gtk_menu_button_set_create_popup_func(
  instance : MenuButton,
  function : FuncRef[(MenuButton, (MenuButton) -> Unit) -> Unit],
  closure : (MenuButton) -> Unit,
) -> Unit = "moonbit_gtk_menu_button_set_create_popup_func"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.MenuButton.set_create_popup_func.html).
pub fn MenuButton::set_create_popup_func(
  self : MenuButton,
  callback : (MenuButton) -> Unit,
) -> Unit {
  gtk_menu_button_set_create_popup_func(
    self,
    fn(menu_button, f) { f(menu_button) },
    callback,
  )
}

///|
impl IMenuButton with fn get_active(self) -> Bool {
  self.as_menu_button().get_active()
}

///|
impl IMenuButton with fn get_always_show_arrow(self) -> Bool {
  self.as_menu_button().get_always_show_arrow()
}

///|
impl IMenuButton with fn get_can_shrink(self) -> Bool {
  self.as_menu_button().get_can_shrink()
}

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

///|
impl IMenuButton with fn get_direction(self) -> ArrowType {
  self.as_menu_button().get_direction()
}

///|
impl IMenuButton with fn get_has_frame(self) -> Bool {
  self.as_menu_button().get_has_frame()
}

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

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

///|
impl IMenuButton with fn get_menu_model(self) -> @gio.MenuModel? {
  self.as_menu_button().get_menu_model()
}

///|
impl IMenuButton with fn get_popover(self) -> Popover? {
  self.as_menu_button().get_popover()
}

///|
impl IMenuButton with fn get_primary(self) -> Bool {
  self.as_menu_button().get_primary()
}

///|
impl IMenuButton with fn get_use_underline(self) -> Bool {
  self.as_menu_button().get_use_underline()
}

///|
impl IMenuButton with fn popdown(self) -> Unit {
  self.as_menu_button().popdown()
}

///|
impl IMenuButton with fn popup(self) -> Unit {
  self.as_menu_button().popup()
}

///|
impl IMenuButton with fn set_active(self, active) -> Unit {
  self.as_menu_button().set_active(active)
}

///|
impl IMenuButton with fn set_always_show_arrow(self, always_show_arrow) -> Unit {
  self.as_menu_button().set_always_show_arrow(always_show_arrow)
}

///|
impl IMenuButton with fn set_can_shrink(self, can_shrink) -> Unit {
  self.as_menu_button().set_can_shrink(can_shrink)
}

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

///|
impl IMenuButton with fn set_direction(self, direction) -> Unit {
  self.as_menu_button().set_direction(direction)
}

///|
impl IMenuButton with fn set_has_frame(self, has_frame) -> Unit {
  self.as_menu_button().set_has_frame(has_frame)
}

///|
impl IMenuButton with fn set_icon_name(self, icon_name) -> Unit {
  self.as_menu_button().set_icon_name(icon_name)
}

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

///|
impl IMenuButton with fn set_menu_model(self, menu_model) -> Unit {
  self.as_menu_button().set_menu_model(menu_model)
}

///|
impl IMenuButton with fn set_popover(self, popover) -> Unit {
  self.as_menu_button().set_popover(popover)
}

///|
impl IMenuButton with fn set_primary(self, primary) -> Unit {
  self.as_menu_button().set_primary(primary)
}

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

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

///|
impl IMenuButton with fn set_create_popup_func(self, callback) -> Unit {
  self.as_menu_button().set_create_popup_func(callback)
}

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

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

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

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