// Code generated by girgen. DO NOT EDIT.

package adw

import (
	"unsafe"

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

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

//export _gotk4_adw1_TabView_ConnectClosePage
func _gotk4_adw1_TabView_ConnectClosePage(arg0 C.gpointer, arg1 *C.AdwTabPage, arg2 C.guintptr) (cret C.gboolean) {
	var f func(page *TabPage) (ok bool)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func(page *TabPage) (ok bool))
	}

	var _page *TabPage // out

	_page = wrapTabPage(coreglib.Take(unsafe.Pointer(arg1)))

	ok := f(_page)

	var _ bool

	if ok {
		cret = C.TRUE
	}

	return cret
}

//export _gotk4_adw1_TabView_ConnectCreateWindow
func _gotk4_adw1_TabView_ConnectCreateWindow(arg0 C.gpointer, arg1 C.guintptr) (cret *C.AdwTabView) {
	var f func() (tabView *TabView)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func() (tabView *TabView))
	}

	tabView := f()

	var _ *TabView

	if tabView != nil {
		cret = (*C.AdwTabView)(unsafe.Pointer(coreglib.InternObject(tabView).Native()))
	}

	return cret
}

//export _gotk4_adw1_TabView_ConnectIndicatorActivated
func _gotk4_adw1_TabView_ConnectIndicatorActivated(arg0 C.gpointer, arg1 *C.AdwTabPage, arg2 C.guintptr) {
	var f func(page *TabPage)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func(page *TabPage))
	}

	var _page *TabPage // out

	_page = wrapTabPage(coreglib.Take(unsafe.Pointer(arg1)))

	f(_page)
}

//export _gotk4_adw1_TabView_ConnectPageAttached
func _gotk4_adw1_TabView_ConnectPageAttached(arg0 C.gpointer, arg1 *C.AdwTabPage, arg2 C.gint, arg3 C.guintptr) {
	var f func(page *TabPage, position int)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func(page *TabPage, position int))
	}

	var _page *TabPage // out
	var _position int  // out

	_page = wrapTabPage(coreglib.Take(unsafe.Pointer(arg1)))
	_position = int(arg2)

	f(_page, _position)
}

//export _gotk4_adw1_TabView_ConnectPageDetached
func _gotk4_adw1_TabView_ConnectPageDetached(arg0 C.gpointer, arg1 *C.AdwTabPage, arg2 C.gint, arg3 C.guintptr) {
	var f func(page *TabPage, position int)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func(page *TabPage, position int))
	}

	var _page *TabPage // out
	var _position int  // out

	_page = wrapTabPage(coreglib.Take(unsafe.Pointer(arg1)))
	_position = int(arg2)

	f(_page, _position)
}

//export _gotk4_adw1_TabView_ConnectPageReordered
func _gotk4_adw1_TabView_ConnectPageReordered(arg0 C.gpointer, arg1 *C.AdwTabPage, arg2 C.gint, arg3 C.guintptr) {
	var f func(page *TabPage, position int)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func(page *TabPage, position int))
	}

	var _page *TabPage // out
	var _position int  // out

	_page = wrapTabPage(coreglib.Take(unsafe.Pointer(arg1)))
	_position = int(arg2)

	f(_page, _position)
}

//export _gotk4_adw1_TabView_ConnectSetupMenu
func _gotk4_adw1_TabView_ConnectSetupMenu(arg0 C.gpointer, arg1 *C.AdwTabPage, arg2 C.guintptr) {
	var f func(page *TabPage)
	{
		closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2))
		if closure == nil {
			panic("given unknown closure user_data")
		}
		defer closure.TryRepanic()

		f = closure.Func.(func(page *TabPage))
	}

	var _page *TabPage // out

	if arg1 != nil {
		_page = wrapTabPage(coreglib.Take(unsafe.Pointer(arg1)))
	}

	f(_page)
}
