// Code generated by girgen. DO NOT EDIT.

package adw

import (
	"fmt"
	"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 (
	GTypeInlineViewSwitcherDisplayMode = coreglib.Type(C.adw_inline_view_switcher_display_mode_get_type())
	GTypeInlineViewSwitcher            = coreglib.Type(C.adw_inline_view_switcher_get_type())
)

func init() {
	coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
		coreglib.TypeMarshaler{T: GTypeInlineViewSwitcherDisplayMode, F: marshalInlineViewSwitcherDisplayMode},
		coreglib.TypeMarshaler{T: GTypeInlineViewSwitcher, F: marshalInlineViewSwitcher},
	})
}

// InlineViewSwitcherDisplayMode describes what inlineviewswitcher toggles
// display.
//
// <picture> <source srcset="inline-view-switcher-display-modes-dark.png"
// media="(prefers-color-scheme: dark)"> <img
// src="inline-view-switcher-display-modes.png"
// alt="inline-view-switcher-display-modes"> </picture>.
type InlineViewSwitcherDisplayMode C.gint

const (
	// InlineViewSwitcherLabels toggles only display labels.
	InlineViewSwitcherLabels InlineViewSwitcherDisplayMode = iota
	// InlineViewSwitcherIcons toggles only display icons.
	InlineViewSwitcherIcons
	// InlineViewSwitcherBoth toggles display both icons and labels.
	InlineViewSwitcherBoth
)

func marshalInlineViewSwitcherDisplayMode(p uintptr) (interface{}, error) {
	return InlineViewSwitcherDisplayMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil
}

// String returns the name in string for InlineViewSwitcherDisplayMode.
func (i InlineViewSwitcherDisplayMode) String() string {
	switch i {
	case InlineViewSwitcherLabels:
		return "Labels"
	case InlineViewSwitcherIcons:
		return "Icons"
	case InlineViewSwitcherBoth:
		return "Both"
	default:
		return fmt.Sprintf("InlineViewSwitcherDisplayMode(%d)", i)
	}
}

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

func defaultInlineViewSwitcherOverrides(v *InlineViewSwitcher) InlineViewSwitcherOverrides {
	return InlineViewSwitcherOverrides{}
}

// InlineViewSwitcher: view switcher that uses a toggle group.
//
// <picture> <source srcset="inline-view-switcher-dark.png"
// media="(prefers-color-scheme: dark)"> <img src="inline-view-switcher.png"
// alt="inline-view-switcher"> </picture>
//
// A view switcher showing pages of an viewstack within an togglegroup, similar
// to viewswitcher.
//
// The toggles can display either an icon, a label or both. Use the
// inlineviewswitcher:display-mode to control this.
//
// <picture> <source srcset="inline-view-switcher-display-modes-dark.png"
// media="(prefers-color-scheme: dark)"> <img
// src="inline-view-switcher-display-modes.png"
// alt="inline-view-switcher-display-modes"> </picture>
//
// # CSS nodes
//
// AdwInlineViewSwitcher has a single CSS node with the name
// inline-view-switcher.
//
// # Style classes
//
// Like AdwToggleGroup, it can accept the .flat (style-classes.html#flat_1) and
// .round (style-classes.html#round) style classes.
//
// <picture> <source srcset="inline-view-switcher-style-classes-dark.png"
// media="(prefers-color-scheme: dark)"> <img
// src="inline-view-switcher-style-classes.png"
// alt="inline-view-switcher-style-classes"> </picture>
//
// # Accessibility
//
// The internal toggle group uses the GTK_ACCESSIBLE_ROLE_TAB_LIST role.
// Its toggles use the GTK_ACCESSIBLE_ROLE_TAB role.
type InlineViewSwitcher struct {
	_ [0]func() // equal guard
	gtk.Widget

	*coreglib.Object
	gtk.Orientable
}

var (
	_ gtk.Widgetter     = (*InlineViewSwitcher)(nil)
	_ coreglib.Objector = (*InlineViewSwitcher)(nil)
)

func init() {
	coreglib.RegisterClassInfo[*InlineViewSwitcher, *InlineViewSwitcherClass, InlineViewSwitcherOverrides](
		GTypeInlineViewSwitcher,
		initInlineViewSwitcherClass,
		wrapInlineViewSwitcher,
		defaultInlineViewSwitcherOverrides,
	)
}

func initInlineViewSwitcherClass(gclass unsafe.Pointer, overrides InlineViewSwitcherOverrides, classInitFunc func(*InlineViewSwitcherClass)) {
	if classInitFunc != nil {
		class := (*InlineViewSwitcherClass)(gextras.NewStructNative(gclass))
		classInitFunc(class)
	}
}

func wrapInlineViewSwitcher(obj *coreglib.Object) *InlineViewSwitcher {
	return &InlineViewSwitcher{
		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,
			},
		},
		Object: obj,
		Orientable: gtk.Orientable{
			Object: obj,
		},
	}
}

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

