// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ISearchEntry {
  fn as_search_entry(Self) -> SearchEntry
  fn get_input_hints(Self) -> InputHints = _
  fn get_input_purpose(Self) -> InputPurpose = _
  fn get_key_capture_widget(Self) -> Widget? = _
  fn get_placeholder_text(Self) -> String? = _
  fn get_search_delay(Self) -> UInt = _
  fn set_input_hints(Self, InputHints) -> Unit = _
  fn set_input_purpose(Self, InputPurpose) -> Unit = _
  fn set_key_capture_widget(Self, &IWidget?) -> Unit = _
  fn set_placeholder_text(Self, String?) -> Unit = _
  fn set_search_delay(Self, UInt) -> Unit = _
  fn connect_activate(Self, (SearchEntry) -> Unit) -> UInt64 = _
  fn connect_next_match(Self, (SearchEntry) -> Unit) -> UInt64 = _
  fn connect_previous_match(Self, (SearchEntry) -> Unit) -> UInt64 = _
  fn connect_search_changed(Self, (SearchEntry) -> Unit) -> UInt64 = _
  fn connect_search_started(Self, (SearchEntry) -> Unit) -> UInt64 = _
  fn connect_stop_search(Self, (SearchEntry) -> Unit) -> UInt64 = _
}

///|
pub impl ISearchEntry for SearchEntry with fn as_search_entry(self) {
  self
}

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.SearchEntry.get_input_hints.html).
pub fn SearchEntry::get_input_hints(self : SearchEntry) -> InputHints {
  InputHints::from_int(moonbit_gtk_search_entry_get_input_hints(self))
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.SearchEntry.get_input_purpose.html).
#borrow(self)
pub extern "c" fn SearchEntry::get_input_purpose(
  self : SearchEntry,
) -> InputPurpose = "moonbit_gtk_search_entry_get_input_purpose"

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.SearchEntry.get_search_delay.html).
#borrow(self)
pub extern "c" fn SearchEntry::get_search_delay(self : SearchEntry) -> UInt = "moonbit_gtk_search_entry_get_search_delay"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_search_entry_set_input_hints(
  self_ : SearchEntry,
  hints : Int,
) = "moonbit_gtk_search_entry_set_input_hints"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.SearchEntry.set_input_hints.html).
pub fn SearchEntry::set_input_hints(
  self : SearchEntry,
  hints : InputHints,
) -> Unit {
  moonbit_gtk_search_entry_set_input_hints(self, hints.to_int())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.SearchEntry.set_input_purpose.html).
#borrow(self)
pub extern "c" fn SearchEntry::set_input_purpose(
  self : SearchEntry,
  purpose : InputPurpose,
) = "moonbit_gtk_search_entry_set_input_purpose"

///|
#borrow(self_, widget)
extern "c" fn moonbit_gtk_search_entry_set_key_capture_widget(
  self_ : SearchEntry,
  widget : @glib.Nullable[Widget],
) = "moonbit_gtk_search_entry_set_key_capture_widget"

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

///|
#borrow(self_, text)
extern "c" fn moonbit_gtk_search_entry_set_placeholder_text(
  self_ : SearchEntry,
  text : @glib.Nullable[Bytes],
) = "moonbit_gtk_search_entry_set_placeholder_text"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.SearchEntry.set_search_delay.html).
#borrow(self)
pub extern "c" fn SearchEntry::set_search_delay(
  self : SearchEntry,
  delay : UInt,
) = "moonbit_gtk_search_entry_set_search_delay"

