// Code generated by girgen. DO NOT EDIT.

package adw

import (
	"runtime"
	"unsafe"

	"github.com/diamondburned/gotk4/pkg/core/gextras"
	coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
	"github.com/diamondburned/gotk4/pkg/gtk/v4"
)

// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
import "C"

// GType values.
var (
	GTypeLayoutSlot = coreglib.Type(C.adw_layout_slot_get_type())
)

func init() {
	coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
		coreglib.TypeMarshaler{T: GTypeLayoutSlot, F: marshalLayoutSlot},
	})
}

// LayoutSlotOverrides contains methods that are overridable.
type LayoutSlotOverrides struct {
}

func defaultLayoutSlotOverrides(v *LayoutSlot) LayoutSlotOverrides {
	return LayoutSlotOverrides{}
}

// LayoutSlot: child slot within layout.
//
// While it contains a layout child, the gtk.Widget:visible property of the slot
// is updated to match that of the layout child.
//
// See multilayoutview.
type LayoutSlot struct {
	_ [0]func() // equal guard
	gtk.Widget
}

var (
	_ gtk.Widgetter = (*LayoutSlot)(nil)
)

func init() {
	coreglib.RegisterClassInfo[*LayoutSlot, *LayoutSlotClass, LayoutSlotOverrides](
		GTypeLayoutSlot,
		initLayoutSlotClass,
		wrapLayoutSlot,
		defaultLayoutSlotOverrides,
	)
}

func initLayoutSlotClass(gclass unsafe.Pointer, overrides LayoutSlotOverrides, classInitFunc func(*LayoutSlotClass)) {
	if classInitFunc != nil {
		class := (*LayoutSlotClass)(gextras.NewStructNative(gclass))
		classInitFunc(class)
	}
}

func wrapLayoutSlot(obj *coreglib.Object) *LayoutSlot {
	return &LayoutSlot{
		Widget: gtk.Widget{
			InitiallyUnowned: coreglib.InitiallyUnowned{
				Object: obj,
			},
			Object: obj,
			Accessible: gtk.Accessible{
				Object: obj,
			},
			Buildable: gtk.Buildable{
				Object: obj,
			},
			ConstraintTarget: gtk.ConstraintTarget{
				Object: obj,
			},
		},
	}
}

func marshalLayoutSlot(p uintptr) (interface{}, error) {
	return wrapLayoutSlot(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}

// NewLayoutSlot creates a new AdwLayoutSlot with its ID set to id.
//
// The function takes the following parameters:
//
//   - id: slot ID.
//
// The function returns the following values:
//
//   - layoutSlot: new AdwLayoutSlot.
func NewLayoutSlot(id string) *LayoutSlot {
	var _arg1 *C.char      // out
	var _cret *C.GtkWidget // in

	_arg1 = (*C.char)(unsafe.Pointer(C.CString(id)))
	defer C.free(unsafe.Pointer(_arg1))

	_cret = C.adw_layout_slot_new(_arg1)
	runtime.KeepAlive(id)

	var _layoutSlot *LayoutSlot // out

	_layoutSlot = wrapLayoutSlot(coreglib.Take(unsafe.Pointer(_cret)))

	return _layoutSlot
}

// SlotID gets the slot id of self.
//
// The function returns the following values:
//
//   - utf8: slot ID.
func (self *LayoutSlot) SlotID() string {
	var _arg0 *C.AdwLayoutSlot // out
	var _cret *C.char          // in

	_arg0 = (*C.AdwLayoutSlot)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_layout_slot_get_slot_id(_arg0)
	runtime.KeepAlive(self)

	var _utf8 string // out

	_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))

	return _utf8
}
