1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// `GBindingGroup` can be used to bind multiple properties
15// from an object collectively.
16//
17// Use the various methods to bind properties from a single source
18// object to multiple destination objects. Properties can be bound
19// bidirectionally and are connected when the source object is set
20// with [method@GObject.BindingGroup.set_source].
21type BindingGroup struct {
22 Object
23}
24
25var xBindingGroupGLibType func() types.GType
26
27func BindingGroupGLibType() types.GType {
28 return xBindingGroupGLibType()
29}
30
31func BindingGroupNewFromInternalPtr(ptr uintptr) *BindingGroup {
32 cls := &BindingGroup{}
33 cls.Ptr = ptr
34 return cls
35}
36
37var xNewBindingGroup func() uintptr
38
39// Creates a new #GBindingGroup.
40func NewBindingGroup() *BindingGroup {
41 var cls *BindingGroup
42
43 cret := xNewBindingGroup()
44
45 if cret == 0 {
46 return nil
47 }
48 cls = &BindingGroup{}
49 cls.Ptr = cret
50 return cls
51}
52
53var xBindingGroupBind func(uintptr, string, uintptr, string, BindingFlags)
54
55// Creates a binding between @source_property on the source object
56// and @target_property on @target. Whenever the @source_property
57// is changed the @target_property is updated using the same value.
58// The binding flag %G_BINDING_SYNC_CREATE is automatically specified.
59//
60// See g_object_bind_property() for more information.
61func (x *BindingGroup) Bind(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags) {
62
63 xBindingGroupBind(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar)
64
65}
66
67var xBindingGroupBindFull func(uintptr, string, uintptr, string, BindingFlags, uintptr, uintptr, uintptr, uintptr)
68
69// Creates a binding between @source_property on the source object and
70// @target_property on @target, allowing you to set the transformation
71// functions to be used by the binding. The binding flag
72// %G_BINDING_SYNC_CREATE is automatically specified.
73//
74// See g_object_bind_property_full() for more information.
75func (x *BindingGroup) BindFull(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags, TransformToVar *BindingTransformFunc, TransformFromVar *BindingTransformFunc, UserDataVar uintptr, UserDataDestroyVar *glib.DestroyNotify) {
76
77 var TransformToVarRef uintptr
78 if TransformToVar != nil {
79 TransformToVarPtr := uintptr(unsafe.Pointer(TransformToVar))
80 if cbRefPtr, ok := glib.GetCallback(TransformToVarPtr); ok {
81 TransformToVarRef = cbRefPtr
82 } else {
83 fcb := func(arg0 uintptr, arg1 *Value, arg2 *Value, arg3 uintptr) bool {
84 cbFn := *TransformToVar
85 return cbFn(arg0, arg1, arg2, arg3)
86 }
87 TransformToVarRef = purego.NewCallback(fcb)
88 glib.SaveCallbackWithClosure(TransformToVarPtr, TransformToVarRef, TransformToVar)
89 }
90 }
91
92 var TransformFromVarRef uintptr
93 if TransformFromVar != nil {
94 TransformFromVarPtr := uintptr(unsafe.Pointer(TransformFromVar))
95 if cbRefPtr, ok := glib.GetCallback(TransformFromVarPtr); ok {
96 TransformFromVarRef = cbRefPtr
97 } else {
98 fcb := func(arg0 uintptr, arg1 *Value, arg2 *Value, arg3 uintptr) bool {
99 cbFn := *TransformFromVar
100 return cbFn(arg0, arg1, arg2, arg3)
101 }
102 TransformFromVarRef = purego.NewCallback(fcb)
103 glib.SaveCallbackWithClosure(TransformFromVarPtr, TransformFromVarRef, TransformFromVar)
104 }
105 }
106
107 var UserDataDestroyVarRef uintptr
108 if UserDataDestroyVar != nil {
109 UserDataDestroyVarPtr := uintptr(unsafe.Pointer(UserDataDestroyVar))
110 if cbRefPtr, ok := glib.GetCallback(UserDataDestroyVarPtr); ok {
111 UserDataDestroyVarRef = cbRefPtr
112 } else {
113 fcb := func(arg0 uintptr) {
114 cbFn := *UserDataDestroyVar
115 cbFn(arg0)
116 }
117 UserDataDestroyVarRef = purego.NewCallback(fcb)
118 glib.SaveCallbackWithClosure(UserDataDestroyVarPtr, UserDataDestroyVarRef, UserDataDestroyVar)
119 }
120 }
121
122 xBindingGroupBindFull(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar, TransformToVarRef, TransformFromVarRef, UserDataVar, UserDataDestroyVarRef)
123
124}
125
126var xBindingGroupBindWithClosures func(uintptr, string, uintptr, string, BindingFlags, *Closure, *Closure)
127
128// Creates a binding between @source_property on the source object and
129// @target_property on @target, allowing you to set the transformation
130// functions to be used by the binding. The binding flag
131// %G_BINDING_SYNC_CREATE is automatically specified.
132//
133// This function is the language bindings friendly version of
134// g_binding_group_bind_property_full(), using #GClosures
135// instead of function pointers.
136//
137// See g_object_bind_property_with_closures() for more information.
138func (x *BindingGroup) BindWithClosures(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags, TransformToVar *Closure, TransformFromVar *Closure) {
139
140 xBindingGroupBindWithClosures(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar, TransformToVar, TransformFromVar)
141
142}
143
144var xBindingGroupDupSource func(uintptr) uintptr
145
146// Gets the source object used for binding properties.
147func (x *BindingGroup) DupSource() *Object {
148 var cls *Object
149
150 cret := xBindingGroupDupSource(x.GoPointer())
151
152 if cret == 0 {
153 return nil
154 }
155 IncreaseRef(cret)
156 cls = &Object{}
157 cls.Ptr = cret
158 return cls
159}
160
161var xBindingGroupSetSource func(uintptr, uintptr)
162
163// Sets @source as the source object used for creating property
164// bindings. If there is already a source object all bindings from it
165// will be removed.
166//
167// Note that all properties that have been bound must exist on @source.
168func (x *BindingGroup) SetSource(SourceVar *Object) {
169
170 xBindingGroupSetSource(x.GoPointer(), SourceVar.GoPointer())
171
172}
173
174func (c *BindingGroup) GoPointer() uintptr {
175 if c == nil {
176 return 0
177 }
178 return c.Ptr
179}
180
181func (c *BindingGroup) SetGoPointer(ptr uintptr) {
182 c.Ptr = ptr
183}
184
185func init() {
186 core.SetPackageName("GOBJECT", "gobject-2.0")
187 core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
188 var libs []uintptr
189 for _, libPath := range core.GetPaths("GOBJECT") {
190 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
191 if err != nil {
192 panic(err)
193 }
194 libs = append(libs, lib)
195 }
196
197 core.PuregoSafeRegister(&xBindingGroupGLibType, libs, "g_binding_group_get_type")
198
199 core.PuregoSafeRegister(&xNewBindingGroup, libs, "g_binding_group_new")
200
201 core.PuregoSafeRegister(&xBindingGroupBind, libs, "g_binding_group_bind")
202 core.PuregoSafeRegister(&xBindingGroupBindFull, libs, "g_binding_group_bind_full")
203 core.PuregoSafeRegister(&xBindingGroupBindWithClosures, libs, "g_binding_group_bind_with_closures")
204 core.PuregoSafeRegister(&xBindingGroupDupSource, libs, "g_binding_group_dup_source")
205 core.PuregoSafeRegister(&xBindingGroupSetSource, libs, "g_binding_group_set_source")
206
207}