// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IWidget {
  fn as_widget(Self) -> Widget
  fn action_set_enabled(Self, String, Bool) -> Unit = _
  fn activate(Self) -> Bool = _
  fn activate_action_variant(Self, String, &@glib.IVariant?) -> Bool = _
  fn activate_default(Self) -> Unit = _
  fn add_controller(Self, &IEventController) -> Unit = _
  fn add_css_class(Self, String) -> Unit = _
  fn add_mnemonic_label(Self, &IWidget) -> Unit = _
  fn child_focus(Self, DirectionType) -> Bool = _
  fn compute_expand(Self, Orientation) -> Bool = _
  fn contains(Self, Double, Double) -> Bool = _
  fn create_pango_context(Self) -> @pango.Context = _
  fn create_pango_layout(Self, String?) -> @pango.Layout = _
  fn drag_check_threshold(Self, Int, Int, Int, Int) -> Bool = _
  fn error_bell(Self) -> Unit = _
  fn get_baseline(Self) -> Int = _
  fn get_can_focus(Self) -> Bool = _
  fn get_can_target(Self) -> Bool = _
  fn get_child_visible(Self) -> Bool = _
  fn get_clipboard(Self) -> @gdk.Clipboard = _
  fn get_color(Self) -> @gdk.RGBA = _
  fn get_css_name(Self) -> String = _
  fn get_cursor(Self) -> @gdk.Cursor? = _
  fn get_direction(Self) -> TextDirection = _
  fn get_display(Self) -> @gdk.Display = _
  fn get_first_child(Self) -> Widget? = _
  fn get_focus_child(Self) -> Widget? = _
  fn get_focus_on_click(Self) -> Bool = _
  fn get_focusable(Self) -> Bool = _
  fn get_font_map(Self) -> @pango.FontMap? = _
  fn get_frame_clock(Self) -> @gdk.FrameClock? = _
  fn get_halign(Self) -> Align = _
  fn get_has_tooltip(Self) -> Bool = _
  fn get_height(Self) -> Int = _
  fn get_hexpand(Self) -> Bool = _
  fn get_hexpand_set(Self) -> Bool = _
  fn get_last_child(Self) -> Widget? = _
  fn get_layout_manager(Self) -> LayoutManager? = _
  fn get_limit_events(Self) -> Bool = _
  fn get_mapped(Self) -> Bool = _
  fn get_margin_bottom(Self) -> Int = _
  fn get_margin_end(Self) -> Int = _
  fn get_margin_start(Self) -> Int = _
  fn get_margin_top(Self) -> Int = _
  fn get_name(Self) -> String = _
  fn get_native(Self) -> Native? = _
  fn get_next_sibling(Self) -> Widget? = _
  fn get_opacity(Self) -> Double = _
  fn get_overflow(Self) -> Overflow = _
  fn get_pango_context(Self) -> @pango.Context = _
  fn get_parent(Self) -> Widget? = _
  fn get_prev_sibling(Self) -> Widget? = _
  fn get_primary_clipboard(Self) -> @gdk.Clipboard = _
  fn get_realized(Self) -> Bool = _
  fn get_receives_default(Self) -> Bool = _
  fn get_request_mode(Self) -> SizeRequestMode = _
  fn get_root(Self) -> Root? = _
  fn get_scale_factor(Self) -> Int = _
  fn get_sensitive(Self) -> Bool = _
  fn get_settings(Self) -> Settings = _
  fn get_size(Self, Orientation) -> Int = _
  fn get_size_request(Self) -> (Int, Int) = _
  fn get_state_flags(Self) -> StateFlags = _
  fn get_tooltip_markup(Self) -> String? = _
  fn get_tooltip_text(Self) -> String? = _
  fn get_valign(Self) -> Align = _
  fn get_vexpand(Self) -> Bool = _
  fn get_vexpand_set(Self) -> Bool = _
  fn get_visible(Self) -> Bool = _
  fn get_width(Self) -> Int = _
  fn grab_focus(Self) -> Bool = _
  fn has_css_class(Self, String) -> Bool = _
  fn has_default(Self) -> Bool = _
  fn has_focus(Self) -> Bool = _
  fn has_visible_focus(Self) -> Bool = _
  fn in_destruction(Self) -> Bool = _
  fn init_template(Self) -> Unit = _
  fn insert_action_group(Self, String, &@gio.IActionGroup?) -> Unit = _
  fn insert_after(Self, &IWidget, &IWidget?) -> Unit = _
  fn insert_before(Self, &IWidget, &IWidget?) -> Unit = _
  fn is_ancestor(Self, &IWidget) -> Bool = _
  fn is_drawable(Self) -> Bool = _
  fn is_focus(Self) -> Bool = _
  fn is_sensitive(Self) -> Bool = _
  fn is_visible(Self) -> Bool = _
  fn keynav_failed(Self, DirectionType) -> Bool = _
  fn list_mnemonic_labels(Self) -> Array[Widget] = _
  fn map(Self) -> Unit = _
  fn measure(Self, Orientation, Int) -> (Int, Int, Int, Int) = _
  fn mnemonic_activate(Self, Bool) -> Bool = _
  fn observe_children(Self) -> @gio.ListModel = _
  fn observe_controllers(Self) -> @gio.ListModel = _
  fn pick(Self, Double, Double, PickFlags) -> Widget? = _
  fn queue_allocate(Self) -> Unit = _
  fn queue_draw(Self) -> Unit = _
  fn queue_resize(Self) -> Unit = _
  fn realize(Self) -> Unit = _
  fn remove_controller(Self, &IEventController) -> Unit = _
  fn remove_css_class(Self, String) -> Unit = _
  fn remove_mnemonic_label(Self, &IWidget) -> Unit = _
  fn remove_tick_callback(Self, UInt) -> Unit = _
  fn set_can_focus(Self, Bool) -> Unit = _
  fn set_can_target(Self, Bool) -> Unit = _
  fn set_child_visible(Self, Bool) -> Unit = _
  fn set_css_classes(Self, Array[String]) -> Unit = _
  fn set_cursor(Self, &@gdk.ICursor?) -> Unit = _
  fn set_cursor_from_name(Self, String?) -> Unit = _
  fn set_direction(Self, TextDirection) -> Unit = _
  fn set_focus_child(Self, &IWidget?) -> Unit = _
  fn set_focus_on_click(Self, Bool) -> Unit = _
  fn set_focusable(Self, Bool) -> Unit = _
  fn set_font_map(Self, &@pango.IFontMap?) -> Unit = _
  fn set_halign(Self, Align) -> Unit = _
  fn set_has_tooltip(Self, Bool) -> Unit = _
  fn set_hexpand(Self, Bool) -> Unit = _
  fn set_hexpand_set(Self, Bool) -> Unit = _
  fn set_layout_manager(Self, &ILayoutManager?) -> Unit = _
  fn set_limit_events(Self, Bool) -> Unit = _
  fn set_margin_bottom(Self, Int) -> Unit = _
  fn set_margin_end(Self, Int) -> Unit = _
  fn set_margin_start(Self, Int) -> Unit = _
  fn set_margin_top(Self, Int) -> Unit = _
  fn set_name(Self, String) -> Unit = _
  fn set_opacity(Self, Double) -> Unit = _
  fn set_overflow(Self, Overflow) -> Unit = _
  fn set_parent(Self, &IWidget) -> Unit = _
  fn set_receives_default(Self, Bool) -> Unit = _
  fn set_sensitive(Self, Bool) -> Unit = _
  fn set_size_request(Self, Int, Int) -> Unit = _
  fn set_state_flags(Self, StateFlags, Bool) -> Unit = _
  fn set_tooltip_markup(Self, String?) -> Unit = _
  fn set_tooltip_text(Self, String?) -> Unit = _
  fn set_valign(Self, Align) -> Unit = _
  fn set_vexpand(Self, Bool) -> Unit = _
  fn set_vexpand_set(Self, Bool) -> Unit = _
  fn set_visible(Self, Bool) -> Unit = _
  fn should_layout(Self) -> Bool = _
  fn size_allocate(Self, @gdk.Rectangle, Int) -> Unit = _
  fn snapshot_child(Self, &IWidget, &ISnapshot) -> Unit = _
  fn trigger_tooltip_query(Self) -> Unit = _
  fn unmap(Self) -> Unit = _
  fn unparent(Self) -> Unit = _
  fn unrealize(Self) -> Unit = _
  fn unset_state_flags(Self, StateFlags) -> Unit = _
  fn connect_destroy(Self, (Widget) -> Unit) -> UInt64 = _
  fn connect_direction_changed(Self, (Widget, TextDirection) -> Unit) -> UInt64 = _
  fn connect_hide(Self, (Widget) -> Unit) -> UInt64 = _
  fn connect_keynav_failed(Self, (Widget, DirectionType) -> Bool) -> UInt64 = _
  fn connect_map(Self, (Widget) -> Unit) -> UInt64 = _
  fn connect_mnemonic_activate(Self, (Widget, Bool) -> Bool) -> UInt64 = _
  fn connect_move_focus(Self, (Widget, DirectionType) -> Unit) -> UInt64 = _
  fn connect_query_tooltip(Self, (Widget, Int, Int, Bool, Tooltip) -> Bool) -> UInt64 = _
  fn connect_realize(Self, (Widget) -> Unit) -> UInt64 = _
  fn connect_show(Self, (Widget) -> Unit) -> UInt64 = _
  fn connect_state_flags_changed(Self, (Widget, StateFlags) -> Unit) -> UInt64 = _
  fn connect_unmap(Self, (Widget) -> Unit) -> UInt64 = _
  fn connect_unrealize(Self, (Widget) -> Unit) -> UInt64 = _
  fn add_tick_callback(Self, (Widget, @gdk.FrameClock) -> Bool) -> Unit = _
}

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

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

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

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

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

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

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

