1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// Physical parameters of a spring for [class@SpringAnimation].
15//
16// Any spring can be described by three parameters: mass, stiffness and damping.
17//
18// An undamped spring will produce an oscillatory motion which will go on
19// forever.
20//
21// The frequency and amplitude of the oscillations will be determined by the
22// stiffness (how "strong" the spring is) and its mass (how much "inertia" it
23// has).
24//
25// If damping is larger than 0, the amplitude of that oscillating motion will
26// exponientally decrease over time. If that damping is strong enough that the
27// spring can't complete a full oscillation, it's called an overdamped spring.
28//
29// If we the spring can oscillate, it's called an underdamped spring.
30//
31// The value between these two behaviors is called critical damping; a
32// critically damped spring will comes to rest in the minimum possible time
33// without producing oscillations.
34//
35// The damping can be replaced by damping ratio, which produces the following
36// springs:
37//
38// * 0: an undamped spring.
39// * Between 0 and 1: an underdamped spring.
40// * 1: a critically damped spring.
41// * Larger than 1: an overdamped spring.
42//
43// As such
44type SpringParams struct {
45 _ structs.HostLayout
46}
47
48var xSpringParamsGLibType func() types.GType
49
50func SpringParamsGLibType() types.GType {
51 return xSpringParamsGLibType()
52}
53
54func (x *SpringParams) GoPointer() uintptr {
55 return uintptr(unsafe.Pointer(x))
56}
57
58var xNewSpringParams func(float64, float64, float64) *SpringParams
59
60// Creates a new `AdwSpringParams` from @mass, @stiffness and @damping_ratio.
61//
62// The damping value is calculated from @damping_ratio and the other two
63// parameters.
64//
65// - If @damping_ratio is 0, the spring will not be damped and will oscillate
66// endlessly.
67// - If @damping_ratio is between 0 and 1, the spring is underdamped and will
68// always overshoot.
69// - If @damping_ratio is 1, the spring is critically damped and will reach its
70// resting position the quickest way possible.
71// - If @damping_ratio is larger than 1, the spring is overdamped and will reach
72// its resting position faster than it can complete an oscillation.
73//
74// [ctor@SpringParams.new_full] allows to pass a raw damping value instead.
75func NewSpringParams(DampingRatioVar float64, MassVar float64, StiffnessVar float64) *SpringParams {
76
77 cret := xNewSpringParams(DampingRatioVar, MassVar, StiffnessVar)
78 return cret
79}
80
81var xNewSpringParamsFull func(float64, float64, float64) *SpringParams
82
83// Creates a new `AdwSpringParams` from @mass, @stiffness and @damping.
84//
85// See [ctor@SpringParams.new] for a simplified constructor using damping ratio
86// instead of @damping.
87func NewSpringParamsFull(DampingVar float64, MassVar float64, StiffnessVar float64) *SpringParams {
88
89 cret := xNewSpringParamsFull(DampingVar, MassVar, StiffnessVar)
90 return cret
91}
92
93var xSpringParamsGetDamping func(uintptr) float64
94
95// Gets the damping of @self.
96func (x *SpringParams) GetDamping() float64 {
97
98 cret := xSpringParamsGetDamping(x.GoPointer())
99 return cret
100}
101
102var xSpringParamsGetDampingRatio func(uintptr) float64
103
104// Gets the damping ratio of @self.
105func (x *SpringParams) GetDampingRatio() float64 {
106
107 cret := xSpringParamsGetDampingRatio(x.GoPointer())
108 return cret
109}
110
111var xSpringParamsGetMass func(uintptr) float64
112
113// Gets the mass of @self.
114func (x *SpringParams) GetMass() float64 {
115
116 cret := xSpringParamsGetMass(x.GoPointer())
117 return cret
118}
119
120var xSpringParamsGetStiffness func(uintptr) float64
121
122// Gets the stiffness of @self.
123func (x *SpringParams) GetStiffness() float64 {
124
125 cret := xSpringParamsGetStiffness(x.GoPointer())
126 return cret
127}
128
129var xSpringParamsRef func(uintptr) *SpringParams
130
131// Increases the reference count of @self.
132func (x *SpringParams) Ref() *SpringParams {
133
134 cret := xSpringParamsRef(x.GoPointer())
135 return cret
136}
137
138var xSpringParamsUnref func(uintptr)
139
140// Decreases the reference count of @self.
141//
142// If the last reference is dropped, the structure is freed.
143func (x *SpringParams) Unref() {
144
145 xSpringParamsUnref(x.GoPointer())
146
147}
148
149func init() {
150 core.SetPackageName("ADW", "libadwaita-1")
151 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
152 var libs []uintptr
153 for _, libPath := range core.GetPaths("ADW") {
154 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
155 if err != nil {
156 panic(err)
157 }
158 libs = append(libs, lib)
159 }
160
161 core.PuregoSafeRegister(&xSpringParamsGLibType, libs, "adw_spring_params_get_type")
162
163 core.PuregoSafeRegister(&xNewSpringParams, libs, "adw_spring_params_new")
164 core.PuregoSafeRegister(&xNewSpringParamsFull, libs, "adw_spring_params_new_full")
165
166 core.PuregoSafeRegister(&xSpringParamsGetDamping, libs, "adw_spring_params_get_damping")
167 core.PuregoSafeRegister(&xSpringParamsGetDampingRatio, libs, "adw_spring_params_get_damping_ratio")
168 core.PuregoSafeRegister(&xSpringParamsGetMass, libs, "adw_spring_params_get_mass")
169 core.PuregoSafeRegister(&xSpringParamsGetStiffness, libs, "adw_spring_params_get_stiffness")
170 core.PuregoSafeRegister(&xSpringParamsRef, libs, "adw_spring_params_ref")
171 core.PuregoSafeRegister(&xSpringParamsUnref, libs, "adw_spring_params_unref")
172
173}