1// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gobject
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/types"
13)
14
15// The class structure for the GParamSpec type.
16// Normally, GParamSpec classes are filled by
17// g_param_type_register_static().
18type ParamSpecClass struct {
19 _ structs.HostLayout
20
21 GTypeClass uintptr
22
23 ValueType types.GType
24
25 xFinalize uintptr
26
27 xValueSetDefault uintptr
28
29 xValueValidate uintptr
30
31 xValuesCmp uintptr
32
33 xValueIsValid uintptr
34
35 Dummy [3]uintptr
36}
37
38func (x *ParamSpecClass) GoPointer() uintptr {
39 return uintptr(unsafe.Pointer(x))
40}
41
42// OverrideFinalize sets the "finalize" callback function.
43// The instance finalization function (optional), should chain
44//
45// up to the finalize method of the parent class.
46func (x *ParamSpecClass) OverrideFinalize(cb func(*ParamSpec)) {
47 if cb == nil {
48 x.xFinalize = 0
49 } else {
50 x.xFinalize = purego.NewCallback(func(PspecVarp uintptr) {
51 cb(ParamSpecNewFromInternalPtr(PspecVarp))
52 })
53 }
54}
55
56// GetFinalize gets the "finalize" callback function.
57// The instance finalization function (optional), should chain
58//
59// up to the finalize method of the parent class.
60func (x *ParamSpecClass) GetFinalize() func(*ParamSpec) {
61 if x.xFinalize == 0 {
62 return nil
63 }
64 var rawCallback func(PspecVarp uintptr)
65 purego.RegisterFunc(&rawCallback, x.xFinalize)
66 return func(PspecVar *ParamSpec) {
67 rawCallback(PspecVar.GoPointer())
68 }
69}
70
71// OverrideValueSetDefault sets the "value_set_default" callback function.
72// Resets a @value to the default value for this type
73//
74// (recommended, the default is g_value_reset()), see
75// g_param_value_set_default().
76func (x *ParamSpecClass) OverrideValueSetDefault(cb func(*ParamSpec, *Value)) {
77 if cb == nil {
78 x.xValueSetDefault = 0
79 } else {
80 x.xValueSetDefault = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) {
81 cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp)
82 })
83 }
84}
85
86// GetValueSetDefault gets the "value_set_default" callback function.
87// Resets a @value to the default value for this type
88//
89// (recommended, the default is g_value_reset()), see
90// g_param_value_set_default().
91func (x *ParamSpecClass) GetValueSetDefault() func(*ParamSpec, *Value) {
92 if x.xValueSetDefault == 0 {
93 return nil
94 }
95 var rawCallback func(PspecVarp uintptr, ValueVarp *Value)
96 purego.RegisterFunc(&rawCallback, x.xValueSetDefault)
97 return func(PspecVar *ParamSpec, ValueVar *Value) {
98 rawCallback(PspecVar.GoPointer(), ValueVar)
99 }
100}
101
102// OverrideValueValidate sets the "value_validate" callback function.
103// Ensures that the contents of @value comply with the
104//
105// specifications set out by this type (optional), see
106// g_param_value_validate().
107func (x *ParamSpecClass) OverrideValueValidate(cb func(*ParamSpec, *Value) bool) {
108 if cb == nil {
109 x.xValueValidate = 0
110 } else {
111 x.xValueValidate = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) bool {
112 return cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp)
113 })
114 }
115}
116
117// GetValueValidate gets the "value_validate" callback function.
118// Ensures that the contents of @value comply with the
119//
120// specifications set out by this type (optional), see
121// g_param_value_validate().
122func (x *ParamSpecClass) GetValueValidate() func(*ParamSpec, *Value) bool {
123 if x.xValueValidate == 0 {
124 return nil
125 }
126 var rawCallback func(PspecVarp uintptr, ValueVarp *Value) bool
127 purego.RegisterFunc(&rawCallback, x.xValueValidate)
128 return func(PspecVar *ParamSpec, ValueVar *Value) bool {
129 return rawCallback(PspecVar.GoPointer(), ValueVar)
130 }
131}
132
133// OverrideValuesCmp sets the "values_cmp" callback function.
134// Compares @value1 with @value2 according to this type
135//
136// (recommended, the default is memcmp()), see g_param_values_cmp().
137func (x *ParamSpecClass) OverrideValuesCmp(cb func(*ParamSpec, *Value, *Value) int) {
138 if cb == nil {
139 x.xValuesCmp = 0
140 } else {
141 x.xValuesCmp = purego.NewCallback(func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int {
142 return cb(ParamSpecNewFromInternalPtr(PspecVarp), Value1Varp, Value2Varp)
143 })
144 }
145}
146
147// GetValuesCmp gets the "values_cmp" callback function.
148// Compares @value1 with @value2 according to this type
149//
150// (recommended, the default is memcmp()), see g_param_values_cmp().
151func (x *ParamSpecClass) GetValuesCmp() func(*ParamSpec, *Value, *Value) int {
152 if x.xValuesCmp == 0 {
153 return nil
154 }
155 var rawCallback func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int
156 purego.RegisterFunc(&rawCallback, x.xValuesCmp)
157 return func(PspecVar *ParamSpec, Value1Var *Value, Value2Var *Value) int {
158 return rawCallback(PspecVar.GoPointer(), Value1Var, Value2Var)
159 }
160}
161
162// OverrideValueIsValid sets the "value_is_valid" callback function.
163// Checks if contents of @value comply with the specifications
164//
165// set out by this type, without modifying the value. This vfunc is optional.
166// If it isn't set, GObject will use @value_validate. Since 2.74
167func (x *ParamSpecClass) OverrideValueIsValid(cb func(*ParamSpec, *Value) bool) {
168 if cb == nil {
169 x.xValueIsValid = 0
170 } else {
171 x.xValueIsValid = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) bool {
172 return cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp)
173 })
174 }
175}
176
177// GetValueIsValid gets the "value_is_valid" callback function.
178// Checks if contents of @value comply with the specifications
179//
180// set out by this type, without modifying the value. This vfunc is optional.
181// If it isn't set, GObject will use @value_validate. Since 2.74
182func (x *ParamSpecClass) GetValueIsValid() func(*ParamSpec, *Value) bool {
183 if x.xValueIsValid == 0 {
184 return nil
185 }
186 var rawCallback func(PspecVarp uintptr, ValueVarp *Value) bool
187 purego.RegisterFunc(&rawCallback, x.xValueIsValid)
188 return func(PspecVar *ParamSpec, ValueVar *Value) bool {
189 return rawCallback(PspecVar.GoPointer(), ValueVar)
190 }
191}
192
193// A #GParamSpecPool maintains a collection of #GParamSpecs which can be
194// quickly accessed by owner and name.
195//
196// The implementation of the #GObject property system uses such a pool to
197// store the #GParamSpecs of the properties all object types.
198type ParamSpecPool struct {
199 _ structs.HostLayout
200}
201
202func (x *ParamSpecPool) GoPointer() uintptr {
203 return uintptr(unsafe.Pointer(x))
204}
205
206var xParamSpecPoolFree func(uintptr)
207
208// Frees the resources allocated by a #GParamSpecPool.
209func (x *ParamSpecPool) Free() {
210
211 xParamSpecPoolFree(x.GoPointer())
212
213}
214
215var xParamSpecPoolInsert func(uintptr, uintptr, types.GType)
216
217// Inserts a #GParamSpec in the pool.
218func (x *ParamSpecPool) Insert(PspecVar *ParamSpec, OwnerTypeVar types.GType) {
219
220 xParamSpecPoolInsert(x.GoPointer(), PspecVar.GoPointer(), OwnerTypeVar)
221
222}
223
224var xParamSpecPoolList func(uintptr, types.GType, *uint) uintptr
225
226// Gets an array of all #GParamSpecs owned by @owner_type in
227// the pool.
228func (x *ParamSpecPool) List(OwnerTypeVar types.GType, NPspecsPVar *uint) uintptr {
229
230 cret := xParamSpecPoolList(x.GoPointer(), OwnerTypeVar, NPspecsPVar)
231 return cret
232}
233
234var xParamSpecPoolListOwned func(uintptr, types.GType) *glib.List
235
236// Gets an #GList of all #GParamSpecs owned by @owner_type in
237// the pool.
238func (x *ParamSpecPool) ListOwned(OwnerTypeVar types.GType) *glib.List {
239
240 cret := xParamSpecPoolListOwned(x.GoPointer(), OwnerTypeVar)
241 return cret
242}
243
244var xParamSpecPoolLookup func(uintptr, string, types.GType, bool) uintptr
245
246// Looks up a #GParamSpec in the pool.
247func (x *ParamSpecPool) Lookup(ParamNameVar string, OwnerTypeVar types.GType, WalkAncestorsVar bool) *ParamSpec {
248 var cls *ParamSpec
249
250 cret := xParamSpecPoolLookup(x.GoPointer(), ParamNameVar, OwnerTypeVar, WalkAncestorsVar)
251
252 if cret == 0 {
253 return nil
254 }
255 IncreaseRef(cret)
256 cls = &ParamSpec{}
257 cls.Ptr = cret
258 return cls
259}
260
261var xParamSpecPoolRemove func(uintptr, uintptr)
262
263// Removes a #GParamSpec from the pool.
264func (x *ParamSpecPool) Remove(PspecVar *ParamSpec) {
265
266 xParamSpecPoolRemove(x.GoPointer(), PspecVar.GoPointer())
267
268}
269
270// This structure is used to provide the type system with the information
271// required to initialize and destruct (finalize) a parameter's class and
272// instances thereof.
273//
274// The initialized structure is passed to the g_param_type_register_static()
275// The type system will perform a deep copy of this structure, so its memory
276// does not need to be persistent across invocation of
277// g_param_type_register_static().
278type ParamSpecTypeInfo struct {
279 _ structs.HostLayout
280
281 InstanceSize uint16
282
283 NPreallocs uint16
284
285 xInstanceInit uintptr
286
287 ValueType types.GType
288
289 xFinalize uintptr
290
291 xValueSetDefault uintptr
292
293 xValueValidate uintptr
294
295 xValuesCmp uintptr
296}
297
298func (x *ParamSpecTypeInfo) GoPointer() uintptr {
299 return uintptr(unsafe.Pointer(x))
300}
301
302// OverrideInstanceInit sets the "instance_init" callback function.
303// Location of the instance initialization function (optional).
304func (x *ParamSpecTypeInfo) OverrideInstanceInit(cb func(*ParamSpec)) {
305 if cb == nil {
306 x.xInstanceInit = 0
307 } else {
308 x.xInstanceInit = purego.NewCallback(func(PspecVarp uintptr) {
309 cb(ParamSpecNewFromInternalPtr(PspecVarp))
310 })
311 }
312}
313
314// GetInstanceInit gets the "instance_init" callback function.
315// Location of the instance initialization function (optional).
316func (x *ParamSpecTypeInfo) GetInstanceInit() func(*ParamSpec) {
317 if x.xInstanceInit == 0 {
318 return nil
319 }
320 var rawCallback func(PspecVarp uintptr)
321 purego.RegisterFunc(&rawCallback, x.xInstanceInit)
322 return func(PspecVar *ParamSpec) {
323 rawCallback(PspecVar.GoPointer())
324 }
325}
326
327// OverrideFinalize sets the "finalize" callback function.
328// The instance finalization function (optional).
329func (x *ParamSpecTypeInfo) OverrideFinalize(cb func(*ParamSpec)) {
330 if cb == nil {
331 x.xFinalize = 0
332 } else {
333 x.xFinalize = purego.NewCallback(func(PspecVarp uintptr) {
334 cb(ParamSpecNewFromInternalPtr(PspecVarp))
335 })
336 }
337}
338
339// GetFinalize gets the "finalize" callback function.
340// The instance finalization function (optional).
341func (x *ParamSpecTypeInfo) GetFinalize() func(*ParamSpec) {
342 if x.xFinalize == 0 {
343 return nil
344 }
345 var rawCallback func(PspecVarp uintptr)
346 purego.RegisterFunc(&rawCallback, x.xFinalize)
347 return func(PspecVar *ParamSpec) {
348 rawCallback(PspecVar.GoPointer())
349 }
350}
351
352// OverrideValueSetDefault sets the "value_set_default" callback function.
353// Resets a @value to the default value for @pspec
354//
355// (recommended, the default is g_value_reset()), see
356// g_param_value_set_default().
357func (x *ParamSpecTypeInfo) OverrideValueSetDefault(cb func(*ParamSpec, *Value)) {
358 if cb == nil {
359 x.xValueSetDefault = 0
360 } else {
361 x.xValueSetDefault = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) {
362 cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp)
363 })
364 }
365}
366
367// GetValueSetDefault gets the "value_set_default" callback function.
368// Resets a @value to the default value for @pspec
369//
370// (recommended, the default is g_value_reset()), see
371// g_param_value_set_default().
372func (x *ParamSpecTypeInfo) GetValueSetDefault() func(*ParamSpec, *Value) {
373 if x.xValueSetDefault == 0 {
374 return nil
375 }
376 var rawCallback func(PspecVarp uintptr, ValueVarp *Value)
377 purego.RegisterFunc(&rawCallback, x.xValueSetDefault)
378 return func(PspecVar *ParamSpec, ValueVar *Value) {
379 rawCallback(PspecVar.GoPointer(), ValueVar)
380 }
381}
382
383// OverrideValueValidate sets the "value_validate" callback function.
384// Ensures that the contents of @value comply with the
385//
386// specifications set out by @pspec (optional), see
387// g_param_value_validate().
388func (x *ParamSpecTypeInfo) OverrideValueValidate(cb func(*ParamSpec, *Value) bool) {
389 if cb == nil {
390 x.xValueValidate = 0
391 } else {
392 x.xValueValidate = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) bool {
393 return cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp)
394 })
395 }
396}
397
398// GetValueValidate gets the "value_validate" callback function.
399// Ensures that the contents of @value comply with the
400//
401// specifications set out by @pspec (optional), see
402// g_param_value_validate().
403func (x *ParamSpecTypeInfo) GetValueValidate() func(*ParamSpec, *Value) bool {
404 if x.xValueValidate == 0 {
405 return nil
406 }
407 var rawCallback func(PspecVarp uintptr, ValueVarp *Value) bool
408 purego.RegisterFunc(&rawCallback, x.xValueValidate)
409 return func(PspecVar *ParamSpec, ValueVar *Value) bool {
410 return rawCallback(PspecVar.GoPointer(), ValueVar)
411 }
412}
413
414// OverrideValuesCmp sets the "values_cmp" callback function.
415// Compares @value1 with @value2 according to @pspec
416//
417// (recommended, the default is memcmp()), see g_param_values_cmp().
418func (x *ParamSpecTypeInfo) OverrideValuesCmp(cb func(*ParamSpec, *Value, *Value) int) {
419 if cb == nil {
420 x.xValuesCmp = 0
421 } else {
422 x.xValuesCmp = purego.NewCallback(func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int {
423 return cb(ParamSpecNewFromInternalPtr(PspecVarp), Value1Varp, Value2Varp)
424 })
425 }
426}
427
428// GetValuesCmp gets the "values_cmp" callback function.
429// Compares @value1 with @value2 according to @pspec
430//
431// (recommended, the default is memcmp()), see g_param_values_cmp().
432func (x *ParamSpecTypeInfo) GetValuesCmp() func(*ParamSpec, *Value, *Value) int {
433 if x.xValuesCmp == 0 {
434 return nil
435 }
436 var rawCallback func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int
437 purego.RegisterFunc(&rawCallback, x.xValuesCmp)
438 return func(PspecVar *ParamSpec, Value1Var *Value, Value2Var *Value) int {
439 return rawCallback(PspecVar.GoPointer(), Value1Var, Value2Var)
440 }
441}
442
443// The GParameter struct is an auxiliary structure used
444// to hand parameter name/value pairs to g_object_newv().
445type Parameter struct {
446 _ structs.HostLayout
447
448 Name uintptr
449
450 Value uintptr
451}
452
453func (x *Parameter) GoPointer() uintptr {
454 return uintptr(unsafe.Pointer(x))
455}
456
457const (
458 // Mask containing the bits of #GParamSpec.flags which are reserved for GLib.
459 PARAM_MASK int = 255
460 // #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB.
461 //
462 // It is recommended to use this for all properties by default, as it allows for
463 // internal performance improvements in GObject.
464 //
465 // It is very rare that a property would have a dynamically constructed name,
466 // nickname or blurb.
467 //
468 // Since 2.13.0
469 PARAM_STATIC_STRINGS int = 224
470 // Minimum shift count to be used for user defined flags, to be stored in
471 // #GParamSpec.flags. The maximum allowed is 10.
472 PARAM_USER_SHIFT int = 8
473)
474
475// Through the #GParamFlags flag values, certain aspects of parameters
476// can be configured.
477//
478// See also: %G_PARAM_STATIC_STRINGS
479type ParamFlags int
480
481const (
482
483 // the parameter is readable
484 GParamReadableValue ParamFlags = 1
485 // the parameter is writable
486 GParamWritableValue ParamFlags = 2
487 // alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE
488 GParamReadwriteValue ParamFlags = 3
489 // the parameter will be set upon object construction.
490 // See [vfunc@Object.constructed] for more details
491 GParamConstructValue ParamFlags = 4
492 // the parameter can only be set upon object construction.
493 // See [vfunc@Object.constructed] for more details
494 GParamConstructOnlyValue ParamFlags = 8
495 // upon parameter conversion (see g_param_value_convert())
496 // strict validation is not required
497 GParamLaxValidationValue ParamFlags = 16
498 // the string used as name when constructing the
499 // parameter is guaranteed to remain valid and
500 // unmodified for the lifetime of the parameter.
501 // Since 2.8
502 GParamStaticNameValue ParamFlags = 32
503 // internal
504 GParamPrivateValue ParamFlags = 32
505 // the string used as nick when constructing the
506 // parameter is guaranteed to remain valid and
507 // unmmodified for the lifetime of the parameter.
508 // Since 2.8
509 GParamStaticNickValue ParamFlags = 64
510 // the string used as blurb when constructing the
511 // parameter is guaranteed to remain valid and
512 // unmodified for the lifetime of the parameter.
513 // Since 2.8
514 GParamStaticBlurbValue ParamFlags = 128
515 // calls to g_object_set_property() for this
516 // property will not automatically result in a "notify" signal being
517 // emitted: the implementation must call g_object_notify() themselves
518 // in case the property actually changes. Since: 2.42.
519 GParamExplicitNotifyValue ParamFlags = 1073741824
520 // the parameter is deprecated and will be removed
521 // in a future version. A warning will be generated if it is used
522 // while running with G_ENABLE_DIAGNOSTIC=1.
523 // Since 2.26
524 GParamDeprecatedValue ParamFlags = 2147483648
525)
526
527var xParamTypeRegisterStatic func(string, *ParamSpecTypeInfo) types.GType
528
529// Registers @name as the name of a new static type derived
530// from %G_TYPE_PARAM.
531//
532// The type system uses the information contained in the #GParamSpecTypeInfo
533// structure pointed to by @info to manage the #GParamSpec type and its
534// instances.
535func ParamTypeRegisterStatic(NameVar string, PspecInfoVar *ParamSpecTypeInfo) types.GType {
536
537 cret := xParamTypeRegisterStatic(NameVar, PspecInfoVar)
538 return cret
539}
540
541var xParamValueConvert func(uintptr, *Value, *Value, bool) bool
542
543// Transforms @src_value into @dest_value if possible, and then
544// validates @dest_value, in order for it to conform to @pspec. If
545// @strict_validation is %TRUE this function will only succeed if the
546// transformed @dest_value complied to @pspec without modifications.
547//
548// See also g_value_type_transformable(), g_value_transform() and
549// g_param_value_validate().
550func ParamValueConvert(PspecVar *ParamSpec, SrcValueVar *Value, DestValueVar *Value, StrictValidationVar bool) bool {
551
552 cret := xParamValueConvert(PspecVar.GoPointer(), SrcValueVar, DestValueVar, StrictValidationVar)
553 return cret
554}
555
556var xParamValueDefaults func(uintptr, *Value) bool
557
558// Checks whether @value contains the default value as specified in @pspec.
559func ParamValueDefaults(PspecVar *ParamSpec, ValueVar *Value) bool {
560
561 cret := xParamValueDefaults(PspecVar.GoPointer(), ValueVar)
562 return cret
563}
564
565var xParamValueIsValid func(uintptr, *Value) bool
566
567// Return whether the contents of @value comply with the specifications
568// set out by @pspec.
569func ParamValueIsValid(PspecVar *ParamSpec, ValueVar *Value) bool {
570
571 cret := xParamValueIsValid(PspecVar.GoPointer(), ValueVar)
572 return cret
573}
574
575var xParamValueSetDefault func(uintptr, *Value)
576
577// Sets @value to its default value as specified in @pspec.
578func ParamValueSetDefault(PspecVar *ParamSpec, ValueVar *Value) {
579
580 xParamValueSetDefault(PspecVar.GoPointer(), ValueVar)
581
582}
583
584var xParamValueValidate func(uintptr, *Value) bool
585
586// Ensures that the contents of @value comply with the specifications
587// set out by @pspec. For example, a #GParamSpecInt might require
588// that integers stored in @value may not be smaller than -42 and not be
589// greater than +42. If @value contains an integer outside of this range,
590// it is modified accordingly, so the resulting value will fit into the
591// range -42 .. +42.
592func ParamValueValidate(PspecVar *ParamSpec, ValueVar *Value) bool {
593
594 cret := xParamValueValidate(PspecVar.GoPointer(), ValueVar)
595 return cret
596}
597
598var xParamValuesCmp func(uintptr, *Value, *Value) int
599
600// Compares @value1 with @value2 according to @pspec, and return -1, 0 or +1,
601// if @value1 is found to be less than, equal to or greater than @value2,
602// respectively.
603func ParamValuesCmp(PspecVar *ParamSpec, Value1Var *Value, Value2Var *Value) int {
604
605 cret := xParamValuesCmp(PspecVar.GoPointer(), Value1Var, Value2Var)
606 return cret
607}
608
609// `GParamSpec` encapsulates the metadata required to specify parameters, such as `GObject` properties.
610//
611// ## Parameter names
612//
613// A property name consists of one or more segments consisting of ASCII letters
614// and digits, separated by either the `-` or `_` character. The first
615// character of a property name must be a letter. These are the same rules as
616// for signal naming (see [func@GObject.signal_new]).
617//
618// When creating and looking up a `GParamSpec`, either separator can be
619// used, but they cannot be mixed. Using `-` is considerably more
620// efficient, and is the ‘canonical form’. Using `_` is discouraged.
621type ParamSpec struct {
622 Ptr uintptr
623}
624
625var xParamSpecGLibType func() types.GType
626
627func ParamSpecGLibType() types.GType {
628 return xParamSpecGLibType()
629}
630
631func ParamSpecNewFromInternalPtr(ptr uintptr) *ParamSpec {
632 cls := &ParamSpec{}
633 cls.Ptr = ptr
634 return cls
635}
636
637var xParamSpecGetBlurb func(uintptr) string
638
639// Get the short description of a #GParamSpec.
640func (x *ParamSpec) GetBlurb() string {
641
642 cret := xParamSpecGetBlurb(x.GoPointer())
643 return cret
644}
645
646var xParamSpecGetDefaultValue func(uintptr) *Value
647
648// Gets the default value of @pspec as a pointer to a #GValue.
649//
650// The #GValue will remain valid for the life of @pspec.
651func (x *ParamSpec) GetDefaultValue() *Value {
652
653 cret := xParamSpecGetDefaultValue(x.GoPointer())
654 return cret
655}
656
657var xParamSpecGetName func(uintptr) string
658
659// Get the name of a #GParamSpec.
660//
661// The name is always an "interned" string (as per g_intern_string()).
662// This allows for pointer-value comparisons.
663func (x *ParamSpec) GetName() string {
664
665 cret := xParamSpecGetName(x.GoPointer())
666 return cret
667}
668
669var xParamSpecGetNameQuark func(uintptr) glib.Quark
670
671// Gets the GQuark for the name.
672func (x *ParamSpec) GetNameQuark() glib.Quark {
673
674 cret := xParamSpecGetNameQuark(x.GoPointer())
675 return cret
676}
677
678var xParamSpecGetNick func(uintptr) string
679
680// Get the nickname of a #GParamSpec.
681func (x *ParamSpec) GetNick() string {
682
683 cret := xParamSpecGetNick(x.GoPointer())
684 return cret
685}
686
687var xParamSpecGetQdata func(uintptr, glib.Quark) uintptr
688
689// Gets back user data pointers stored via g_param_spec_set_qdata().
690func (x *ParamSpec) GetQdata(QuarkVar glib.Quark) uintptr {
691
692 cret := xParamSpecGetQdata(x.GoPointer(), QuarkVar)
693 return cret
694}
695
696var xParamSpecGetRedirectTarget func(uintptr) uintptr
697
698// If the paramspec redirects operations to another paramspec,
699// returns that paramspec. Redirect is used typically for
700// providing a new implementation of a property in a derived
701// type while preserving all the properties from the parent
702// type. Redirection is established by creating a property
703// of type #GParamSpecOverride. See g_object_class_override_property()
704// for an example of the use of this capability.
705func (x *ParamSpec) GetRedirectTarget() *ParamSpec {
706 var cls *ParamSpec
707
708 cret := xParamSpecGetRedirectTarget(x.GoPointer())
709
710 if cret == 0 {
711 return nil
712 }
713 IncreaseRef(cret)
714 cls = &ParamSpec{}
715 cls.Ptr = cret
716 return cls
717}
718
719var xParamSpecRef func(uintptr) uintptr
720
721// Increments the reference count of @pspec.
722func (x *ParamSpec) Ref() *ParamSpec {
723 var cls *ParamSpec
724
725 cret := xParamSpecRef(x.GoPointer())
726
727 if cret == 0 {
728 return nil
729 }
730 cls = &ParamSpec{}
731 cls.Ptr = cret
732 return cls
733}
734
735var xParamSpecRefSink func(uintptr) uintptr
736
737// Convenience function to ref and sink a #GParamSpec.
738func (x *ParamSpec) RefSink() *ParamSpec {
739 var cls *ParamSpec
740
741 cret := xParamSpecRefSink(x.GoPointer())
742
743 if cret == 0 {
744 return nil
745 }
746 cls = &ParamSpec{}
747 cls.Ptr = cret
748 return cls
749}
750
751var xParamSpecSetQdata func(uintptr, glib.Quark, uintptr)
752
753// Sets an opaque, named pointer on a #GParamSpec. The name is
754// specified through a #GQuark (retrieved e.g. via
755// g_quark_from_static_string()), and the pointer can be gotten back
756// from the @pspec with g_param_spec_get_qdata(). Setting a
757// previously set user data pointer, overrides (frees) the old pointer
758// set, using %NULL as pointer essentially removes the data stored.
759func (x *ParamSpec) SetQdata(QuarkVar glib.Quark, DataVar uintptr) {
760
761 xParamSpecSetQdata(x.GoPointer(), QuarkVar, DataVar)
762
763}
764
765var xParamSpecSetQdataFull func(uintptr, glib.Quark, uintptr, uintptr)
766
767// This function works like g_param_spec_set_qdata(), but in addition,
768// a `void (*destroy) (gpointer)` function may be
769// specified which is called with @data as argument when the @pspec is
770// finalized, or the data is being overwritten by a call to
771// g_param_spec_set_qdata() with the same @quark.
772func (x *ParamSpec) SetQdataFull(QuarkVar glib.Quark, DataVar uintptr, DestroyVar *glib.DestroyNotify) {
773
774 var DestroyVarRef uintptr
775 if DestroyVar != nil {
776 DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar))
777 if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok {
778 DestroyVarRef = cbRefPtr
779 } else {
780 fcb := func(arg0 uintptr) {
781 cbFn := *DestroyVar
782 cbFn(arg0)
783 }
784 DestroyVarRef = purego.NewCallback(fcb)
785 glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar)
786 }
787 }
788
789 xParamSpecSetQdataFull(x.GoPointer(), QuarkVar, DataVar, DestroyVarRef)
790
791}
792
793var xParamSpecSink func(uintptr)
794
795// The initial reference count of a newly created #GParamSpec is 1,
796// even though no one has explicitly called g_param_spec_ref() on it
797// yet. So the initial reference count is flagged as "floating", until
798// someone calls `g_param_spec_ref (pspec); g_param_spec_sink
799// (pspec);` in sequence on it, taking over the initial
800// reference count (thus ending up with a @pspec that has a reference
801// count of 1 still, but is not flagged "floating" anymore).
802func (x *ParamSpec) Sink() {
803
804 xParamSpecSink(x.GoPointer())
805
806}
807
808var xParamSpecStealQdata func(uintptr, glib.Quark) uintptr
809
810// Gets back user data pointers stored via g_param_spec_set_qdata()
811// and removes the @data from @pspec without invoking its destroy()
812// function (if any was set). Usually, calling this function is only
813// required to update user data pointers with a destroy notifier.
814func (x *ParamSpec) StealQdata(QuarkVar glib.Quark) uintptr {
815
816 cret := xParamSpecStealQdata(x.GoPointer(), QuarkVar)
817 return cret
818}
819
820var xParamSpecUnref func(uintptr)
821
822// Decrements the reference count of a @pspec.
823func (x *ParamSpec) Unref() {
824
825 xParamSpecUnref(x.GoPointer())
826
827}
828
829func (c *ParamSpec) GoPointer() uintptr {
830 if c == nil {
831 return 0
832 }
833 return c.Ptr
834}
835
836func (c *ParamSpec) SetGoPointer(ptr uintptr) {
837 c.Ptr = ptr
838}
839
840var xParamSpecInternal func(types.GType, string, uintptr, uintptr, ParamFlags) uintptr
841
842// Creates a new #GParamSpec instance.
843//
844// See [canonical parameter names][class@GObject.ParamSpec#parameter-names]
845// for details of the rules for @name. Names which violate these rules lead
846// to undefined behaviour.
847//
848// Beyond the name, #GParamSpecs have two more descriptive strings, the
849// @nick and @blurb, which may be used as a localized label and description.
850// For GTK and related libraries these are considered deprecated and may be
851// omitted, while for other libraries such as GStreamer and its plugins they
852// are essential. When in doubt, follow the conventions used in the
853// surrounding code and supporting libraries.
854func ParamSpecInternal(ParamTypeVar types.GType, NameVar string, NickVar *string, BlurbVar *string, FlagsVar ParamFlags) *ParamSpec {
855 var cls *ParamSpec
856
857 NickVarPtr := core.GStrdupNullable(NickVar)
858 defer core.GFreeNullable(NickVarPtr)
859
860 BlurbVarPtr := core.GStrdupNullable(BlurbVar)
861 defer core.GFreeNullable(BlurbVarPtr)
862
863 cret := xParamSpecInternal(ParamTypeVar, NameVar, NickVarPtr, BlurbVarPtr, FlagsVar)
864
865 if cret == 0 {
866 return nil
867 }
868 IncreaseRef(cret)
869 cls = &ParamSpec{}
870 cls.Ptr = cret
871 return cls
872}
873
874var xParamSpecIsValidName func(string) bool
875
876// Validate a property name for a #GParamSpec. This can be useful for
877// dynamically-generated properties which need to be validated at run-time
878// before actually trying to create them.
879//
880// See [canonical parameter names][class@GObject.ParamSpec#parameter-names]
881// for details of the rules for valid names.
882func ParamSpecIsValidName(NameVar string) bool {
883
884 cret := xParamSpecIsValidName(NameVar)
885 return cret
886}
887
888func init() {
889 core.SetPackageName("GOBJECT", "gobject-2.0")
890 core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"})
891 var libs []uintptr
892 for _, libPath := range core.GetPaths("GOBJECT") {
893 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
894 if err != nil {
895 panic(err)
896 }
897 libs = append(libs, lib)
898 }
899
900 core.PuregoSafeRegister(&xParamTypeRegisterStatic, libs, "g_param_type_register_static")
901 core.PuregoSafeRegister(&xParamValueConvert, libs, "g_param_value_convert")
902 core.PuregoSafeRegister(&xParamValueDefaults, libs, "g_param_value_defaults")
903 core.PuregoSafeRegister(&xParamValueIsValid, libs, "g_param_value_is_valid")
904 core.PuregoSafeRegister(&xParamValueSetDefault, libs, "g_param_value_set_default")
905 core.PuregoSafeRegister(&xParamValueValidate, libs, "g_param_value_validate")
906 core.PuregoSafeRegister(&xParamValuesCmp, libs, "g_param_values_cmp")
907
908 core.PuregoSafeRegister(&xParamSpecPoolFree, libs, "g_param_spec_pool_free")
909 core.PuregoSafeRegister(&xParamSpecPoolInsert, libs, "g_param_spec_pool_insert")
910 core.PuregoSafeRegister(&xParamSpecPoolList, libs, "g_param_spec_pool_list")
911 core.PuregoSafeRegister(&xParamSpecPoolListOwned, libs, "g_param_spec_pool_list_owned")
912 core.PuregoSafeRegister(&xParamSpecPoolLookup, libs, "g_param_spec_pool_lookup")
913 core.PuregoSafeRegister(&xParamSpecPoolRemove, libs, "g_param_spec_pool_remove")
914
915 core.PuregoSafeRegister(&xParamSpecGLibType, libs, "intern")
916
917 core.PuregoSafeRegister(&xParamSpecGetBlurb, libs, "g_param_spec_get_blurb")
918 core.PuregoSafeRegister(&xParamSpecGetDefaultValue, libs, "g_param_spec_get_default_value")
919 core.PuregoSafeRegister(&xParamSpecGetName, libs, "g_param_spec_get_name")
920 core.PuregoSafeRegister(&xParamSpecGetNameQuark, libs, "g_param_spec_get_name_quark")
921 core.PuregoSafeRegister(&xParamSpecGetNick, libs, "g_param_spec_get_nick")
922 core.PuregoSafeRegister(&xParamSpecGetQdata, libs, "g_param_spec_get_qdata")
923 core.PuregoSafeRegister(&xParamSpecGetRedirectTarget, libs, "g_param_spec_get_redirect_target")
924 core.PuregoSafeRegister(&xParamSpecRef, libs, "g_param_spec_ref")
925 core.PuregoSafeRegister(&xParamSpecRefSink, libs, "g_param_spec_ref_sink")
926 core.PuregoSafeRegister(&xParamSpecSetQdata, libs, "g_param_spec_set_qdata")
927 core.PuregoSafeRegister(&xParamSpecSetQdataFull, libs, "g_param_spec_set_qdata_full")
928 core.PuregoSafeRegister(&xParamSpecSink, libs, "g_param_spec_sink")
929 core.PuregoSafeRegister(&xParamSpecStealQdata, libs, "g_param_spec_steal_qdata")
930 core.PuregoSafeRegister(&xParamSpecUnref, libs, "g_param_spec_unref")
931
932 core.PuregoSafeRegister(&xParamSpecInternal, libs, "g_param_spec_internal")
933 core.PuregoSafeRegister(&xParamSpecIsValidName, libs, "g_param_spec_is_valid_name")
934
935}