///|
/// Implementation contract for Widget.set_focus_child. Self is the retained MoonBit state; the second parameter is the invoked Widget object.
pub(open) trait VWidgetSetFocusChild {
  fn set_focus_child(Self, Widget, &IWidget?) -> Unit
}

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

///|
/// Implementation contract for Widget.snapshot. Self is the retained MoonBit state; the second parameter is the invoked Widget object.
pub(open) trait VWidgetSnapshot {
  fn snapshot(Self, Widget, &ISnapshot) -> Unit
}

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/type_func.Widget.get_default_direction.html).
pub extern "c" fn Widget::get_default_direction() -> TextDirection = "moonbit_gtk_widget_get_default_direction"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/type_func.Widget.set_default_direction.html).
pub extern "c" fn Widget::set_default_direction(dir : TextDirection) -> Unit = "moonbit_gtk_widget_set_default_direction"

///|
#borrow(self_, action_name)
extern "c" fn moonbit_gtk_widget_action_set_enabled(
  self_ : Widget,
  action_name : Bytes,
  enabled : Bool,
) = "moonbit_gtk_widget_action_set_enabled"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.action_set_enabled.html).
pub fn Widget::action_set_enabled(
  self : Widget,
  action_name : String,
  enabled : Bool,
) -> Unit {
  moonbit_gtk_widget_action_set_enabled(
    self,
    @encoding/utf8.encode(action_name),
    enabled,
  )
}

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

///|
#borrow(self_, name, args)
extern "c" fn moonbit_gtk_widget_activate_action_variant(
  self_ : Widget,
  name : Bytes,
  args : @glib.Nullable[@glib.Variant],
) -> Bool = "moonbit_gtk_widget_activate_action_variant"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.activate_action_variant.html).
pub fn Widget::activate_action_variant(
  self : Widget,
  name : String,
  args : &@glib.IVariant?,
) -> Bool {
  moonbit_gtk_widget_activate_action_variant(
    self,
    @encoding/utf8.encode(name),
    match args {
      Some(v) => @glib.Nullable::some(v.as_variant())
      None => @glib.Nullable::null()
    },
  )
}

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

///|
#borrow(self_, controller)
extern "c" fn moonbit_gtk_widget_add_controller(
  self_ : Widget,
  controller : EventController,
) = "moonbit_gtk_widget_add_controller"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.add_controller.html).
pub fn Widget::add_controller(
  self : Widget,
  controller : &IEventController,
) -> Unit {
  moonbit_gtk_widget_add_controller(self, controller.as_event_controller())
}

///|
#borrow(self_, css_class)
extern "c" fn moonbit_gtk_widget_add_css_class(
  self_ : Widget,
  css_class : Bytes,
) = "moonbit_gtk_widget_add_css_class"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.add_css_class.html).
pub fn Widget::add_css_class(self : Widget, css_class : String) -> Unit {
  moonbit_gtk_widget_add_css_class(self, @encoding/utf8.encode(css_class))
}

///|
#borrow(self_, label)
extern "c" fn moonbit_gtk_widget_add_mnemonic_label(
  self_ : Widget,
  label : Widget,
) = "moonbit_gtk_widget_add_mnemonic_label"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.add_mnemonic_label.html).
pub fn Widget::add_mnemonic_label(self : Widget, label : &IWidget) -> Unit {
  moonbit_gtk_widget_add_mnemonic_label(self, label.as_widget())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.child_focus.html).
#borrow(self)
pub extern "c" fn Widget::child_focus(
  self : Widget,
  direction : DirectionType,
) -> Bool = "moonbit_gtk_widget_child_focus"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.compute_expand.html).
#borrow(self)
pub extern "c" fn Widget::compute_expand(
  self : Widget,
  orientation : Orientation,
) -> Bool = "moonbit_gtk_widget_compute_expand"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.contains.html).
#borrow(self)
pub extern "c" fn Widget::contains(
  self : Widget,
  x : Double,
  y : Double,
) -> Bool = "moonbit_gtk_widget_contains"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.create_pango_context.html).
#borrow(self)
pub extern "c" fn Widget::create_pango_context(self : Widget) -> @pango.Context = "moonbit_gtk_widget_create_pango_context"

