// GENERATED — DO NOT EDIT

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

///|
pub(open) trait ILayoutManager {
  fn as_layout_manager(Self) -> LayoutManager
  fn allocate(Self, &IWidget, Int, Int, Int) -> Unit = _
  fn get_layout_child(Self, &IWidget) -> LayoutChild = _
  fn get_request_mode(Self) -> SizeRequestMode = _
  fn get_widget(Self) -> Widget? = _
  fn layout_changed(Self) -> Unit = _
  fn measure(Self, &IWidget, Orientation, Int) -> (Int, Int, Int, Int) = _
}

///|
pub impl ILayoutManager for LayoutManager with fn as_layout_manager(self) {
  self
}

///|
/// Implementation contract for LayoutManager.allocate. Self is the retained MoonBit state; the second parameter is the invoked LayoutManager object.
pub(open) trait VLayoutManagerAllocate {
  fn allocate(Self, LayoutManager, &IWidget, Int, Int, Int) -> Unit
}

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

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

///|
#borrow(self_, widget)
extern "c" fn moonbit_gtk_layout_manager_allocate(
  self_ : LayoutManager,
  widget : Widget,
  width : Int,
  height : Int,
  baseline : Int,
) = "moonbit_gtk_layout_manager_allocate"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.LayoutManager.allocate.html).
pub fn LayoutManager::allocate(
  self : LayoutManager,
  widget : &IWidget,
  width : Int,
  height : Int,
  baseline : Int,
) -> Unit {
  moonbit_gtk_layout_manager_allocate(
    self,
    widget.as_widget(),
    width,
    height,
    baseline,
  )
}

///|
#borrow(self_, child)
extern "c" fn moonbit_gtk_layout_manager_get_layout_child(
  self_ : LayoutManager,
  child : Widget,
) -> LayoutChild = "moonbit_gtk_layout_manager_get_layout_child"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.LayoutManager.get_layout_child.html).
pub fn LayoutManager::get_layout_child(
  self : LayoutManager,
  child : &IWidget,
) -> LayoutChild {
  moonbit_gtk_layout_manager_get_layout_child(self, child.as_widget())
}

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

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

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

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.LayoutManager.measure.html).
pub fn LayoutManager::measure(
  self : LayoutManager,
  widget : &IWidget,
  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_layout_manager_measure(
    self,
    widget.as_widget(),
    orientation,
    for_size,
    minimum,
    natural,
    minimum_baseline,
    natural_baseline,
  )
  (minimum.val, natural.val, minimum_baseline.val, natural_baseline.val)
}

///|
impl ILayoutManager with fn allocate(self, widget, width, height, baseline) -> Unit {
  self.as_layout_manager().allocate(widget, width, height, baseline)
}

///|
impl ILayoutManager with fn get_layout_child(self, child) -> LayoutChild {
  self.as_layout_manager().get_layout_child(child)
}

///|
impl ILayoutManager with fn get_request_mode(self) -> SizeRequestMode {
  self.as_layout_manager().get_request_mode()
}

///|
impl ILayoutManager with fn get_widget(self) -> Widget? {
  self.as_layout_manager().get_widget()
}

///|
impl ILayoutManager with fn layout_changed(self) -> Unit {
  self.as_layout_manager().layout_changed()
}

///|
impl ILayoutManager with fn measure(self, widget, orientation, for_size) -> (
  Int,
  Int,
  Int,
  Int,
) {
  self.as_layout_manager().measure(widget, orientation, for_size)
}

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

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