// NewInlineViewSwitcher creates a new AdwInlineViewSwitcher.
//
// The function returns the following values:
//
//   - inlineViewSwitcher: newly created AdwInlineViewSwitcher.
func NewInlineViewSwitcher() *InlineViewSwitcher {
	var _cret *C.GtkWidget // in

	_cret = C.adw_inline_view_switcher_new()

	var _inlineViewSwitcher *InlineViewSwitcher // out

	_inlineViewSwitcher = wrapInlineViewSwitcher(coreglib.Take(unsafe.Pointer(_cret)))

	return _inlineViewSwitcher
}

// CanShrink gets whether the toggles can be smaller than the natural size of
// their contents.
//
// The function returns the following values:
//
//   - ok: whether the toggles can shrink.
func (self *InlineViewSwitcher) CanShrink() bool {
	var _arg0 *C.AdwInlineViewSwitcher // out
	var _cret C.gboolean               // in

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

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

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// DisplayMode gets the display mode of self.
//
// The function returns the following values:
//
//   - inlineViewSwitcherDisplayMode: display mode.
func (self *InlineViewSwitcher) DisplayMode() InlineViewSwitcherDisplayMode {
	var _arg0 *C.AdwInlineViewSwitcher           // out
	var _cret C.AdwInlineViewSwitcherDisplayMode // in

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

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

	var _inlineViewSwitcherDisplayMode InlineViewSwitcherDisplayMode // out

	_inlineViewSwitcherDisplayMode = InlineViewSwitcherDisplayMode(_cret)

	return _inlineViewSwitcherDisplayMode
}

// Homogeneous gets whether all toggles within self take the same size.
//
// The function returns the following values:
//
//   - ok: whether all toggles take the same size.
func (self *InlineViewSwitcher) Homogeneous() bool {
	var _arg0 *C.AdwInlineViewSwitcher // out
	var _cret C.gboolean               // in

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

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

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// Stack gets the stack self controls.
//
// The function returns the following values:
//
//   - viewStack (optional): stack of self.
func (self *InlineViewSwitcher) Stack() *ViewStack {
	var _arg0 *C.AdwInlineViewSwitcher // out
	var _cret *C.AdwViewStack          // in

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

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

	var _viewStack *ViewStack // out

	if _cret != nil {
		_viewStack = wrapViewStack(coreglib.Take(unsafe.Pointer(_cret)))
	}

	return _viewStack
}

// SetCanShrink sets whether the toggles can be smaller than the natural size of
// their contents.
//
// If can_shrink is TRUE, the toggle labels will ellipsize.
//
// See togglegroup:can-shrink.
//
// The function takes the following parameters:
//
//   - canShrink: whether the toggles can shrink.
func (self *InlineViewSwitcher) SetCanShrink(canShrink bool) {
	var _arg0 *C.AdwInlineViewSwitcher // out
	var _arg1 C.gboolean               // out

	_arg0 = (*C.AdwInlineViewSwitcher)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if canShrink {
		_arg1 = C.TRUE
	}

	C.adw_inline_view_switcher_set_can_shrink(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(canShrink)
}

// SetDisplayMode sets the display mode of self.
//
// Determines what the toggles display: a label, an icon or both.
//
// <picture> <source srcset="inline-view-switcher-display-modes-dark.png"
// media="(prefers-color-scheme: dark)"> <img
// src="inline-view-switcher-display-modes.png"
// alt="inline-view-switcher-display-modes"> </picture>.
//
// The function takes the following parameters:
//
//   - mode: display mode.
func (self *InlineViewSwitcher) SetDisplayMode(mode InlineViewSwitcherDisplayMode) {
	var _arg0 *C.AdwInlineViewSwitcher           // out
	var _arg1 C.AdwInlineViewSwitcherDisplayMode // out

	_arg0 = (*C.AdwInlineViewSwitcher)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = C.AdwInlineViewSwitcherDisplayMode(mode)

	C.adw_inline_view_switcher_set_display_mode(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(mode)
}

// SetHomogeneous sets whether all toggles within self take the same size.
//
// The function takes the following parameters:
//
//   - homogeneous: whether all toggles should take the same size.
func (self *InlineViewSwitcher) SetHomogeneous(homogeneous bool) {
	var _arg0 *C.AdwInlineViewSwitcher // out
	var _arg1 C.gboolean               // out

	_arg0 = (*C.AdwInlineViewSwitcher)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if homogeneous {
		_arg1 = C.TRUE
	}

	C.adw_inline_view_switcher_set_homogeneous(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(homogeneous)
}

// SetStack sets the stack to control.
//
// The function takes the following parameters:
//
//   - stack (optional): stack.
func (self *InlineViewSwitcher) SetStack(stack *ViewStack) {
	var _arg0 *C.AdwInlineViewSwitcher // out
	var _arg1 *C.AdwViewStack          // out

	_arg0 = (*C.AdwInlineViewSwitcher)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if stack != nil {
		_arg1 = (*C.AdwViewStack)(unsafe.Pointer(coreglib.InternObject(stack).Native()))
	}

	C.adw_inline_view_switcher_set_stack(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(stack)
}
