// GENERATED — DO NOT EDIT

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

///|
pub(open) trait IStack {
  fn as_stack(Self) -> Stack
  fn add_child(Self, &IWidget) -> StackPage = _
  fn add_named(Self, &IWidget, String?) -> StackPage = _
  fn add_titled(Self, &IWidget, String?, String) -> StackPage = _
  fn get_child_by_name(Self, String) -> Widget? = _
  fn get_hhomogeneous(Self) -> Bool = _
  fn get_interpolate_size(Self) -> Bool = _
  fn get_page(Self, &IWidget) -> StackPage = _
  fn get_pages(Self) -> SelectionModel = _
  fn get_transition_duration(Self) -> UInt = _
  fn get_transition_running(Self) -> Bool = _
  fn get_transition_type(Self) -> StackTransitionType = _
  fn get_vhomogeneous(Self) -> Bool = _
  fn get_visible_child(Self) -> Widget? = _
  fn get_visible_child_name(Self) -> String? = _
  fn remove(Self, &IWidget) -> Unit = _
  fn set_hhomogeneous(Self, Bool) -> Unit = _
  fn set_interpolate_size(Self, Bool) -> Unit = _
  fn set_transition_duration(Self, UInt) -> Unit = _
  fn set_transition_type(Self, StackTransitionType) -> Unit = _
  fn set_vhomogeneous(Self, Bool) -> Unit = _
  fn set_visible_child(Self, &IWidget) -> Unit = _
  fn set_visible_child_full(Self, String, StackTransitionType) -> Unit = _
  fn set_visible_child_name(Self, String) -> Unit = _
}

///|
pub impl IStack for Stack with fn as_stack(self) {
  self
}

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

///|
#borrow(self_, child)
extern "c" fn moonbit_gtk_stack_add_child(
  self_ : Stack,
  child : Widget,
) -> StackPage = "moonbit_gtk_stack_add_child"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.add_child.html).
pub fn Stack::add_child(self : Stack, child : &IWidget) -> StackPage {
  moonbit_gtk_stack_add_child(self, child.as_widget())
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.add_named.html).
pub fn Stack::add_named(
  self : Stack,
  child : &IWidget,
  name : String?,
) -> StackPage {
  moonbit_gtk_stack_add_named(
    self,
    child.as_widget(),
    match name {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
  )
}

///|
#borrow(self_, child, name, title)
extern "c" fn moonbit_gtk_stack_add_titled(
  self_ : Stack,
  child : Widget,
  name : @glib.Nullable[Bytes],
  title : Bytes,
) -> StackPage = "moonbit_gtk_stack_add_titled"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.add_titled.html).
pub fn Stack::add_titled(
  self : Stack,
  child : &IWidget,
  name : String?,
  title : String,
) -> StackPage {
  moonbit_gtk_stack_add_titled(
    self,
    child.as_widget(),
    match name {
      Some(s) => @glib.Nullable::some(@encoding/utf8.encode(s))
      None => @glib.Nullable::null()
    },
    @encoding/utf8.encode(title),
  )
}

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.get_child_by_name.html).
pub fn Stack::get_child_by_name(self : Stack, name : String) -> Widget? {
  let raw_result = moonbit_gtk_stack_get_child_by_name(
    self,
    @encoding/utf8.encode(name),
  )
  raw_result.to_option()
}

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

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

///|
#borrow(self_, child)
extern "c" fn moonbit_gtk_stack_get_page(
  self_ : Stack,
  child : Widget,
) -> StackPage = "moonbit_gtk_stack_get_page"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.get_page.html).
pub fn Stack::get_page(self : Stack, child : &IWidget) -> StackPage {
  moonbit_gtk_stack_get_page(self, child.as_widget())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.get_pages.html).
#borrow(self)
pub extern "c" fn Stack::get_pages(self : Stack) -> SelectionModel = "moonbit_gtk_stack_get_pages"

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

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

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.get_transition_type.html).
#borrow(self)
pub extern "c" fn Stack::get_transition_type(
  self : Stack,
) -> StackTransitionType = "moonbit_gtk_stack_get_transition_type"

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

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

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

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

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