///|
#borrow(self_, text)
extern "c" fn moonbit_gtk_widget_create_pango_layout(
  self_ : Widget,
  text : @glib.Nullable[Bytes],
) -> @pango.Layout = "moonbit_gtk_widget_create_pango_layout"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.drag_check_threshold.html).
#borrow(self)
pub extern "c" fn Widget::drag_check_threshold(
  self : Widget,
  start_x : Int,
  start_y : Int,
  current_x : Int,
  current_y : Int,
) -> Bool = "moonbit_gtk_drag_check_threshold"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_baseline.html).
#borrow(self)
pub extern "c" fn Widget::get_baseline(self : Widget) -> Int = "moonbit_gtk_widget_get_baseline"

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_clipboard.html).
#borrow(self)
pub extern "c" fn Widget::get_clipboard(self : Widget) -> @gdk.Clipboard = "moonbit_gtk_widget_get_clipboard"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_get_color(self_ : Widget) -> @gdk.RGBA = "moonbit_gtk_widget_get_color"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_color.html).
pub fn Widget::get_color(self : Widget) -> @gdk.RGBA {
  let __result = moonbit_gtk_widget_get_color(self)
  __result
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_get_css_name(self_ : Widget) -> Bytes = "moonbit_gtk_widget_get_css_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_css_name.html).
pub fn Widget::get_css_name(self : Widget) -> String {
  @encoding/utf8.decode_lossy(moonbit_gtk_widget_get_css_name(self))
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_cursor.html).
pub fn Widget::get_cursor(self : Widget) -> @gdk.Cursor? {
  let raw_result = moonbit_gtk_widget_get_cursor(self)
  raw_result.to_option()
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_display.html).
#borrow(self)
pub extern "c" fn Widget::get_display(self : Widget) -> @gdk.Display = "moonbit_gtk_widget_get_display"

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

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

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

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_font_map.html).
pub fn Widget::get_font_map(self : Widget) -> @pango.FontMap? {
  let raw_result = moonbit_gtk_widget_get_font_map(self)
  raw_result.to_option()
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_frame_clock.html).
pub fn Widget::get_frame_clock(self : Widget) -> @gdk.FrameClock? {
  let raw_result = moonbit_gtk_widget_get_frame_clock(self)
  raw_result.to_option()
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_halign.html).
#borrow(self)
pub extern "c" fn Widget::get_halign(self : Widget) -> Align = "moonbit_gtk_widget_get_halign"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_height.html).
#borrow(self)
pub extern "c" fn Widget::get_height(self : Widget) -> Int = "moonbit_gtk_widget_get_height"

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

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

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

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

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_margin_bottom.html).
#borrow(self)
pub extern "c" fn Widget::get_margin_bottom(self : Widget) -> Int = "moonbit_gtk_widget_get_margin_bottom"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_margin_end.html).
#borrow(self)
pub extern "c" fn Widget::get_margin_end(self : Widget) -> Int = "moonbit_gtk_widget_get_margin_end"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_margin_start.html).
#borrow(self)
pub extern "c" fn Widget::get_margin_start(self : Widget) -> Int = "moonbit_gtk_widget_get_margin_start"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_margin_top.html).
#borrow(self)
pub extern "c" fn Widget::get_margin_top(self : Widget) -> Int = "moonbit_gtk_widget_get_margin_top"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_get_name(self_ : Widget) -> Bytes = "moonbit_gtk_widget_get_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_name.html).
pub fn Widget::get_name(self : Widget) -> String {
  @encoding/utf8.decode_lossy(moonbit_gtk_widget_get_name(self))
}

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_opacity.html).
#borrow(self)
pub extern "c" fn Widget::get_opacity(self : Widget) -> Double = "moonbit_gtk_widget_get_opacity"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_overflow.html).
#borrow(self)
pub extern "c" fn Widget::get_overflow(self : Widget) -> Overflow = "moonbit_gtk_widget_get_overflow"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_pango_context.html).
#borrow(self)
pub extern "c" fn Widget::get_pango_context(self : Widget) -> @pango.Context = "moonbit_gtk_widget_get_pango_context"

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_primary_clipboard.html).
#borrow(self)
pub extern "c" fn Widget::get_primary_clipboard(
  self : Widget,
) -> @gdk.Clipboard = "moonbit_gtk_widget_get_primary_clipboard"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_request_mode.html).
#borrow(self)
pub extern "c" fn Widget::get_request_mode(self : Widget) -> SizeRequestMode = "moonbit_gtk_widget_get_request_mode"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_scale_factor.html).
#borrow(self)
pub extern "c" fn Widget::get_scale_factor(self : Widget) -> Int = "moonbit_gtk_widget_get_scale_factor"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_settings.html).
#borrow(self)
pub extern "c" fn Widget::get_settings(self : Widget) -> Settings = "moonbit_gtk_widget_get_settings"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_size.html).
#borrow(self)
pub extern "c" fn Widget::get_size(
  self : Widget,
  orientation : Orientation,
) -> Int = "moonbit_gtk_widget_get_size"

///|
#borrow(self_, width, height)
extern "c" fn moonbit_gtk_widget_get_size_request(
  self_ : Widget,
  width : Ref[Int],
  height : Ref[Int],
) = "moonbit_gtk_widget_get_size_request"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_size_request.html).
pub fn Widget::get_size_request(self : Widget) -> (Int, Int) {
  let width = Ref(0)
  let height = Ref(0)
  moonbit_gtk_widget_get_size_request(self, width, height)
  (width.val, height.val)
}

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_get_state_flags(self_ : Widget) -> Int = "moonbit_gtk_widget_get_state_flags"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_state_flags.html).
pub fn Widget::get_state_flags(self : Widget) -> StateFlags {
  StateFlags::from_int(moonbit_gtk_widget_get_state_flags(self))
}

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_valign.html).
#borrow(self)
pub extern "c" fn Widget::get_valign(self : Widget) -> Align = "moonbit_gtk_widget_get_valign"

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.get_width.html).
#borrow(self)
pub extern "c" fn Widget::get_width(self : Widget) -> Int = "moonbit_gtk_widget_get_width"

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

///|
#borrow(self_, css_class)
extern "c" fn moonbit_gtk_widget_has_css_class(
  self_ : Widget,
  css_class : Bytes,
) -> Bool = "moonbit_gtk_widget_has_css_class"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.has_css_class.html).
pub fn Widget::has_css_class(self : Widget, css_class : String) -> Bool {
  moonbit_gtk_widget_has_css_class(self, @encoding/utf8.encode(css_class))
}

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

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

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

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

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

///|
#borrow(self_, name, group)
extern "c" fn moonbit_gtk_widget_insert_action_group(
  self_ : Widget,
  name : Bytes,
  group : @glib.Nullable[@gio.ActionGroup],
) = "moonbit_gtk_widget_insert_action_group"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.insert_action_group.html).
pub fn Widget::insert_action_group(
  self : Widget,
  name : String,
  group : &@gio.IActionGroup?,
) -> Unit {
  moonbit_gtk_widget_insert_action_group(
    self,
    @encoding/utf8.encode(name),
    match group {
      Some(v) => @glib.Nullable::some(v.as_action_group())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, parent, previous_sibling)
extern "c" fn moonbit_gtk_widget_insert_after(
  self_ : Widget,
  parent : Widget,
  previous_sibling : @glib.Nullable[Widget],
) = "moonbit_gtk_widget_insert_after"

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

///|
#borrow(self_, parent, next_sibling)
extern "c" fn moonbit_gtk_widget_insert_before(
  self_ : Widget,
  parent : Widget,
  next_sibling : @glib.Nullable[Widget],
) = "moonbit_gtk_widget_insert_before"

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

///|
#borrow(self_, ancestor)
extern "c" fn moonbit_gtk_widget_is_ancestor(
  self_ : Widget,
  ancestor : Widget,
) -> Bool = "moonbit_gtk_widget_is_ancestor"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.is_ancestor.html).
pub fn Widget::is_ancestor(self : Widget, ancestor : &IWidget) -> Bool {
  moonbit_gtk_widget_is_ancestor(self, ancestor.as_widget())
}

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.keynav_failed.html).
#borrow(self)
pub extern "c" fn Widget::keynav_failed(
  self : Widget,
  direction : DirectionType,
) -> Bool = "moonbit_gtk_widget_keynav_failed"

///|
#borrow(self_, result)
extern "c" fn moonbit_gtk_widget_list_mnemonic_labels(
  self_ : Widget,
  result : Ref[FixedArray[Widget]],
) = "moonbit_gtk_widget_list_mnemonic_labels"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.list_mnemonic_labels.html).
pub fn Widget::list_mnemonic_labels(self : Widget) -> Array[Widget] {
  let result_ref : Ref[FixedArray[Widget]] = Ref([])
  moonbit_gtk_widget_list_mnemonic_labels(self, result_ref)
  let values : Array[Widget] = Array::new(capacity=result_ref.val.length())
  for value in result_ref.val {
    values.push(value)
  }
  values
}

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

