// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IPasswordEntry {
  fn as_password_entry(Self) -> PasswordEntry
  fn get_extra_menu(Self) -> @gio.MenuModel? = _
  fn get_show_peek_icon(Self) -> Bool = _
  fn set_extra_menu(Self, &@gio.IMenuModel?) -> Unit = _
  fn set_show_peek_icon(Self, Bool) -> Unit = _
  fn connect_activate(Self, (PasswordEntry) -> Unit) -> UInt64 = _
}

///|
pub impl IPasswordEntry for PasswordEntry with fn as_password_entry(self) {
  self
}

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

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

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

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

///|
#borrow(self_, model)
extern "c" fn moonbit_gtk_password_entry_set_extra_menu(
  self_ : PasswordEntry,
  model : @glib.Nullable[@gio.MenuModel],
) = "moonbit_gtk_password_entry_set_extra_menu"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.PasswordEntry.set_show_peek_icon.html).
#borrow(self)
pub extern "c" fn PasswordEntry::set_show_peek_icon(
  self : PasswordEntry,
  show_peek_icon : Bool,
) = "moonbit_gtk_password_entry_set_show_peek_icon"

///|
#borrow(instance)
extern "c" fn gtk_password_entry_connect_activate(
  instance : PasswordEntry,
  function : FuncRef[(PasswordEntry, (PasswordEntry) -> Unit) -> Unit],
  closure : (PasswordEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_password_entry_connect_activate"

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

///|
#borrow(self_)
extern "c" fn moonbit_gtk_password_entry_get_activates_default(
  self_ : PasswordEntry,
) -> Int = "moonbit_gtk_password_entry_get_activates_default"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.PasswordEntry.activates-default.html).
pub fn PasswordEntry::get_activates_default(self : PasswordEntry) -> Bool {
  moonbit_gtk_password_entry_get_activates_default(self) != 0
}

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

///|
pub fn PasswordEntry::set_activates_default(
  self : PasswordEntry,
  value : Bool,
) -> Unit {
  moonbit_gtk_password_entry_set_activates_default(
    self,
    if value {
      1
    } else {
      0
    },
  )
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_password_entry_get_placeholder_text(
  self_ : PasswordEntry,
) -> Bytes = "moonbit_gtk_password_entry_get_placeholder_text"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.PasswordEntry.placeholder-text.html).
pub fn PasswordEntry::get_placeholder_text(self : PasswordEntry) -> String {
  @encoding/utf8.decode_lossy(
    moonbit_gtk_password_entry_get_placeholder_text(self),
  )
}

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

///|
pub fn PasswordEntry::set_placeholder_text(
  self : PasswordEntry,
  value : String,
) -> Unit {
  moonbit_gtk_password_entry_set_placeholder_text(
    self,
    @encoding/utf8.encode(value),
  )
}

///|
impl IPasswordEntry with fn get_extra_menu(self) -> @gio.MenuModel? {
  self.as_password_entry().get_extra_menu()
}

///|
impl IPasswordEntry with fn get_show_peek_icon(self) -> Bool {
  self.as_password_entry().get_show_peek_icon()
}

///|
impl IPasswordEntry with fn set_extra_menu(self, model) -> Unit {
  self.as_password_entry().set_extra_menu(model)
}

///|
impl IPasswordEntry with fn set_show_peek_icon(self, show_peek_icon) -> Unit {
  self.as_password_entry().set_show_peek_icon(show_peek_icon)
}

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

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

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

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

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

///|
pub fn PasswordEntry::as_editable(self : PasswordEntry) -> Editable = "%identity"

///|
pub impl IEditable for PasswordEntry with fn as_editable(self) {
  self.as_editable()
}