///|
#borrow(self_, child)
extern "c" fn moonbit_gtk_stack_remove(self_ : Stack, child : Widget) = "moonbit_gtk_stack_remove"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.remove.html).
pub fn Stack::remove(self : Stack, child : &IWidget) -> Unit {
  moonbit_gtk_stack_remove(self, child.as_widget())
}

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.set_hhomogeneous.html).
#borrow(self)
pub extern "c" fn Stack::set_hhomogeneous(self : Stack, hhomogeneous : Bool) = "moonbit_gtk_stack_set_hhomogeneous"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.set_interpolate_size.html).
#borrow(self)
pub extern "c" fn Stack::set_interpolate_size(
  self : Stack,
  interpolate_size : Bool,
) = "moonbit_gtk_stack_set_interpolate_size"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.set_transition_duration.html).
#borrow(self)
pub extern "c" fn Stack::set_transition_duration(self : Stack, duration : UInt) = "moonbit_gtk_stack_set_transition_duration"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.set_transition_type.html).
#borrow(self)
pub extern "c" fn Stack::set_transition_type(
  self : Stack,
  transition : StackTransitionType,
) = "moonbit_gtk_stack_set_transition_type"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.set_vhomogeneous.html).
#borrow(self)
pub extern "c" fn Stack::set_vhomogeneous(self : Stack, vhomogeneous : Bool) = "moonbit_gtk_stack_set_vhomogeneous"

///|
#borrow(self_, child)
extern "c" fn moonbit_gtk_stack_set_visible_child(
  self_ : Stack,
  child : Widget,
) = "moonbit_gtk_stack_set_visible_child"

///|
/// [Upstream documentation](https://docs.gtk.org/gtk4/method.Stack.set_visible_child.html).
pub fn Stack::set_visible_child(self : Stack, child : &IWidget) -> Unit {
  moonbit_gtk_stack_set_visible_child(self, child.as_widget())
}

///|
#borrow(self_, name)
extern "c" fn moonbit_gtk_stack_set_visible_child_full(
  self_ : Stack,
  name : Bytes,
  transition : StackTransitionType,
) = "moonbit_gtk_stack_set_visible_child_full"

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

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

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

///|
impl IStack with fn add_child(self, child) -> StackPage {
  self.as_stack().add_child(child)
}

///|
impl IStack with fn add_named(self, child, name) -> StackPage {
  self.as_stack().add_named(child, name)
}

///|
impl IStack with fn add_titled(self, child, name, title) -> StackPage {
  self.as_stack().add_titled(child, name, title)
}

///|
impl IStack with fn get_child_by_name(self, name) -> Widget? {
  self.as_stack().get_child_by_name(name)
}

///|
impl IStack with fn get_hhomogeneous(self) -> Bool {
  self.as_stack().get_hhomogeneous()
}

///|
impl IStack with fn get_interpolate_size(self) -> Bool {
  self.as_stack().get_interpolate_size()
}

///|
impl IStack with fn get_page(self, child) -> StackPage {
  self.as_stack().get_page(child)
}

///|
impl IStack with fn get_pages(self) -> SelectionModel {
  self.as_stack().get_pages()
}

///|
impl IStack with fn get_transition_duration(self) -> UInt {
  self.as_stack().get_transition_duration()
}

///|
impl IStack with fn get_transition_running(self) -> Bool {
  self.as_stack().get_transition_running()
}

///|
impl IStack with fn get_transition_type(self) -> StackTransitionType {
  self.as_stack().get_transition_type()
}

///|
impl IStack with fn get_vhomogeneous(self) -> Bool {
  self.as_stack().get_vhomogeneous()
}

///|
impl IStack with fn get_visible_child(self) -> Widget? {
  self.as_stack().get_visible_child()
}

///|
impl IStack with fn get_visible_child_name(self) -> String? {
  self.as_stack().get_visible_child_name()
}

///|
impl IStack with fn remove(self, child) -> Unit {
  self.as_stack().remove(child)
}

///|
impl IStack with fn set_hhomogeneous(self, hhomogeneous) -> Unit {
  self.as_stack().set_hhomogeneous(hhomogeneous)
}

///|
impl IStack with fn set_interpolate_size(self, interpolate_size) -> Unit {
  self.as_stack().set_interpolate_size(interpolate_size)
}

///|
impl IStack with fn set_transition_duration(self, duration) -> Unit {
  self.as_stack().set_transition_duration(duration)
}

///|
impl IStack with fn set_transition_type(self, transition) -> Unit {
  self.as_stack().set_transition_type(transition)
}

///|
impl IStack with fn set_vhomogeneous(self, vhomogeneous) -> Unit {
  self.as_stack().set_vhomogeneous(vhomogeneous)
}

///|
impl IStack with fn set_visible_child(self, child) -> Unit {
  self.as_stack().set_visible_child(child)
}

///|
impl IStack with fn set_visible_child_full(self, name, transition) -> Unit {
  self.as_stack().set_visible_child_full(name, transition)
}

///|
impl IStack with fn set_visible_child_name(self, name) -> Unit {
  self.as_stack().set_visible_child_name(name)
}

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

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

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

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