///|
#borrow(self_, minimum, natural, minimum_baseline, natural_baseline)
extern "c" fn moonbit_gtk_widget_measure(
  self_ : Widget,
  orientation : Orientation,
  for_size : Int,
  minimum : Ref[Int],
  natural : Ref[Int],
  minimum_baseline : Ref[Int],
  natural_baseline : Ref[Int],
) = "moonbit_gtk_widget_measure"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.measure.html).
pub fn Widget::measure(
  self : Widget,
  orientation : Orientation,
  for_size : Int,
) -> (Int, Int, Int, Int) {
  let minimum = Ref(0)
  let natural = Ref(0)
  let minimum_baseline = Ref(0)
  let natural_baseline = Ref(0)
  moonbit_gtk_widget_measure(
    self, orientation, for_size, minimum, natural, minimum_baseline, natural_baseline,
  )
  (minimum.val, natural.val, minimum_baseline.val, natural_baseline.val)
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.observe_children.html).
#borrow(self)
pub extern "c" fn Widget::observe_children(self : Widget) -> @gio.ListModel = "moonbit_gtk_widget_observe_children"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.observe_controllers.html).
#borrow(self)
pub extern "c" fn Widget::observe_controllers(self : Widget) -> @gio.ListModel = "moonbit_gtk_widget_observe_controllers"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_pick(
  self_ : Widget,
  x : Double,
  y : Double,
  flags : Int,
) -> @glib.Nullable[Widget] = "moonbit_gtk_widget_pick"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.pick.html).
pub fn Widget::pick(
  self : Widget,
  x : Double,
  y : Double,
  flags : PickFlags,
) -> Widget? {
  let raw_result = moonbit_gtk_widget_pick(self, x, y, flags.to_int())
  raw_result.to_option()
}

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

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

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

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

///|
#borrow(self_, controller)
extern "c" fn moonbit_gtk_widget_remove_controller(
  self_ : Widget,
  controller : EventController,
) = "moonbit_gtk_widget_remove_controller"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.remove_controller.html).
pub fn Widget::remove_controller(
  self : Widget,
  controller : &IEventController,
) -> Unit {
  moonbit_gtk_widget_remove_controller(self, controller.as_event_controller())
}

///|
#borrow(self_, css_class)
extern "c" fn moonbit_gtk_widget_remove_css_class(
  self_ : Widget,
  css_class : Bytes,
) = "moonbit_gtk_widget_remove_css_class"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.remove_css_class.html).
pub fn Widget::remove_css_class(self : Widget, css_class : String) -> Unit {
  moonbit_gtk_widget_remove_css_class(self, @encoding/utf8.encode(css_class))
}

///|
#borrow(self_, label)
extern "c" fn moonbit_gtk_widget_remove_mnemonic_label(
  self_ : Widget,
  label : Widget,
) = "moonbit_gtk_widget_remove_mnemonic_label"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.remove_mnemonic_label.html).
pub fn Widget::remove_mnemonic_label(self : Widget, label : &IWidget) -> Unit {
  moonbit_gtk_widget_remove_mnemonic_label(self, label.as_widget())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.remove_tick_callback.html).
#borrow(self)
pub extern "c" fn Widget::remove_tick_callback(self : Widget, id : UInt) = "moonbit_gtk_widget_remove_tick_callback"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_can_focus.html).
#borrow(self)
pub extern "c" fn Widget::set_can_focus(self : Widget, can_focus : Bool) = "moonbit_gtk_widget_set_can_focus"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_can_target.html).
#borrow(self)
pub extern "c" fn Widget::set_can_target(self : Widget, can_target : Bool) = "moonbit_gtk_widget_set_can_target"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_child_visible.html).
#borrow(self)
pub extern "c" fn Widget::set_child_visible(
  self : Widget,
  child_visible : Bool,
) = "moonbit_gtk_widget_set_child_visible"

///|
#borrow(self_, __sa_classes)
extern "c" fn moonbit_gtk_widget_set_css_classes(
  self_ : Widget,
  __sa_classes : FixedArray[Bytes],
) = "moonbit_gtk_widget_set_css_classes"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_css_classes.html).
pub fn Widget::set_css_classes(self : Widget, classes : Array[String]) -> Unit {
  moonbit_gtk_widget_set_css_classes(
    self,
    FixedArray::from_array(classes.map(fn(s) { @encoding/utf8.encode(s) })),
  )
}

///|
#borrow(self_, cursor)
extern "c" fn moonbit_gtk_widget_set_cursor(
  self_ : Widget,
  cursor : @glib.Nullable[@gdk.Cursor],
) = "moonbit_gtk_widget_set_cursor"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_cursor.html).
pub fn Widget::set_cursor(self : Widget, cursor : &@gdk.ICursor?) -> Unit {
  moonbit_gtk_widget_set_cursor(
    self,
    match cursor {
      Some(v) => @glib.Nullable::some(v.as_cursor())
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, name)
extern "c" fn moonbit_gtk_widget_set_cursor_from_name(
  self_ : Widget,
  name : @glib.Nullable[Bytes],
) = "moonbit_gtk_widget_set_cursor_from_name"

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_direction.html).
#borrow(self)
pub extern "c" fn Widget::set_direction(self : Widget, dir : TextDirection) = "moonbit_gtk_widget_set_direction"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_focus_on_click.html).
#borrow(self)
pub extern "c" fn Widget::set_focus_on_click(
  self : Widget,
  focus_on_click : Bool,
) = "moonbit_gtk_widget_set_focus_on_click"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_focusable.html).
#borrow(self)
pub extern "c" fn Widget::set_focusable(self : Widget, focusable : Bool) = "moonbit_gtk_widget_set_focusable"

///|
#borrow(self_, font_map)
extern "c" fn moonbit_gtk_widget_set_font_map(
  self_ : Widget,
  font_map : @glib.Nullable[@pango.FontMap],
) = "moonbit_gtk_widget_set_font_map"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_font_map.html).
pub fn Widget::set_font_map(
  self : Widget,
  font_map : &@pango.IFontMap?,
) -> Unit {
  moonbit_gtk_widget_set_font_map(
    self,
    match font_map {
      Some(v) => @glib.Nullable::some(v.as_font_map())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_halign.html).
#borrow(self)
pub extern "c" fn Widget::set_halign(self : Widget, align : Align) = "moonbit_gtk_widget_set_halign"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_has_tooltip.html).
#borrow(self)
pub extern "c" fn Widget::set_has_tooltip(self : Widget, has_tooltip : Bool) = "moonbit_gtk_widget_set_has_tooltip"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_hexpand.html).
#borrow(self)
pub extern "c" fn Widget::set_hexpand(self : Widget, expand : Bool) = "moonbit_gtk_widget_set_hexpand"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_hexpand_set.html).
#borrow(self)
pub extern "c" fn Widget::set_hexpand_set(self : Widget, set : Bool) = "moonbit_gtk_widget_set_hexpand_set"

///|
#borrow(self_, layout_manager)
extern "c" fn moonbit_gtk_widget_set_layout_manager(
  self_ : Widget,
  layout_manager : @glib.Nullable[LayoutManager],
) = "moonbit_gtk_widget_set_layout_manager"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_layout_manager.html).
pub fn Widget::set_layout_manager(
  self : Widget,
  layout_manager : &ILayoutManager?,
) -> Unit {
  moonbit_gtk_widget_set_layout_manager(
    self,
    match layout_manager {
      Some(v) => @glib.Nullable::some(v.as_layout_manager())
      None => @glib.Nullable::null()
    },
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_limit_events.html).
#borrow(self)
pub extern "c" fn Widget::set_limit_events(self : Widget, limit_events : Bool) = "moonbit_gtk_widget_set_limit_events"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_margin_bottom.html).
#borrow(self)
pub extern "c" fn Widget::set_margin_bottom(self : Widget, margin : Int) = "moonbit_gtk_widget_set_margin_bottom"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_margin_end.html).
#borrow(self)
pub extern "c" fn Widget::set_margin_end(self : Widget, margin : Int) = "moonbit_gtk_widget_set_margin_end"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_margin_start.html).
#borrow(self)
pub extern "c" fn Widget::set_margin_start(self : Widget, margin : Int) = "moonbit_gtk_widget_set_margin_start"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_margin_top.html).
#borrow(self)
pub extern "c" fn Widget::set_margin_top(self : Widget, margin : Int) = "moonbit_gtk_widget_set_margin_top"

