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/glib"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16// Prototype for animation targets based on user callbacks.
17type AnimationTargetFunc func(float64, uintptr)
18
19type AnimationTargetClass struct {
20 _ structs.HostLayout
21}
22
23func (x *AnimationTargetClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27type CallbackAnimationTargetClass struct {
28 _ structs.HostLayout
29}
30
31func (x *CallbackAnimationTargetClass) GoPointer() uintptr {
32 return uintptr(unsafe.Pointer(x))
33}
34
35type PropertyAnimationTargetClass struct {
36 _ structs.HostLayout
37}
38
39func (x *PropertyAnimationTargetClass) GoPointer() uintptr {
40 return uintptr(unsafe.Pointer(x))
41}
42
43// Represents a value [class@Animation] can animate.
44type AnimationTarget struct {
45 gobject.Object
46}
47
48var xAnimationTargetGLibType func() types.GType
49
50func AnimationTargetGLibType() types.GType {
51 return xAnimationTargetGLibType()
52}
53
54func AnimationTargetNewFromInternalPtr(ptr uintptr) *AnimationTarget {
55 cls := &AnimationTarget{}
56 cls.Ptr = ptr
57 return cls
58}
59
60func (c *AnimationTarget) GoPointer() uintptr {
61 if c == nil {
62 return 0
63 }
64 return c.Ptr
65}
66
67func (c *AnimationTarget) SetGoPointer(ptr uintptr) {
68 c.Ptr = ptr
69}
70
71// An [class@AnimationTarget] that calls a given callback during the
72// animation.
73type CallbackAnimationTarget struct {
74 AnimationTarget
75}
76
77var xCallbackAnimationTargetGLibType func() types.GType
78
79func CallbackAnimationTargetGLibType() types.GType {
80 return xCallbackAnimationTargetGLibType()
81}
82
83func CallbackAnimationTargetNewFromInternalPtr(ptr uintptr) *CallbackAnimationTarget {
84 cls := &CallbackAnimationTarget{}
85 cls.Ptr = ptr
86 return cls
87}
88
89var xNewCallbackAnimationTarget func(uintptr, uintptr, uintptr) uintptr
90
91// Creates a new `AdwAnimationTarget` that calls the given @callback during
92// the animation.
93func NewCallbackAnimationTarget(CallbackVar *AnimationTargetFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) *CallbackAnimationTarget {
94 var cls *CallbackAnimationTarget
95
96 var CallbackVarRef uintptr
97 if CallbackVar != nil {
98 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
99 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
100 CallbackVarRef = cbRefPtr
101 } else {
102 fcb := func(arg0 float64, arg1 uintptr) {
103 cbFn := *CallbackVar
104 cbFn(arg0, arg1)
105 }
106 CallbackVarRef = purego.NewCallback(fcb)
107 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
108 }
109 }
110
111 var DestroyVarRef uintptr
112 if DestroyVar != nil {
113 DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
114 if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
115 DestroyVarRef = cbRefPtr
116 } else {
117 fcb := func(arg0 uintptr) {
118 cbFn := *DestroyVar
119 cbFn(arg0)
120 }
121 DestroyVarRef = purego.NewCallback(fcb)
122 glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
123 }
124 }
125
126 cret := xNewCallbackAnimationTarget(CallbackVarRef, UserDataVar, DestroyVarRef)
127
128 if cret == 0 {
129 return nil
130 }
131 cls = &CallbackAnimationTarget{}
132 cls.Ptr = cret
133 return cls
134}
135
136func (c *CallbackAnimationTarget) GoPointer() uintptr {
137 if c == nil {
138 return 0
139 }
140 return c.Ptr
141}
142
143func (c *CallbackAnimationTarget) SetGoPointer(ptr uintptr) {
144 c.Ptr = ptr
145}
146
147// An [class@AnimationTarget] changing the value of a property of a
148// [class@GObject.Object] instance.
149type PropertyAnimationTarget struct {
150 AnimationTarget
151}
152
153var xPropertyAnimationTargetGLibType func() types.GType
154
155func PropertyAnimationTargetGLibType() types.GType {
156 return xPropertyAnimationTargetGLibType()
157}
158
159func PropertyAnimationTargetNewFromInternalPtr(ptr uintptr) *PropertyAnimationTarget {
160 cls := &PropertyAnimationTarget{}
161 cls.Ptr = ptr
162 return cls
163}
164
165var xNewPropertyAnimationTarget func(uintptr, string) uintptr
166
167// Creates a new `AdwPropertyAnimationTarget` for the @property_name property on
168// @object.
169func NewPropertyAnimationTarget(ObjectVar *gobject.Object, PropertyNameVar string) *PropertyAnimationTarget {
170 var cls *PropertyAnimationTarget
171
172 cret := xNewPropertyAnimationTarget(ObjectVar.GoPointer(), PropertyNameVar)
173
174 if cret == 0 {
175 return nil
176 }
177 cls = &PropertyAnimationTarget{}
178 cls.Ptr = cret
179 return cls
180}
181
182var xNewPropertyAnimationTargetForPspec func(uintptr, uintptr) uintptr
183
184// Creates a new `AdwPropertyAnimationTarget` for the @pspec property on
185// @object.
186func NewPropertyAnimationTargetForPspec(ObjectVar *gobject.Object, PspecVar *gobject.ParamSpec) *PropertyAnimationTarget {
187 var cls *PropertyAnimationTarget
188
189 cret := xNewPropertyAnimationTargetForPspec(ObjectVar.GoPointer(), PspecVar.GoPointer())
190
191 if cret == 0 {
192 return nil
193 }
194 cls = &PropertyAnimationTarget{}
195 cls.Ptr = cret
196 return cls
197}
198
199var xPropertyAnimationTargetGetObject func(uintptr) uintptr
200
201// Gets the object animated by @self.
202//
203// The `AdwPropertyAnimationTarget` instance does not hold a strong reference on
204// the object; make sure the object is kept alive throughout the target's
205// lifetime.
206func (x *PropertyAnimationTarget) GetObject() *gobject.Object {
207 var cls *gobject.Object
208
209 cret := xPropertyAnimationTargetGetObject(x.GoPointer())
210
211 if cret == 0 {
212 return nil
213 }
214 gobject.IncreaseRef(cret)
215 cls = &gobject.Object{}
216 cls.Ptr = cret
217 return cls
218}
219
220var xPropertyAnimationTargetGetPspec func(uintptr) uintptr
221
222// Gets the `GParamSpec` of the property animated by @self.
223func (x *PropertyAnimationTarget) GetPspec() *gobject.ParamSpec {
224 var cls *gobject.ParamSpec
225
226 cret := xPropertyAnimationTargetGetPspec(x.GoPointer())
227
228 if cret == 0 {
229 return nil
230 }
231 gobject.IncreaseRef(cret)
232 cls = &gobject.ParamSpec{}
233 cls.Ptr = cret
234 return cls
235}
236
237func (c *PropertyAnimationTarget) GoPointer() uintptr {
238 if c == nil {
239 return 0
240 }
241 return c.Ptr
242}
243
244func (c *PropertyAnimationTarget) SetGoPointer(ptr uintptr) {
245 c.Ptr = ptr
246}
247
248func init() {
249 core.SetPackageName("ADW", "libadwaita-1")
250 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
251 var libs []uintptr
252 for _, libPath := range core.GetPaths("ADW") {
253 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
254 if err != nil {
255 panic(err)
256 }
257 libs = append(libs, lib)
258 }
259
260 core.PuregoSafeRegister(&xAnimationTargetGLibType, libs, "adw_animation_target_get_type")
261
262 core.PuregoSafeRegister(&xCallbackAnimationTargetGLibType, libs, "adw_callback_animation_target_get_type")
263
264 core.PuregoSafeRegister(&xNewCallbackAnimationTarget, libs, "adw_callback_animation_target_new")
265
266 core.PuregoSafeRegister(&xPropertyAnimationTargetGLibType, libs, "adw_property_animation_target_get_type")
267
268 core.PuregoSafeRegister(&xNewPropertyAnimationTarget, libs, "adw_property_animation_target_new")
269 core.PuregoSafeRegister(&xNewPropertyAnimationTargetForPspec, libs, "adw_property_animation_target_new_for_pspec")
270
271 core.PuregoSafeRegister(&xPropertyAnimationTargetGetObject, libs, "adw_property_animation_target_get_object")
272 core.PuregoSafeRegister(&xPropertyAnimationTargetGetPspec, libs, "adw_property_animation_target_get_pspec")
273
274}