// Code generated by girgen. DO NOT EDIT.

package adw

import (
	"fmt"
	"runtime"
	"unsafe"

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

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

// GType values.
var (
	GTypeEasing = coreglib.Type(C.adw_easing_get_type())
)

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

// Easing describes the available easing functions for use with timedanimation.
//
// New values may be added to this enumeration over time.
type Easing C.gint

const (
	// Linear: linear tweening.
	Linear Easing = iota
	// EaseInQuad: quadratic tweening.
	EaseInQuad
	// EaseOutQuad: quadratic tweening, inverse of ADW_EASE_IN_QUAD.
	EaseOutQuad
	// EaseInOutQuad: quadratic tweening, combining ADW_EASE_IN_QUAD and
	// ADW_EASE_OUT_QUAD.
	EaseInOutQuad
	// EaseInCubic: cubic tweening.
	EaseInCubic
	// EaseOutCubic: cubic tweening, inverse of ADW_EASE_IN_CUBIC.
	EaseOutCubic
	// EaseInOutCubic: cubic tweening, combining ADW_EASE_IN_CUBIC and
	// ADW_EASE_OUT_CUBIC.
	EaseInOutCubic
	// EaseInQuart: quartic tweening.
	EaseInQuart
	// EaseOutQuart: quartic tweening, inverse of ADW_EASE_IN_QUART.
	EaseOutQuart
	// EaseInOutQuart: quartic tweening, combining ADW_EASE_IN_QUART and
	// ADW_EASE_OUT_QUART.
	EaseInOutQuart
	// EaseInQuint: quintic tweening.
	EaseInQuint
	// EaseOutQuint: quintic tweening, inverse of ADW_EASE_IN_QUINT.
	EaseOutQuint
	// EaseInOutQuint: quintic tweening, combining ADW_EASE_IN_QUINT and
	// ADW_EASE_OUT_QUINT.
	EaseInOutQuint
	// EaseInSine: sine wave tweening.
	EaseInSine
	// EaseOutSine: sine wave tweening, inverse of ADW_EASE_IN_SINE.
	EaseOutSine
	// EaseInOutSine: sine wave tweening, combining ADW_EASE_IN_SINE and
	// ADW_EASE_OUT_SINE.
	EaseInOutSine
	// EaseInExpo: exponential tweening.
	EaseInExpo
	// EaseOutExpo: exponential tweening, inverse of ADW_EASE_IN_EXPO.
	EaseOutExpo
	// EaseInOutExpo: exponential tweening, combining ADW_EASE_IN_EXPO and
	// ADW_EASE_OUT_EXPO.
	EaseInOutExpo
	// EaseInCirc: circular tweening.
	EaseInCirc
	// EaseOutCirc: circular tweening, inverse of ADW_EASE_IN_CIRC.
	EaseOutCirc
	// EaseInOutCirc: circular tweening, combining ADW_EASE_IN_CIRC and
	// ADW_EASE_OUT_CIRC.
	EaseInOutCirc
	// EaseInElastic: elastic tweening, with offshoot on start.
	EaseInElastic
	// EaseOutElastic: elastic tweening, with offshoot on end, inverse of
	// ADW_EASE_IN_ELASTIC.
	EaseOutElastic
	// EaseInOutElastic: elastic tweening, with offshoot on both ends, combining
	// ADW_EASE_IN_ELASTIC and ADW_EASE_OUT_ELASTIC.
	EaseInOutElastic
	// EaseInBack: overshooting cubic tweening, with backtracking on start.
	EaseInBack
	// EaseOutBack: overshooting cubic tweening, with backtracking on end,
	// inverse of ADW_EASE_IN_BACK.
	EaseOutBack
	// EaseInOutBack: overshooting cubic tweening, with backtracking on both
	// ends, combining ADW_EASE_IN_BACK and ADW_EASE_OUT_BACK.
	EaseInOutBack
	// EaseInBounce: exponentially decaying parabolic (bounce) tweening,
	// on start.
	EaseInBounce
	// EaseOutBounce: exponentially decaying parabolic (bounce) tweening,
	// with bounce on end, inverse of ADW_EASE_IN_BOUNCE.
	EaseOutBounce
	// EaseInOutBounce: exponentially decaying parabolic (bounce) tweening,
	// with bounce on both ends, combining ADW_EASE_IN_BOUNCE and
	// ADW_EASE_OUT_BOUNCE.
	EaseInOutBounce
	// Ease: cubic bezier tweening, with control points in (0.25, 0.1) and
	// (0.25, 1.0).
	//
	// Increases in velocity towards the middle of the animation, slowing back
	// down at the end.
	Ease
	// EaseIn: cubic bezier tweening, with control points in (0.42, 0.0) and
	// (1.0, 1.0).
	//
	// Starts off slowly, with the speed of the animation increasing until
	// complete.
	EaseIn
	// EaseOut: cubic bezier tweening, with control points in (0.0, 0.0) and
	// (0.58, 1.0).
	//
	// Starts quickly, slowing down the animation until complete.
	EaseOut
	// EaseInOut: cubic bezier tweening, with control points in (0.42, 0.0) and
	// (0.58, 1.0).
	//
	// Starts off slowly, speeds up in the middle, and then slows down again.
	EaseInOut
)

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

// String returns the name in string for Easing.
func (e Easing) String() string {
	switch e {
	case Linear:
		return "Linear"
	case EaseInQuad:
		return "EaseInQuad"
	case EaseOutQuad:
		return "EaseOutQuad"
	case EaseInOutQuad:
		return "EaseInOutQuad"
	case EaseInCubic:
		return "EaseInCubic"
	case EaseOutCubic:
		return "EaseOutCubic"
	case EaseInOutCubic:
		return "EaseInOutCubic"
	case EaseInQuart:
		return "EaseInQuart"
	case EaseOutQuart:
		return "EaseOutQuart"
	case EaseInOutQuart:
		return "EaseInOutQuart"
	case EaseInQuint:
		return "EaseInQuint"
	case EaseOutQuint:
		return "EaseOutQuint"
	case EaseInOutQuint:
		return "EaseInOutQuint"
	case EaseInSine:
		return "EaseInSine"
	case EaseOutSine:
		return "EaseOutSine"
	case EaseInOutSine:
		return "EaseInOutSine"
	case EaseInExpo:
		return "EaseInExpo"
	case EaseOutExpo:
		return "EaseOutExpo"
	case EaseInOutExpo:
		return "EaseInOutExpo"
	case EaseInCirc:
		return "EaseInCirc"
	case EaseOutCirc:
		return "EaseOutCirc"
	case EaseInOutCirc:
		return "EaseInOutCirc"
	case EaseInElastic:
		return "EaseInElastic"
	case EaseOutElastic:
		return "EaseOutElastic"
	case EaseInOutElastic:
		return "EaseInOutElastic"
	case EaseInBack:
		return "EaseInBack"
	case EaseOutBack:
		return "EaseOutBack"
	case EaseInOutBack:
		return "EaseInOutBack"
	case EaseInBounce:
		return "EaseInBounce"
	case EaseOutBounce:
		return "EaseOutBounce"
	case EaseInOutBounce:
		return "EaseInOutBounce"
	case Ease:
		return "Ease"
	case EaseIn:
		return "EaseIn"
	case EaseOut:
		return "EaseOut"
	case EaseInOut:
		return "EaseInOut"
	default:
		return fmt.Sprintf("Easing(%d)", e)
	}
}

// EasingEase computes easing with easing for value.
//
// value should generally be in the [0, 1] range.
//
// The function takes the following parameters:
//
//   - self: easing value.
//   - value to ease.
//
// The function returns the following values:
//
//   - gdouble: easing for value.
func EasingEase(self Easing, value float64) float64 {
	var _arg1 C.AdwEasing // out
	var _arg2 C.double    // out
	var _cret C.double    // in

	_arg1 = C.AdwEasing(self)
	_arg2 = C.double(value)

	_cret = C.adw_easing_ease(_arg1, _arg2)
	runtime.KeepAlive(self)
	runtime.KeepAlive(value)

	var _gdouble float64 // out

	_gdouble = float64(_cret)

	return _gdouble
}