///|
#borrow(self_, name)
extern "c" fn moonbit_gtk_widget_set_name(self_ : Widget, name : Bytes) = "moonbit_gtk_widget_set_name"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_name.html).
pub fn Widget::set_name(self : Widget, name : String) -> Unit {
  moonbit_gtk_widget_set_name(self, @encoding/utf8.encode(name))
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_opacity.html).
#borrow(self)
pub extern "c" fn Widget::set_opacity(self : Widget, opacity : Double) = "moonbit_gtk_widget_set_opacity"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_overflow.html).
#borrow(self)
pub extern "c" fn Widget::set_overflow(self : Widget, overflow : Overflow) = "moonbit_gtk_widget_set_overflow"

///|
#borrow(self_, parent)
extern "c" fn moonbit_gtk_widget_set_parent(self_ : Widget, parent : Widget) = "moonbit_gtk_widget_set_parent"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_parent.html).
pub fn Widget::set_parent(self : Widget, parent : &IWidget) -> Unit {
  moonbit_gtk_widget_set_parent(self, parent.as_widget())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_receives_default.html).
#borrow(self)
pub extern "c" fn Widget::set_receives_default(
  self : Widget,
  receives_default : Bool,
) = "moonbit_gtk_widget_set_receives_default"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_sensitive.html).
#borrow(self)
pub extern "c" fn Widget::set_sensitive(self : Widget, sensitive : Bool) = "moonbit_gtk_widget_set_sensitive"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_size_request.html).
#borrow(self)
pub extern "c" fn Widget::set_size_request(
  self : Widget,
  width : Int,
  height : Int,
) = "moonbit_gtk_widget_set_size_request"

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_set_state_flags(
  self_ : Widget,
  flags : Int,
  clear : Bool,
) = "moonbit_gtk_widget_set_state_flags"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_state_flags.html).
pub fn Widget::set_state_flags(
  self : Widget,
  flags : StateFlags,
  clear : Bool,
) -> Unit {
  moonbit_gtk_widget_set_state_flags(self, flags.to_int(), clear)
}

///|
#borrow(self_, markup)
extern "c" fn moonbit_gtk_widget_set_tooltip_markup(
  self_ : Widget,
  markup : @glib.Nullable[Bytes],
) = "moonbit_gtk_widget_set_tooltip_markup"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_tooltip_text.html).
pub fn Widget::set_tooltip_text(self : Widget, text : String?) -> Unit {
  moonbit_gtk_widget_set_tooltip_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.Widget.set_valign.html).
#borrow(self)
pub extern "c" fn Widget::set_valign(self : Widget, align : Align) = "moonbit_gtk_widget_set_valign"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_vexpand.html).
#borrow(self)
pub extern "c" fn Widget::set_vexpand(self : Widget, expand : Bool) = "moonbit_gtk_widget_set_vexpand"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_vexpand_set.html).
#borrow(self)
pub extern "c" fn Widget::set_vexpand_set(self : Widget, set : Bool) = "moonbit_gtk_widget_set_vexpand_set"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.set_visible.html).
#borrow(self)
pub extern "c" fn Widget::set_visible(self : Widget, visible : Bool) = "moonbit_gtk_widget_set_visible"

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

///|
#borrow(self_, allocation)
extern "c" fn moonbit_gtk_widget_size_allocate(
  self_ : Widget,
  allocation : @gdk.Rectangle,
  baseline : Int,
) = "moonbit_gtk_widget_size_allocate"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.size_allocate.html).
pub fn Widget::size_allocate(
  self : Widget,
  allocation : @gdk.Rectangle,
  baseline : Int,
) -> Unit {
  moonbit_gtk_widget_size_allocate(self, allocation, baseline)
}

///|
#borrow(self_, child, snapshot)
extern "c" fn moonbit_gtk_widget_snapshot_child(
  self_ : Widget,
  child : Widget,
  snapshot : Snapshot,
) = "moonbit_gtk_widget_snapshot_child"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.snapshot_child.html).
pub fn Widget::snapshot_child(
  self : Widget,
  child : &IWidget,
  snapshot : &ISnapshot,
) -> Unit {
  moonbit_gtk_widget_snapshot_child(
    self,
    child.as_widget(),
    snapshot.as_snapshot(),
  )
}

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

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

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

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

