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"
12 "github.com/bnema/puregotk/v4/gobject/types"
13 "github.com/bnema/puregotk/v4/gtk"
14)
15
16type TimedAnimationClass struct {
17 _ structs.HostLayout
18}
19
20func (x *TimedAnimationClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24// A time-based [class@Animation].
25//
26// `AdwTimedAnimation` implements a simple animation interpolating the given
27// value from [property@TimedAnimation:value-from] to
28// [property@TimedAnimation:value-to] over
29// [property@TimedAnimation:duration] milliseconds using the curve described by
30// [property@TimedAnimation:easing].
31//
32// If [property@TimedAnimation:reverse] is set to `TRUE`, `AdwTimedAnimation`
33// will instead animate from [property@TimedAnimation:value-to] to
34// [property@TimedAnimation:value-from], and the easing curve will be inverted.
35//
36// The animation can repeat a certain amount of times, or endlessly, depending
37// on the [property@TimedAnimation:repeat-count] value. If
38// [property@TimedAnimation:alternate] is set to `TRUE`, it will also change the
39// direction every other iteration.
40type TimedAnimation struct {
41 Animation
42}
43
44var xTimedAnimationGLibType func() types.GType
45
46func TimedAnimationGLibType() types.GType {
47 return xTimedAnimationGLibType()
48}
49
50func TimedAnimationNewFromInternalPtr(ptr uintptr) *TimedAnimation {
51 cls := &TimedAnimation{}
52 cls.Ptr = ptr
53 return cls
54}
55
56var xNewTimedAnimation func(uintptr, float64, float64, uint, uintptr) uintptr
57
58// Creates a new `AdwTimedAnimation` on @widget to animate @target from @from
59// to @to.
60func NewTimedAnimation(WidgetVar *gtk.Widget, FromVar float64, ToVar float64, DurationVar uint, TargetVar *AnimationTarget) *TimedAnimation {
61 var cls *TimedAnimation
62
63 cret := xNewTimedAnimation(WidgetVar.GoPointer(), FromVar, ToVar, DurationVar, TargetVar.GoPointer())
64
65 if cret == 0 {
66 return nil
67 }
68 gobject.IncreaseRef(cret)
69 cls = &TimedAnimation{}
70 cls.Ptr = cret
71 return cls
72}
73
74var xTimedAnimationGetAlternate func(uintptr) bool
75
76// Gets whether @self changes direction on every iteration.
77func (x *TimedAnimation) GetAlternate() bool {
78
79 cret := xTimedAnimationGetAlternate(x.GoPointer())
80 return cret
81}
82
83var xTimedAnimationGetDuration func(uintptr) uint
84
85// Gets the duration of @self.
86func (x *TimedAnimation) GetDuration() uint {
87
88 cret := xTimedAnimationGetDuration(x.GoPointer())
89 return cret
90}
91
92var xTimedAnimationGetEasing func(uintptr) Easing
93
94// Gets the easing function @self uses.
95func (x *TimedAnimation) GetEasing() Easing {
96
97 cret := xTimedAnimationGetEasing(x.GoPointer())
98 return cret
99}
100
101var xTimedAnimationGetRepeatCount func(uintptr) uint
102
103// Gets the number of times @self will play.
104func (x *TimedAnimation) GetRepeatCount() uint {
105
106 cret := xTimedAnimationGetRepeatCount(x.GoPointer())
107 return cret
108}
109
110var xTimedAnimationGetReverse func(uintptr) bool
111
112// Gets whether @self plays backwards.
113func (x *TimedAnimation) GetReverse() bool {
114
115 cret := xTimedAnimationGetReverse(x.GoPointer())
116 return cret
117}
118
119var xTimedAnimationGetValueFrom func(uintptr) float64
120
121// Gets the value @self will animate from.
122func (x *TimedAnimation) GetValueFrom() float64 {
123
124 cret := xTimedAnimationGetValueFrom(x.GoPointer())
125 return cret
126}
127
128var xTimedAnimationGetValueTo func(uintptr) float64
129
130// Gets the value @self will animate to.
131func (x *TimedAnimation) GetValueTo() float64 {
132
133 cret := xTimedAnimationGetValueTo(x.GoPointer())
134 return cret
135}
136
137var xTimedAnimationSetAlternate func(uintptr, bool)
138
139// Sets whether @self changes direction on every iteration.
140func (x *TimedAnimation) SetAlternate(AlternateVar bool) {
141
142 xTimedAnimationSetAlternate(x.GoPointer(), AlternateVar)
143
144}
145
146var xTimedAnimationSetDuration func(uintptr, uint)
147
148// Sets the duration of @self.
149//
150// If the animation repeats more than once, sets the duration of one iteration.
151func (x *TimedAnimation) SetDuration(DurationVar uint) {
152
153 xTimedAnimationSetDuration(x.GoPointer(), DurationVar)
154
155}
156
157var xTimedAnimationSetEasing func(uintptr, Easing)
158
159// Sets the easing function @self will use.
160//
161// See [enum@Easing] for the description of specific easing functions.
162func (x *TimedAnimation) SetEasing(EasingVar Easing) {
163
164 xTimedAnimationSetEasing(x.GoPointer(), EasingVar)
165
166}
167
168var xTimedAnimationSetRepeatCount func(uintptr, uint)
169
170// Sets the number of times @self will play.
171//
172// If set to 0, @self will repeat endlessly.
173func (x *TimedAnimation) SetRepeatCount(RepeatCountVar uint) {
174
175 xTimedAnimationSetRepeatCount(x.GoPointer(), RepeatCountVar)
176
177}
178
179var xTimedAnimationSetReverse func(uintptr, bool)
180
181// Sets whether @self plays backwards.
182func (x *TimedAnimation) SetReverse(ReverseVar bool) {
183
184 xTimedAnimationSetReverse(x.GoPointer(), ReverseVar)
185
186}
187
188var xTimedAnimationSetValueFrom func(uintptr, float64)
189
190// Sets the value @self will animate from.
191//
192// The animation will start at this value and end at
193// [property@TimedAnimation:value-to].
194//
195// If [property@TimedAnimation:reverse] is `TRUE`, the animation will end at
196// this value instead.
197func (x *TimedAnimation) SetValueFrom(ValueVar float64) {
198
199 xTimedAnimationSetValueFrom(x.GoPointer(), ValueVar)
200
201}
202
203var xTimedAnimationSetValueTo func(uintptr, float64)
204
205// Sets the value @self will animate to.
206//
207// The animation will start at [property@TimedAnimation:value-from] and end at
208// this value.
209//
210// If [property@TimedAnimation:reverse] is `TRUE`, the animation will start
211// at this value instead.
212func (x *TimedAnimation) SetValueTo(ValueVar float64) {
213
214 xTimedAnimationSetValueTo(x.GoPointer(), ValueVar)
215
216}
217
218func (c *TimedAnimation) GoPointer() uintptr {
219 if c == nil {
220 return 0
221 }
222 return c.Ptr
223}
224
225func (c *TimedAnimation) SetGoPointer(ptr uintptr) {
226 c.Ptr = ptr
227}
228
229// SetPropertyAlternate sets the "alternate" property.
230// Whether the animation changes direction on every iteration.
231func (x *TimedAnimation) SetPropertyAlternate(value bool) {
232 var v gobject.Value
233 v.Init(gobject.TypeBooleanVal)
234 v.SetBoolean(value)
235 x.SetProperty("alternate", &v)
236}
237
238// GetPropertyAlternate gets the "alternate" property.
239// Whether the animation changes direction on every iteration.
240func (x *TimedAnimation) GetPropertyAlternate() bool {
241 var v gobject.Value
242 x.GetProperty("alternate", &v)
243 return v.GetBoolean()
244}
245
246// SetPropertyDuration sets the "duration" property.
247// Duration of the animation, in milliseconds.
248//
249// Describes how much time the animation will take.
250//
251// If the animation repeats more than once, describes the duration of one
252// iteration.
253func (x *TimedAnimation) SetPropertyDuration(value uint) {
254 var v gobject.Value
255 v.Init(gobject.TypeUintVal)
256 v.SetUint(value)
257 x.SetProperty("duration", &v)
258}
259
260// GetPropertyDuration gets the "duration" property.
261// Duration of the animation, in milliseconds.
262//
263// Describes how much time the animation will take.
264//
265// If the animation repeats more than once, describes the duration of one
266// iteration.
267func (x *TimedAnimation) GetPropertyDuration() uint {
268 var v gobject.Value
269 x.GetProperty("duration", &v)
270 return v.GetUint()
271}
272
273// SetPropertyRepeatCount sets the "repeat-count" property.
274// Number of times the animation will play.
275//
276// If set to 0, the animation will repeat endlessly.
277func (x *TimedAnimation) SetPropertyRepeatCount(value uint) {
278 var v gobject.Value
279 v.Init(gobject.TypeUintVal)
280 v.SetUint(value)
281 x.SetProperty("repeat-count", &v)
282}
283
284// GetPropertyRepeatCount gets the "repeat-count" property.
285// Number of times the animation will play.
286//
287// If set to 0, the animation will repeat endlessly.
288func (x *TimedAnimation) GetPropertyRepeatCount() uint {
289 var v gobject.Value
290 x.GetProperty("repeat-count", &v)
291 return v.GetUint()
292}
293
294// SetPropertyReverse sets the "reverse" property.
295// Whether the animation plays backwards.
296func (x *TimedAnimation) SetPropertyReverse(value bool) {
297 var v gobject.Value
298 v.Init(gobject.TypeBooleanVal)
299 v.SetBoolean(value)
300 x.SetProperty("reverse", &v)
301}
302
303// GetPropertyReverse gets the "reverse" property.
304// Whether the animation plays backwards.
305func (x *TimedAnimation) GetPropertyReverse() bool {
306 var v gobject.Value
307 x.GetProperty("reverse", &v)
308 return v.GetBoolean()
309}
310
311// SetPropertyValueFrom sets the "value-from" property.
312// The value to animate from.
313//
314// The animation will start at this value and end at
315// [property@TimedAnimation:value-to].
316//
317// If [property@TimedAnimation:reverse] is `TRUE`, the animation will end at
318// this value instead.
319func (x *TimedAnimation) SetPropertyValueFrom(value float64) {
320 var v gobject.Value
321 v.Init(gobject.TypeDoubleVal)
322 v.SetDouble(value)
323 x.SetProperty("value-from", &v)
324}
325
326// GetPropertyValueFrom gets the "value-from" property.
327// The value to animate from.
328//
329// The animation will start at this value and end at
330// [property@TimedAnimation:value-to].
331//
332// If [property@TimedAnimation:reverse] is `TRUE`, the animation will end at
333// this value instead.
334func (x *TimedAnimation) GetPropertyValueFrom() float64 {
335 var v gobject.Value
336 x.GetProperty("value-from", &v)
337 return v.GetDouble()
338}
339
340// SetPropertyValueTo sets the "value-to" property.
341// The value to animate to.
342//
343// The animation will start at [property@TimedAnimation:value-from] and end at
344// this value.
345//
346// If [property@TimedAnimation:reverse] is `TRUE`, the animation will start
347// at this value instead.
348func (x *TimedAnimation) SetPropertyValueTo(value float64) {
349 var v gobject.Value
350 v.Init(gobject.TypeDoubleVal)
351 v.SetDouble(value)
352 x.SetProperty("value-to", &v)
353}
354
355// GetPropertyValueTo gets the "value-to" property.
356// The value to animate to.
357//
358// The animation will start at [property@TimedAnimation:value-from] and end at
359// this value.
360//
361// If [property@TimedAnimation:reverse] is `TRUE`, the animation will start
362// at this value instead.
363func (x *TimedAnimation) GetPropertyValueTo() float64 {
364 var v gobject.Value
365 x.GetProperty("value-to", &v)
366 return v.GetDouble()
367}
368
369func init() {
370 core.SetPackageName("ADW", "libadwaita-1")
371 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
372 var libs []uintptr
373 for _, libPath := range core.GetPaths("ADW") {
374 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
375 if err != nil {
376 panic(err)
377 }
378 libs = append(libs, lib)
379 }
380
381 core.PuregoSafeRegister(&xTimedAnimationGLibType, libs, "adw_timed_animation_get_type")
382
383 core.PuregoSafeRegister(&xNewTimedAnimation, libs, "adw_timed_animation_new")
384
385 core.PuregoSafeRegister(&xTimedAnimationGetAlternate, libs, "adw_timed_animation_get_alternate")
386 core.PuregoSafeRegister(&xTimedAnimationGetDuration, libs, "adw_timed_animation_get_duration")
387 core.PuregoSafeRegister(&xTimedAnimationGetEasing, libs, "adw_timed_animation_get_easing")
388 core.PuregoSafeRegister(&xTimedAnimationGetRepeatCount, libs, "adw_timed_animation_get_repeat_count")
389 core.PuregoSafeRegister(&xTimedAnimationGetReverse, libs, "adw_timed_animation_get_reverse")
390 core.PuregoSafeRegister(&xTimedAnimationGetValueFrom, libs, "adw_timed_animation_get_value_from")
391 core.PuregoSafeRegister(&xTimedAnimationGetValueTo, libs, "adw_timed_animation_get_value_to")
392 core.PuregoSafeRegister(&xTimedAnimationSetAlternate, libs, "adw_timed_animation_set_alternate")
393 core.PuregoSafeRegister(&xTimedAnimationSetDuration, libs, "adw_timed_animation_set_duration")
394 core.PuregoSafeRegister(&xTimedAnimationSetEasing, libs, "adw_timed_animation_set_easing")
395 core.PuregoSafeRegister(&xTimedAnimationSetRepeatCount, libs, "adw_timed_animation_set_repeat_count")
396 core.PuregoSafeRegister(&xTimedAnimationSetReverse, libs, "adw_timed_animation_set_reverse")
397 core.PuregoSafeRegister(&xTimedAnimationSetValueFrom, libs, "adw_timed_animation_set_value_from")
398 core.PuregoSafeRegister(&xTimedAnimationSetValueTo, libs, "adw_timed_animation_set_value_to")
399
400}