///|
#borrow(instance)
extern "c" fn gtk_search_entry_connect_activate(
  instance : SearchEntry,
  function : FuncRef[(SearchEntry, (SearchEntry) -> Unit) -> Unit],
  closure : (SearchEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_search_entry_connect_activate"

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

///|
#borrow(instance)
extern "c" fn gtk_search_entry_connect_next_match(
  instance : SearchEntry,
  function : FuncRef[(SearchEntry, (SearchEntry) -> Unit) -> Unit],
  closure : (SearchEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_search_entry_connect_next_match"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.SearchEntry.next-match.html).
pub fn SearchEntry::connect_next_match(
  self : SearchEntry,
  f : (SearchEntry) -> Unit,
) -> UInt64 {
  gtk_search_entry_connect_next_match(
    self,
    fn(instance_, f) { f(instance_) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_search_entry_connect_previous_match(
  instance : SearchEntry,
  function : FuncRef[(SearchEntry, (SearchEntry) -> Unit) -> Unit],
  closure : (SearchEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_search_entry_connect_previous_match"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.SearchEntry.previous-match.html).
pub fn SearchEntry::connect_previous_match(
  self : SearchEntry,
  f : (SearchEntry) -> Unit,
) -> UInt64 {
  gtk_search_entry_connect_previous_match(
    self,
    fn(instance_, f) { f(instance_) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_search_entry_connect_search_changed(
  instance : SearchEntry,
  function : FuncRef[(SearchEntry, (SearchEntry) -> Unit) -> Unit],
  closure : (SearchEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_search_entry_connect_search_changed"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.SearchEntry.search-changed.html).
pub fn SearchEntry::connect_search_changed(
  self : SearchEntry,
  f : (SearchEntry) -> Unit,
) -> UInt64 {
  gtk_search_entry_connect_search_changed(
    self,
    fn(instance_, f) { f(instance_) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_search_entry_connect_search_started(
  instance : SearchEntry,
  function : FuncRef[(SearchEntry, (SearchEntry) -> Unit) -> Unit],
  closure : (SearchEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_search_entry_connect_search_started"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.SearchEntry.search-started.html).
pub fn SearchEntry::connect_search_started(
  self : SearchEntry,
  f : (SearchEntry) -> Unit,
) -> UInt64 {
  gtk_search_entry_connect_search_started(
    self,
    fn(instance_, f) { f(instance_) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_search_entry_connect_stop_search(
  instance : SearchEntry,
  function : FuncRef[(SearchEntry, (SearchEntry) -> Unit) -> Unit],
  closure : (SearchEntry) -> Unit,
) -> UInt64 = "moonbit_gtk_search_entry_connect_stop_search"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.SearchEntry.stop-search.html).
pub fn SearchEntry::connect_stop_search(
  self : SearchEntry,
  f : (SearchEntry) -> Unit,
) -> UInt64 {
  gtk_search_entry_connect_stop_search(
    self,
    fn(instance_, f) { f(instance_) },
    f,
  )
}

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

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

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

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

///|
impl ISearchEntry with fn get_input_hints(self) -> InputHints {
  self.as_search_entry().get_input_hints()
}

///|
impl ISearchEntry with fn get_input_purpose(self) -> InputPurpose {
  self.as_search_entry().get_input_purpose()
}

///|
impl ISearchEntry with fn get_key_capture_widget(self) -> Widget? {
  self.as_search_entry().get_key_capture_widget()
}

///|
impl ISearchEntry with fn get_placeholder_text(self) -> String? {
  self.as_search_entry().get_placeholder_text()
}

///|
impl ISearchEntry with fn get_search_delay(self) -> UInt {
  self.as_search_entry().get_search_delay()
}

///|
impl ISearchEntry with fn set_input_hints(self, hints) -> Unit {
  self.as_search_entry().set_input_hints(hints)
}

///|
impl ISearchEntry with fn set_input_purpose(self, purpose) -> Unit {
  self.as_search_entry().set_input_purpose(purpose)
}

///|
impl ISearchEntry with fn set_key_capture_widget(self, widget) -> Unit {
  self.as_search_entry().set_key_capture_widget(widget)
}

///|
impl ISearchEntry with fn set_placeholder_text(self, text) -> Unit {
  self.as_search_entry().set_placeholder_text(text)
}

///|
impl ISearchEntry with fn set_search_delay(self, delay) -> Unit {
  self.as_search_entry().set_search_delay(delay)
}

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

///|
impl ISearchEntry with fn connect_next_match(self, f) -> UInt64 {
  self.as_search_entry().connect_next_match(f)
}

///|
impl ISearchEntry with fn connect_previous_match(self, f) -> UInt64 {
  self.as_search_entry().connect_previous_match(f)
}

///|
impl ISearchEntry with fn connect_search_changed(self, f) -> UInt64 {
  self.as_search_entry().connect_search_changed(f)
}

///|
impl ISearchEntry with fn connect_search_started(self, f) -> UInt64 {
  self.as_search_entry().connect_search_started(f)
}

///|
impl ISearchEntry with fn connect_stop_search(self, f) -> UInt64 {
  self.as_search_entry().connect_stop_search(f)
}

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

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

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

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

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

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