///|
#borrow(self_)
extern "c" fn moonbit_gtk_widget_unset_state_flags(self_ : Widget, flags : Int) = "moonbit_gtk_widget_unset_state_flags"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.unset_state_flags.html).
pub fn Widget::unset_state_flags(self : Widget, flags : StateFlags) -> Unit {
  moonbit_gtk_widget_unset_state_flags(self, flags.to_int())
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_destroy(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_destroy"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.destroy.html).
pub fn Widget::connect_destroy(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_destroy(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_direction_changed(
  instance : Widget,
  function : FuncRef[
    (Widget, TextDirection, (Widget, TextDirection) -> Unit) -> Unit,
  ],
  closure : (Widget, TextDirection) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_direction_changed"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.direction-changed.html).
pub fn Widget::connect_direction_changed(
  self : Widget,
  f : (Widget, TextDirection) -> Unit,
) -> UInt64 {
  gtk_widget_connect_direction_changed(
    self,
    fn(instance_, previous_direction, f) { f(instance_, previous_direction) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_hide(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_hide"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.hide.html).
pub fn Widget::connect_hide(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_hide(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_keynav_failed(
  instance : Widget,
  function : FuncRef[
    (Widget, DirectionType, (Widget, DirectionType) -> Bool) -> Bool,
  ],
  closure : (Widget, DirectionType) -> Bool,
) -> UInt64 = "moonbit_gtk_widget_connect_keynav_failed"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.keynav-failed.html).
pub fn Widget::connect_keynav_failed(
  self : Widget,
  f : (Widget, DirectionType) -> Bool,
) -> UInt64 {
  gtk_widget_connect_keynav_failed(
    self,
    fn(instance_, direction, f) { f(instance_, direction) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_map(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_map"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.map.html).
pub fn Widget::connect_map(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_map(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_mnemonic_activate(
  instance : Widget,
  function : FuncRef[(Widget, Bool, (Widget, Bool) -> Bool) -> Bool],
  closure : (Widget, Bool) -> Bool,
) -> UInt64 = "moonbit_gtk_widget_connect_mnemonic_activate"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.mnemonic-activate.html).
pub fn Widget::connect_mnemonic_activate(
  self : Widget,
  f : (Widget, Bool) -> Bool,
) -> UInt64 {
  gtk_widget_connect_mnemonic_activate(
    self,
    fn(instance_, group_cycling, f) { f(instance_, group_cycling) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_move_focus(
  instance : Widget,
  function : FuncRef[
    (Widget, DirectionType, (Widget, DirectionType) -> Unit) -> Unit,
  ],
  closure : (Widget, DirectionType) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_move_focus"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.move-focus.html).
pub fn Widget::connect_move_focus(
  self : Widget,
  f : (Widget, DirectionType) -> Unit,
) -> UInt64 {
  gtk_widget_connect_move_focus(
    self,
    fn(instance_, direction, f) { f(instance_, direction) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_query_tooltip(
  instance : Widget,
  function : FuncRef[
    (Widget, Int, Int, Bool, Tooltip, (Widget, Int, Int, Bool, Tooltip) -> Bool) -> Bool,
  ],
  closure : (Widget, Int, Int, Bool, Tooltip) -> Bool,
) -> UInt64 = "moonbit_gtk_widget_connect_query_tooltip"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.query-tooltip.html).
pub fn Widget::connect_query_tooltip(
  self : Widget,
  f : (Widget, Int, Int, Bool, Tooltip) -> Bool,
) -> UInt64 {
  gtk_widget_connect_query_tooltip(
    self,
    fn(instance_, x, y, keyboard_mode, tooltip, f) {
      f(instance_, x, y, keyboard_mode, tooltip)
    },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_realize(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_realize"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.realize.html).
pub fn Widget::connect_realize(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_realize(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_show(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_show"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.show.html).
pub fn Widget::connect_show(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_show(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_state_flags_changed(
  instance : Widget,
  function : FuncRef[(Widget, Int, (Widget, StateFlags) -> Unit) -> Unit],
  closure : (Widget, StateFlags) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_state_flags_changed"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.state-flags-changed.html).
pub fn Widget::connect_state_flags_changed(
  self : Widget,
  f : (Widget, StateFlags) -> Unit,
) -> UInt64 {
  gtk_widget_connect_state_flags_changed(
    self,
    fn(instance_, flags, f) { f(instance_, StateFlags::from_int(flags)) },
    f,
  )
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_unmap(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_unmap"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.unmap.html).
pub fn Widget::connect_unmap(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_unmap(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_connect_unrealize(
  instance : Widget,
  function : FuncRef[(Widget, (Widget) -> Unit) -> Unit],
  closure : (Widget) -> Unit,
) -> UInt64 = "moonbit_gtk_widget_connect_unrealize"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/signal.Widget.unrealize.html).
pub fn Widget::connect_unrealize(self : Widget, f : (Widget) -> Unit) -> UInt64 {
  gtk_widget_connect_unrealize(self, fn(instance_, f) { f(instance_) }, f)
}

///|
#borrow(instance)
extern "c" fn gtk_widget_add_tick_callback(
  instance : Widget,
  function : FuncRef[
    (Widget, @gdk.FrameClock, (Widget, @gdk.FrameClock) -> Bool) -> Bool,
  ],
  closure : (Widget, @gdk.FrameClock) -> Bool,
) -> Unit = "moonbit_gtk_widget_add_tick_callback"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Widget.add_tick_callback.html).
pub fn Widget::add_tick_callback(
  self : Widget,
  callback : (Widget, @gdk.FrameClock) -> Bool,
) -> Unit {
  gtk_widget_add_tick_callback(
    self,
    fn(widget, frame_clock, f) { f(widget, frame_clock) },
    callback,
  )
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.Widget.height-request.html).
#borrow(self_)
pub extern "c" fn Widget::get_height_request(self_ : Widget) -> Int = "moonbit_gtk_widget_get_height_request"

///|
#borrow(self_, value)
pub extern "c" fn Widget::set_height_request(self_ : Widget, value : Int) = "moonbit_gtk_widget_set_height_request"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/property.Widget.width-request.html).
#borrow(self_)
pub extern "c" fn Widget::get_width_request(self_ : Widget) -> Int = "moonbit_gtk_widget_get_width_request"

///|
#borrow(self_, value)
pub extern "c" fn Widget::set_width_request(self_ : Widget, value : Int) = "moonbit_gtk_widget_set_width_request"

///|
impl IWidget with fn action_set_enabled(self, action_name, enabled) -> Unit {
  self.as_widget().action_set_enabled(action_name, enabled)
}

///|
impl IWidget with fn activate(self) -> Bool {
  self.as_widget().activate()
}

///|
impl IWidget with fn activate_action_variant(self, name, args) -> Bool {
  self.as_widget().activate_action_variant(name, args)
}

///|
impl IWidget with fn activate_default(self) -> Unit {
  self.as_widget().activate_default()
}

///|
impl IWidget with fn add_controller(self, controller) -> Unit {
  self.as_widget().add_controller(controller)
}

///|
impl IWidget with fn add_css_class(self, css_class) -> Unit {
  self.as_widget().add_css_class(css_class)
}

///|
impl IWidget with fn add_mnemonic_label(self, label) -> Unit {
  self.as_widget().add_mnemonic_label(label)
}

///|
impl IWidget with fn child_focus(self, direction) -> Bool {
  self.as_widget().child_focus(direction)
}

///|
impl IWidget with fn compute_expand(self, orientation) -> Bool {
  self.as_widget().compute_expand(orientation)
}

///|
impl IWidget with fn contains(self, x, y) -> Bool {
  self.as_widget().contains(x, y)
}

///|
impl IWidget with fn create_pango_context(self) -> @pango.Context {
  self.as_widget().create_pango_context()
}

///|
impl IWidget with fn create_pango_layout(self, text) -> @pango.Layout {
  self.as_widget().create_pango_layout(text)
}

///|
impl IWidget with fn drag_check_threshold(
  self,
  start_x,
  start_y,
  current_x,
  current_y,
) -> Bool {
  self.as_widget().drag_check_threshold(start_x, start_y, current_x, current_y)
}

///|
impl IWidget with fn error_bell(self) -> Unit {
  self.as_widget().error_bell()
}

///|
impl IWidget with fn get_baseline(self) -> Int {
  self.as_widget().get_baseline()
}

///|
impl IWidget with fn get_can_focus(self) -> Bool {
  self.as_widget().get_can_focus()
}

///|
impl IWidget with fn get_can_target(self) -> Bool {
  self.as_widget().get_can_target()
}

///|
impl IWidget with fn get_child_visible(self) -> Bool {
  self.as_widget().get_child_visible()
}

///|
impl IWidget with fn get_clipboard(self) -> @gdk.Clipboard {
  self.as_widget().get_clipboard()
}

///|
impl IWidget with fn get_color(self) -> @gdk.RGBA {
  self.as_widget().get_color()
}

///|
impl IWidget with fn get_css_name(self) -> String {
  self.as_widget().get_css_name()
}

///|
impl IWidget with fn get_cursor(self) -> @gdk.Cursor? {
  self.as_widget().get_cursor()
}

///|
impl IWidget with fn get_direction(self) -> TextDirection {
  self.as_widget().get_direction()
}

///|
impl IWidget with fn get_display(self) -> @gdk.Display {
  self.as_widget().get_display()
}

///|
impl IWidget with fn get_first_child(self) -> Widget? {
  self.as_widget().get_first_child()
}

///|
impl IWidget with fn get_focus_child(self) -> Widget? {
  self.as_widget().get_focus_child()
}

///|
impl IWidget with fn get_focus_on_click(self) -> Bool {
  self.as_widget().get_focus_on_click()
}

///|
impl IWidget with fn get_focusable(self) -> Bool {
  self.as_widget().get_focusable()
}

///|
impl IWidget with fn get_font_map(self) -> @pango.FontMap? {
  self.as_widget().get_font_map()
}

///|
impl IWidget with fn get_frame_clock(self) -> @gdk.FrameClock? {
  self.as_widget().get_frame_clock()
}

///|
impl IWidget with fn get_halign(self) -> Align {
  self.as_widget().get_halign()
}

///|
impl IWidget with fn get_has_tooltip(self) -> Bool {
  self.as_widget().get_has_tooltip()
}

///|
impl IWidget with fn get_height(self) -> Int {
  self.as_widget().get_height()
}

///|
impl IWidget with fn get_hexpand(self) -> Bool {
  self.as_widget().get_hexpand()
}

///|
impl IWidget with fn get_hexpand_set(self) -> Bool {
  self.as_widget().get_hexpand_set()
}

///|
impl IWidget with fn get_last_child(self) -> Widget? {
  self.as_widget().get_last_child()
}

///|
impl IWidget with fn get_layout_manager(self) -> LayoutManager? {
  self.as_widget().get_layout_manager()
}

///|
impl IWidget with fn get_limit_events(self) -> Bool {
  self.as_widget().get_limit_events()
}

///|
impl IWidget with fn get_mapped(self) -> Bool {
  self.as_widget().get_mapped()
}

///|
impl IWidget with fn get_margin_bottom(self) -> Int {
  self.as_widget().get_margin_bottom()
}

///|
impl IWidget with fn get_margin_end(self) -> Int {
  self.as_widget().get_margin_end()
}

///|
impl IWidget with fn get_margin_start(self) -> Int {
  self.as_widget().get_margin_start()
}

///|
impl IWidget with fn get_margin_top(self) -> Int {
  self.as_widget().get_margin_top()
}

///|
impl IWidget with fn get_name(self) -> String {
  self.as_widget().get_name()
}

///|
impl IWidget with fn get_native(self) -> Native? {
  self.as_widget().get_native()
}

///|
impl IWidget with fn get_next_sibling(self) -> Widget? {
  self.as_widget().get_next_sibling()
}

///|
impl IWidget with fn get_opacity(self) -> Double {
  self.as_widget().get_opacity()
}

///|
impl IWidget with fn get_overflow(self) -> Overflow {
  self.as_widget().get_overflow()
}

///|
impl IWidget with fn get_pango_context(self) -> @pango.Context {
  self.as_widget().get_pango_context()
}

///|
impl IWidget with fn get_parent(self) -> Widget? {
  self.as_widget().get_parent()
}

///|
impl IWidget with fn get_prev_sibling(self) -> Widget? {
  self.as_widget().get_prev_sibling()
}

///|
impl IWidget with fn get_primary_clipboard(self) -> @gdk.Clipboard {
  self.as_widget().get_primary_clipboard()
}

///|
impl IWidget with fn get_realized(self) -> Bool {
  self.as_widget().get_realized()
}

///|
impl IWidget with fn get_receives_default(self) -> Bool {
  self.as_widget().get_receives_default()
}

///|
impl IWidget with fn get_request_mode(self) -> SizeRequestMode {
  self.as_widget().get_request_mode()
}

///|
impl IWidget with fn get_root(self) -> Root? {
  self.as_widget().get_root()
}

///|
impl IWidget with fn get_scale_factor(self) -> Int {
  self.as_widget().get_scale_factor()
}

///|
impl IWidget with fn get_sensitive(self) -> Bool {
  self.as_widget().get_sensitive()
}

///|
impl IWidget with fn get_settings(self) -> Settings {
  self.as_widget().get_settings()
}

///|
impl IWidget with fn get_size(self, orientation) -> Int {
  self.as_widget().get_size(orientation)
}

///|
impl IWidget with fn get_size_request(self) -> (Int, Int) {
  self.as_widget().get_size_request()
}

///|
impl IWidget with fn get_state_flags(self) -> StateFlags {
  self.as_widget().get_state_flags()
}

///|
impl IWidget with fn get_tooltip_markup(self) -> String? {
  self.as_widget().get_tooltip_markup()
}

///|
impl IWidget with fn get_tooltip_text(self) -> String? {
  self.as_widget().get_tooltip_text()
}

///|
impl IWidget with fn get_valign(self) -> Align {
  self.as_widget().get_valign()
}

///|
impl IWidget with fn get_vexpand(self) -> Bool {
  self.as_widget().get_vexpand()
}

///|
impl IWidget with fn get_vexpand_set(self) -> Bool {
  self.as_widget().get_vexpand_set()
}

///|
impl IWidget with fn get_visible(self) -> Bool {
  self.as_widget().get_visible()
}

///|
impl IWidget with fn get_width(self) -> Int {
  self.as_widget().get_width()
}

///|
impl IWidget with fn grab_focus(self) -> Bool {
  self.as_widget().grab_focus()
}

///|
impl IWidget with fn has_css_class(self, css_class) -> Bool {
  self.as_widget().has_css_class(css_class)
}

///|
impl IWidget with fn has_default(self) -> Bool {
  self.as_widget().has_default()
}

///|
impl IWidget with fn has_focus(self) -> Bool {
  self.as_widget().has_focus()
}

///|
impl IWidget with fn has_visible_focus(self) -> Bool {
  self.as_widget().has_visible_focus()
}

///|
impl IWidget with fn in_destruction(self) -> Bool {
  self.as_widget().in_destruction()
}

///|
impl IWidget with fn init_template(self) -> Unit {
  self.as_widget().init_template()
}

///|
impl IWidget with fn insert_action_group(self, name, group) -> Unit {
  self.as_widget().insert_action_group(name, group)
}

///|
impl IWidget with fn insert_after(self, parent, previous_sibling) -> Unit {
  self.as_widget().insert_after(parent, previous_sibling)
}

///|
impl IWidget with fn insert_before(self, parent, next_sibling) -> Unit {
  self.as_widget().insert_before(parent, next_sibling)
}

///|
impl IWidget with fn is_ancestor(self, ancestor) -> Bool {
  self.as_widget().is_ancestor(ancestor)
}

///|
impl IWidget with fn is_drawable(self) -> Bool {
  self.as_widget().is_drawable()
}

///|
impl IWidget with fn is_focus(self) -> Bool {
  self.as_widget().is_focus()
}

///|
impl IWidget with fn is_sensitive(self) -> Bool {
  self.as_widget().is_sensitive()
}

///|
impl IWidget with fn is_visible(self) -> Bool {
  self.as_widget().is_visible()
}

///|
impl IWidget with fn keynav_failed(self, direction) -> Bool {
  self.as_widget().keynav_failed(direction)
}

///|
impl IWidget with fn list_mnemonic_labels(self) -> Array[Widget] {
  self.as_widget().list_mnemonic_labels()
}

///|
impl IWidget with fn map(self) -> Unit {
  self.as_widget().map()
}

///|
impl IWidget with fn measure(self, orientation, for_size) -> (
  Int,
  Int,
  Int,
  Int,
) {
  self.as_widget().measure(orientation, for_size)
}

///|
impl IWidget with fn mnemonic_activate(self, group_cycling) -> Bool {
  self.as_widget().mnemonic_activate(group_cycling)
}

///|
impl IWidget with fn observe_children(self) -> @gio.ListModel {
  self.as_widget().observe_children()
}

///|
impl IWidget with fn observe_controllers(self) -> @gio.ListModel {
  self.as_widget().observe_controllers()
}

///|
impl IWidget with fn pick(self, x, y, flags) -> Widget? {
  self.as_widget().pick(x, y, flags)
}

///|
impl IWidget with fn queue_allocate(self) -> Unit {
  self.as_widget().queue_allocate()
}

///|
impl IWidget with fn queue_draw(self) -> Unit {
  self.as_widget().queue_draw()
}

///|
impl IWidget with fn queue_resize(self) -> Unit {
  self.as_widget().queue_resize()
}

///|
impl IWidget with fn realize(self) -> Unit {
  self.as_widget().realize()
}

///|
impl IWidget with fn remove_controller(self, controller) -> Unit {
  self.as_widget().remove_controller(controller)
}

///|
impl IWidget with fn remove_css_class(self, css_class) -> Unit {
  self.as_widget().remove_css_class(css_class)
}

///|
impl IWidget with fn remove_mnemonic_label(self, label) -> Unit {
  self.as_widget().remove_mnemonic_label(label)
}

///|
impl IWidget with fn remove_tick_callback(self, id) -> Unit {
  self.as_widget().remove_tick_callback(id)
}

///|
impl IWidget with fn set_can_focus(self, can_focus) -> Unit {
  self.as_widget().set_can_focus(can_focus)
}

///|
impl IWidget with fn set_can_target(self, can_target) -> Unit {
  self.as_widget().set_can_target(can_target)
}

///|
impl IWidget with fn set_child_visible(self, child_visible) -> Unit {
  self.as_widget().set_child_visible(child_visible)
}

///|
impl IWidget with fn set_css_classes(self, classes) -> Unit {
  self.as_widget().set_css_classes(classes)
}

///|
impl IWidget with fn set_cursor(self, cursor) -> Unit {
  self.as_widget().set_cursor(cursor)
}

///|
impl IWidget with fn set_cursor_from_name(self, name) -> Unit {
  self.as_widget().set_cursor_from_name(name)
}

///|
impl IWidget with fn set_direction(self, dir) -> Unit {
  self.as_widget().set_direction(dir)
}

///|
impl IWidget with fn set_focus_child(self, child) -> Unit {
  self.as_widget().set_focus_child(child)
}

///|
impl IWidget with fn set_focus_on_click(self, focus_on_click) -> Unit {
  self.as_widget().set_focus_on_click(focus_on_click)
}

///|
impl IWidget with fn set_focusable(self, focusable) -> Unit {
  self.as_widget().set_focusable(focusable)
}

///|
impl IWidget with fn set_font_map(self, font_map) -> Unit {
  self.as_widget().set_font_map(font_map)
}

///|
impl IWidget with fn set_halign(self, align) -> Unit {
  self.as_widget().set_halign(align)
}

///|
impl IWidget with fn set_has_tooltip(self, has_tooltip) -> Unit {
  self.as_widget().set_has_tooltip(has_tooltip)
}

///|
impl IWidget with fn set_hexpand(self, expand) -> Unit {
  self.as_widget().set_hexpand(expand)
}

///|
impl IWidget with fn set_hexpand_set(self, set) -> Unit {
  self.as_widget().set_hexpand_set(set)
}

///|
impl IWidget with fn set_layout_manager(self, layout_manager) -> Unit {
  self.as_widget().set_layout_manager(layout_manager)
}

///|
impl IWidget with fn set_limit_events(self, limit_events) -> Unit {
  self.as_widget().set_limit_events(limit_events)
}

///|
impl IWidget with fn set_margin_bottom(self, margin) -> Unit {
  self.as_widget().set_margin_bottom(margin)
}

///|
impl IWidget with fn set_margin_end(self, margin) -> Unit {
  self.as_widget().set_margin_end(margin)
}

///|
impl IWidget with fn set_margin_start(self, margin) -> Unit {
  self.as_widget().set_margin_start(margin)
}

///|
impl IWidget with fn set_margin_top(self, margin) -> Unit {
  self.as_widget().set_margin_top(margin)
}

///|
impl IWidget with fn set_name(self, name) -> Unit {
  self.as_widget().set_name(name)
}

///|
impl IWidget with fn set_opacity(self, opacity) -> Unit {
  self.as_widget().set_opacity(opacity)
}

///|
impl IWidget with fn set_overflow(self, overflow) -> Unit {
  self.as_widget().set_overflow(overflow)
}

///|
impl IWidget with fn set_parent(self, parent) -> Unit {
  self.as_widget().set_parent(parent)
}

///|
impl IWidget with fn set_receives_default(self, receives_default) -> Unit {
  self.as_widget().set_receives_default(receives_default)
}

///|
impl IWidget with fn set_sensitive(self, sensitive) -> Unit {
  self.as_widget().set_sensitive(sensitive)
}

///|
impl IWidget with fn set_size_request(self, width, height) -> Unit {
  self.as_widget().set_size_request(width, height)
}

///|
impl IWidget with fn set_state_flags(self, flags, clear) -> Unit {
  self.as_widget().set_state_flags(flags, clear)
}

///|
impl IWidget with fn set_tooltip_markup(self, markup) -> Unit {
  self.as_widget().set_tooltip_markup(markup)
}

///|
impl IWidget with fn set_tooltip_text(self, text) -> Unit {
  self.as_widget().set_tooltip_text(text)
}

///|
impl IWidget with fn set_valign(self, align) -> Unit {
  self.as_widget().set_valign(align)
}

///|
impl IWidget with fn set_vexpand(self, expand) -> Unit {
  self.as_widget().set_vexpand(expand)
}

///|
impl IWidget with fn set_vexpand_set(self, set) -> Unit {
  self.as_widget().set_vexpand_set(set)
}

///|
impl IWidget with fn set_visible(self, visible) -> Unit {
  self.as_widget().set_visible(visible)
}

///|
impl IWidget with fn should_layout(self) -> Bool {
  self.as_widget().should_layout()
}

///|
impl IWidget with fn size_allocate(self, allocation, baseline) -> Unit {
  self.as_widget().size_allocate(allocation, baseline)
}

///|
impl IWidget with fn snapshot_child(self, child, snapshot) -> Unit {
  self.as_widget().snapshot_child(child, snapshot)
}

///|
impl IWidget with fn trigger_tooltip_query(self) -> Unit {
  self.as_widget().trigger_tooltip_query()
}

///|
impl IWidget with fn unmap(self) -> Unit {
  self.as_widget().unmap()
}

///|
impl IWidget with fn unparent(self) -> Unit {
  self.as_widget().unparent()
}

///|
impl IWidget with fn unrealize(self) -> Unit {
  self.as_widget().unrealize()
}

///|
impl IWidget with fn unset_state_flags(self, flags) -> Unit {
  self.as_widget().unset_state_flags(flags)
}

///|
impl IWidget with fn connect_destroy(self, f) -> UInt64 {
  self.as_widget().connect_destroy(f)
}

///|
impl IWidget with fn connect_direction_changed(self, f) -> UInt64 {
  self.as_widget().connect_direction_changed(f)
}

///|
impl IWidget with fn connect_hide(self, f) -> UInt64 {
  self.as_widget().connect_hide(f)
}

///|
impl IWidget with fn connect_keynav_failed(self, f) -> UInt64 {
  self.as_widget().connect_keynav_failed(f)
}

///|
impl IWidget with fn connect_map(self, f) -> UInt64 {
  self.as_widget().connect_map(f)
}

///|
impl IWidget with fn connect_mnemonic_activate(self, f) -> UInt64 {
  self.as_widget().connect_mnemonic_activate(f)
}

///|
impl IWidget with fn connect_move_focus(self, f) -> UInt64 {
  self.as_widget().connect_move_focus(f)
}

///|
impl IWidget with fn connect_query_tooltip(self, f) -> UInt64 {
  self.as_widget().connect_query_tooltip(f)
}

///|
impl IWidget with fn connect_realize(self, f) -> UInt64 {
  self.as_widget().connect_realize(f)
}

///|
impl IWidget with fn connect_show(self, f) -> UInt64 {
  self.as_widget().connect_show(f)
}

///|
impl IWidget with fn connect_state_flags_changed(self, f) -> UInt64 {
  self.as_widget().connect_state_flags_changed(f)
}

///|
impl IWidget with fn connect_unmap(self, f) -> UInt64 {
  self.as_widget().connect_unmap(f)
}

///|
impl IWidget with fn connect_unrealize(self, f) -> UInt64 {
  self.as_widget().connect_unrealize(f)
}

///|
impl IWidget with fn add_tick_callback(self, callback) -> Unit {
  self.as_widget().add_tick_callback(callback)
}

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

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