// Package gobject was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gobject import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject/types" ) // The class structure for the GParamSpec type. // Normally, GParamSpec classes are filled by // g_param_type_register_static(). type ParamSpecClass struct { _ structs.HostLayout GTypeClass uintptr ValueType types.GType xFinalize uintptr xValueSetDefault uintptr xValueValidate uintptr xValuesCmp uintptr xValueIsValid uintptr Dummy [3]uintptr } func (x *ParamSpecClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideFinalize sets the "finalize" callback function. // The instance finalization function (optional), should chain // // up to the finalize method of the parent class. func (x *ParamSpecClass) OverrideFinalize(cb func(*ParamSpec)) { if cb == nil { x.xFinalize = 0 } else { x.xFinalize = purego.NewCallback(func(PspecVarp uintptr) { cb(ParamSpecNewFromInternalPtr(PspecVarp)) }) } } // GetFinalize gets the "finalize" callback function. // The instance finalization function (optional), should chain // // up to the finalize method of the parent class. func (x *ParamSpecClass) GetFinalize() func(*ParamSpec) { if x.xFinalize == 0 { return nil } var rawCallback func(PspecVarp uintptr) purego.RegisterFunc(&rawCallback, x.xFinalize) return func(PspecVar *ParamSpec) { rawCallback(PspecVar.GoPointer()) } } // OverrideValueSetDefault sets the "value_set_default" callback function. // Resets a @value to the default value for this type // // (recommended, the default is g_value_reset()), see // g_param_value_set_default(). func (x *ParamSpecClass) OverrideValueSetDefault(cb func(*ParamSpec, *Value)) { if cb == nil { x.xValueSetDefault = 0 } else { x.xValueSetDefault = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) { cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp) }) } } // GetValueSetDefault gets the "value_set_default" callback function. // Resets a @value to the default value for this type // // (recommended, the default is g_value_reset()), see // g_param_value_set_default(). func (x *ParamSpecClass) GetValueSetDefault() func(*ParamSpec, *Value) { if x.xValueSetDefault == 0 { return nil } var rawCallback func(PspecVarp uintptr, ValueVarp *Value) purego.RegisterFunc(&rawCallback, x.xValueSetDefault) return func(PspecVar *ParamSpec, ValueVar *Value) { rawCallback(PspecVar.GoPointer(), ValueVar) } } // OverrideValueValidate sets the "value_validate" callback function. // Ensures that the contents of @value comply with the // // specifications set out by this type (optional), see // g_param_value_validate(). func (x *ParamSpecClass) OverrideValueValidate(cb func(*ParamSpec, *Value) bool) { if cb == nil { x.xValueValidate = 0 } else { x.xValueValidate = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) bool { return cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp) }) } } // GetValueValidate gets the "value_validate" callback function. // Ensures that the contents of @value comply with the // // specifications set out by this type (optional), see // g_param_value_validate(). func (x *ParamSpecClass) GetValueValidate() func(*ParamSpec, *Value) bool { if x.xValueValidate == 0 { return nil } var rawCallback func(PspecVarp uintptr, ValueVarp *Value) bool purego.RegisterFunc(&rawCallback, x.xValueValidate) return func(PspecVar *ParamSpec, ValueVar *Value) bool { return rawCallback(PspecVar.GoPointer(), ValueVar) } } // OverrideValuesCmp sets the "values_cmp" callback function. // Compares @value1 with @value2 according to this type // // (recommended, the default is memcmp()), see g_param_values_cmp(). func (x *ParamSpecClass) OverrideValuesCmp(cb func(*ParamSpec, *Value, *Value) int) { if cb == nil { x.xValuesCmp = 0 } else { x.xValuesCmp = purego.NewCallback(func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int { return cb(ParamSpecNewFromInternalPtr(PspecVarp), Value1Varp, Value2Varp) }) } } // GetValuesCmp gets the "values_cmp" callback function. // Compares @value1 with @value2 according to this type // // (recommended, the default is memcmp()), see g_param_values_cmp(). func (x *ParamSpecClass) GetValuesCmp() func(*ParamSpec, *Value, *Value) int { if x.xValuesCmp == 0 { return nil } var rawCallback func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int purego.RegisterFunc(&rawCallback, x.xValuesCmp) return func(PspecVar *ParamSpec, Value1Var *Value, Value2Var *Value) int { return rawCallback(PspecVar.GoPointer(), Value1Var, Value2Var) } } // OverrideValueIsValid sets the "value_is_valid" callback function. // Checks if contents of @value comply with the specifications // // set out by this type, without modifying the value. This vfunc is optional. // If it isn't set, GObject will use @value_validate. Since 2.74 func (x *ParamSpecClass) OverrideValueIsValid(cb func(*ParamSpec, *Value) bool) { if cb == nil { x.xValueIsValid = 0 } else { x.xValueIsValid = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) bool { return cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp) }) } } // GetValueIsValid gets the "value_is_valid" callback function. // Checks if contents of @value comply with the specifications // // set out by this type, without modifying the value. This vfunc is optional. // If it isn't set, GObject will use @value_validate. Since 2.74 func (x *ParamSpecClass) GetValueIsValid() func(*ParamSpec, *Value) bool { if x.xValueIsValid == 0 { return nil } var rawCallback func(PspecVarp uintptr, ValueVarp *Value) bool purego.RegisterFunc(&rawCallback, x.xValueIsValid) return func(PspecVar *ParamSpec, ValueVar *Value) bool { return rawCallback(PspecVar.GoPointer(), ValueVar) } } // A #GParamSpecPool maintains a collection of #GParamSpecs which can be // quickly accessed by owner and name. // // The implementation of the #GObject property system uses such a pool to // store the #GParamSpecs of the properties all object types. type ParamSpecPool struct { _ structs.HostLayout } func (x *ParamSpecPool) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xParamSpecPoolFree func(uintptr) // Frees the resources allocated by a #GParamSpecPool. func (x *ParamSpecPool) Free() { xParamSpecPoolFree(x.GoPointer()) } var xParamSpecPoolInsert func(uintptr, uintptr, types.GType) // Inserts a #GParamSpec in the pool. func (x *ParamSpecPool) Insert(PspecVar *ParamSpec, OwnerTypeVar types.GType) { xParamSpecPoolInsert(x.GoPointer(), PspecVar.GoPointer(), OwnerTypeVar) } var xParamSpecPoolList func(uintptr, types.GType, *uint) uintptr // Gets an array of all #GParamSpecs owned by @owner_type in // the pool. func (x *ParamSpecPool) List(OwnerTypeVar types.GType, NPspecsPVar *uint) uintptr { cret := xParamSpecPoolList(x.GoPointer(), OwnerTypeVar, NPspecsPVar) return cret } var xParamSpecPoolListOwned func(uintptr, types.GType) *glib.List // Gets an #GList of all #GParamSpecs owned by @owner_type in // the pool. func (x *ParamSpecPool) ListOwned(OwnerTypeVar types.GType) *glib.List { cret := xParamSpecPoolListOwned(x.GoPointer(), OwnerTypeVar) return cret } var xParamSpecPoolLookup func(uintptr, string, types.GType, bool) uintptr // Looks up a #GParamSpec in the pool. func (x *ParamSpecPool) Lookup(ParamNameVar string, OwnerTypeVar types.GType, WalkAncestorsVar bool) *ParamSpec { var cls *ParamSpec cret := xParamSpecPoolLookup(x.GoPointer(), ParamNameVar, OwnerTypeVar, WalkAncestorsVar) if cret == 0 { return nil } IncreaseRef(cret) cls = &ParamSpec{} cls.Ptr = cret return cls } var xParamSpecPoolRemove func(uintptr, uintptr) // Removes a #GParamSpec from the pool. func (x *ParamSpecPool) Remove(PspecVar *ParamSpec) { xParamSpecPoolRemove(x.GoPointer(), PspecVar.GoPointer()) } // This structure is used to provide the type system with the information // required to initialize and destruct (finalize) a parameter's class and // instances thereof. // // The initialized structure is passed to the g_param_type_register_static() // The type system will perform a deep copy of this structure, so its memory // does not need to be persistent across invocation of // g_param_type_register_static(). type ParamSpecTypeInfo struct { _ structs.HostLayout InstanceSize uint16 NPreallocs uint16 xInstanceInit uintptr ValueType types.GType xFinalize uintptr xValueSetDefault uintptr xValueValidate uintptr xValuesCmp uintptr } func (x *ParamSpecTypeInfo) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // OverrideInstanceInit sets the "instance_init" callback function. // Location of the instance initialization function (optional). func (x *ParamSpecTypeInfo) OverrideInstanceInit(cb func(*ParamSpec)) { if cb == nil { x.xInstanceInit = 0 } else { x.xInstanceInit = purego.NewCallback(func(PspecVarp uintptr) { cb(ParamSpecNewFromInternalPtr(PspecVarp)) }) } } // GetInstanceInit gets the "instance_init" callback function. // Location of the instance initialization function (optional). func (x *ParamSpecTypeInfo) GetInstanceInit() func(*ParamSpec) { if x.xInstanceInit == 0 { return nil } var rawCallback func(PspecVarp uintptr) purego.RegisterFunc(&rawCallback, x.xInstanceInit) return func(PspecVar *ParamSpec) { rawCallback(PspecVar.GoPointer()) } } // OverrideFinalize sets the "finalize" callback function. // The instance finalization function (optional). func (x *ParamSpecTypeInfo) OverrideFinalize(cb func(*ParamSpec)) { if cb == nil { x.xFinalize = 0 } else { x.xFinalize = purego.NewCallback(func(PspecVarp uintptr) { cb(ParamSpecNewFromInternalPtr(PspecVarp)) }) } } // GetFinalize gets the "finalize" callback function. // The instance finalization function (optional). func (x *ParamSpecTypeInfo) GetFinalize() func(*ParamSpec) { if x.xFinalize == 0 { return nil } var rawCallback func(PspecVarp uintptr) purego.RegisterFunc(&rawCallback, x.xFinalize) return func(PspecVar *ParamSpec) { rawCallback(PspecVar.GoPointer()) } } // OverrideValueSetDefault sets the "value_set_default" callback function. // Resets a @value to the default value for @pspec // // (recommended, the default is g_value_reset()), see // g_param_value_set_default(). func (x *ParamSpecTypeInfo) OverrideValueSetDefault(cb func(*ParamSpec, *Value)) { if cb == nil { x.xValueSetDefault = 0 } else { x.xValueSetDefault = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) { cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp) }) } } // GetValueSetDefault gets the "value_set_default" callback function. // Resets a @value to the default value for @pspec // // (recommended, the default is g_value_reset()), see // g_param_value_set_default(). func (x *ParamSpecTypeInfo) GetValueSetDefault() func(*ParamSpec, *Value) { if x.xValueSetDefault == 0 { return nil } var rawCallback func(PspecVarp uintptr, ValueVarp *Value) purego.RegisterFunc(&rawCallback, x.xValueSetDefault) return func(PspecVar *ParamSpec, ValueVar *Value) { rawCallback(PspecVar.GoPointer(), ValueVar) } } // OverrideValueValidate sets the "value_validate" callback function. // Ensures that the contents of @value comply with the // // specifications set out by @pspec (optional), see // g_param_value_validate(). func (x *ParamSpecTypeInfo) OverrideValueValidate(cb func(*ParamSpec, *Value) bool) { if cb == nil { x.xValueValidate = 0 } else { x.xValueValidate = purego.NewCallback(func(PspecVarp uintptr, ValueVarp *Value) bool { return cb(ParamSpecNewFromInternalPtr(PspecVarp), ValueVarp) }) } } // GetValueValidate gets the "value_validate" callback function. // Ensures that the contents of @value comply with the // // specifications set out by @pspec (optional), see // g_param_value_validate(). func (x *ParamSpecTypeInfo) GetValueValidate() func(*ParamSpec, *Value) bool { if x.xValueValidate == 0 { return nil } var rawCallback func(PspecVarp uintptr, ValueVarp *Value) bool purego.RegisterFunc(&rawCallback, x.xValueValidate) return func(PspecVar *ParamSpec, ValueVar *Value) bool { return rawCallback(PspecVar.GoPointer(), ValueVar) } } // OverrideValuesCmp sets the "values_cmp" callback function. // Compares @value1 with @value2 according to @pspec // // (recommended, the default is memcmp()), see g_param_values_cmp(). func (x *ParamSpecTypeInfo) OverrideValuesCmp(cb func(*ParamSpec, *Value, *Value) int) { if cb == nil { x.xValuesCmp = 0 } else { x.xValuesCmp = purego.NewCallback(func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int { return cb(ParamSpecNewFromInternalPtr(PspecVarp), Value1Varp, Value2Varp) }) } } // GetValuesCmp gets the "values_cmp" callback function. // Compares @value1 with @value2 according to @pspec // // (recommended, the default is memcmp()), see g_param_values_cmp(). func (x *ParamSpecTypeInfo) GetValuesCmp() func(*ParamSpec, *Value, *Value) int { if x.xValuesCmp == 0 { return nil } var rawCallback func(PspecVarp uintptr, Value1Varp *Value, Value2Varp *Value) int purego.RegisterFunc(&rawCallback, x.xValuesCmp) return func(PspecVar *ParamSpec, Value1Var *Value, Value2Var *Value) int { return rawCallback(PspecVar.GoPointer(), Value1Var, Value2Var) } } // The GParameter struct is an auxiliary structure used // to hand parameter name/value pairs to g_object_newv(). type Parameter struct { _ structs.HostLayout Name uintptr Value uintptr } func (x *Parameter) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } const ( // Mask containing the bits of #GParamSpec.flags which are reserved for GLib. PARAM_MASK int = 255 // #GParamFlags value alias for %G_PARAM_STATIC_NAME | %G_PARAM_STATIC_NICK | %G_PARAM_STATIC_BLURB. // // It is recommended to use this for all properties by default, as it allows for // internal performance improvements in GObject. // // It is very rare that a property would have a dynamically constructed name, // nickname or blurb. // // Since 2.13.0 PARAM_STATIC_STRINGS int = 224 // Minimum shift count to be used for user defined flags, to be stored in // #GParamSpec.flags. The maximum allowed is 10. PARAM_USER_SHIFT int = 8 ) // Through the #GParamFlags flag values, certain aspects of parameters // can be configured. // // See also: %G_PARAM_STATIC_STRINGS type ParamFlags int const ( // the parameter is readable GParamReadableValue ParamFlags = 1 // the parameter is writable GParamWritableValue ParamFlags = 2 // alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE GParamReadwriteValue ParamFlags = 3 // the parameter will be set upon object construction. // See [vfunc@Object.constructed] for more details GParamConstructValue ParamFlags = 4 // the parameter can only be set upon object construction. // See [vfunc@Object.constructed] for more details GParamConstructOnlyValue ParamFlags = 8 // upon parameter conversion (see g_param_value_convert()) // strict validation is not required GParamLaxValidationValue ParamFlags = 16 // the string used as name when constructing the // parameter is guaranteed to remain valid and // unmodified for the lifetime of the parameter. // Since 2.8 GParamStaticNameValue ParamFlags = 32 // internal GParamPrivateValue ParamFlags = 32 // the string used as nick when constructing the // parameter is guaranteed to remain valid and // unmmodified for the lifetime of the parameter. // Since 2.8 GParamStaticNickValue ParamFlags = 64 // the string used as blurb when constructing the // parameter is guaranteed to remain valid and // unmodified for the lifetime of the parameter. // Since 2.8 GParamStaticBlurbValue ParamFlags = 128 // calls to g_object_set_property() for this // property will not automatically result in a "notify" signal being // emitted: the implementation must call g_object_notify() themselves // in case the property actually changes. Since: 2.42. GParamExplicitNotifyValue ParamFlags = 1073741824 // the parameter is deprecated and will be removed // in a future version. A warning will be generated if it is used // while running with G_ENABLE_DIAGNOSTIC=1. // Since 2.26 GParamDeprecatedValue ParamFlags = 2147483648 ) var xParamTypeRegisterStatic func(string, *ParamSpecTypeInfo) types.GType // Registers @name as the name of a new static type derived // from %G_TYPE_PARAM. // // The type system uses the information contained in the #GParamSpecTypeInfo // structure pointed to by @info to manage the #GParamSpec type and its // instances. func ParamTypeRegisterStatic(NameVar string, PspecInfoVar *ParamSpecTypeInfo) types.GType { cret := xParamTypeRegisterStatic(NameVar, PspecInfoVar) return cret } var xParamValueConvert func(uintptr, *Value, *Value, bool) bool // Transforms @src_value into @dest_value if possible, and then // validates @dest_value, in order for it to conform to @pspec. If // @strict_validation is %TRUE this function will only succeed if the // transformed @dest_value complied to @pspec without modifications. // // See also g_value_type_transformable(), g_value_transform() and // g_param_value_validate(). func ParamValueConvert(PspecVar *ParamSpec, SrcValueVar *Value, DestValueVar *Value, StrictValidationVar bool) bool { cret := xParamValueConvert(PspecVar.GoPointer(), SrcValueVar, DestValueVar, StrictValidationVar) return cret } var xParamValueDefaults func(uintptr, *Value) bool // Checks whether @value contains the default value as specified in @pspec. func ParamValueDefaults(PspecVar *ParamSpec, ValueVar *Value) bool { cret := xParamValueDefaults(PspecVar.GoPointer(), ValueVar) return cret } var xParamValueIsValid func(uintptr, *Value) bool // Return whether the contents of @value comply with the specifications // set out by @pspec. func ParamValueIsValid(PspecVar *ParamSpec, ValueVar *Value) bool { cret := xParamValueIsValid(PspecVar.GoPointer(), ValueVar) return cret } var xParamValueSetDefault func(uintptr, *Value) // Sets @value to its default value as specified in @pspec. func ParamValueSetDefault(PspecVar *ParamSpec, ValueVar *Value) { xParamValueSetDefault(PspecVar.GoPointer(), ValueVar) } var xParamValueValidate func(uintptr, *Value) bool // Ensures that the contents of @value comply with the specifications // set out by @pspec. For example, a #GParamSpecInt might require // that integers stored in @value may not be smaller than -42 and not be // greater than +42. If @value contains an integer outside of this range, // it is modified accordingly, so the resulting value will fit into the // range -42 .. +42. func ParamValueValidate(PspecVar *ParamSpec, ValueVar *Value) bool { cret := xParamValueValidate(PspecVar.GoPointer(), ValueVar) return cret } var xParamValuesCmp func(uintptr, *Value, *Value) int // Compares @value1 with @value2 according to @pspec, and return -1, 0 or +1, // if @value1 is found to be less than, equal to or greater than @value2, // respectively. func ParamValuesCmp(PspecVar *ParamSpec, Value1Var *Value, Value2Var *Value) int { cret := xParamValuesCmp(PspecVar.GoPointer(), Value1Var, Value2Var) return cret } // `GParamSpec` encapsulates the metadata required to specify parameters, such as `GObject` properties. // // ## Parameter names // // A property name consists of one or more segments consisting of ASCII letters // and digits, separated by either the `-` or `_` character. The first // character of a property name must be a letter. These are the same rules as // for signal naming (see [func@GObject.signal_new]). // // When creating and looking up a `GParamSpec`, either separator can be // used, but they cannot be mixed. Using `-` is considerably more // efficient, and is the ‘canonical form’. Using `_` is discouraged. type ParamSpec struct { Ptr uintptr } var xParamSpecGLibType func() types.GType func ParamSpecGLibType() types.GType { return xParamSpecGLibType() } func ParamSpecNewFromInternalPtr(ptr uintptr) *ParamSpec { cls := &ParamSpec{} cls.Ptr = ptr return cls } var xParamSpecGetBlurb func(uintptr) string // Get the short description of a #GParamSpec. func (x *ParamSpec) GetBlurb() string { cret := xParamSpecGetBlurb(x.GoPointer()) return cret } var xParamSpecGetDefaultValue func(uintptr) *Value // Gets the default value of @pspec as a pointer to a #GValue. // // The #GValue will remain valid for the life of @pspec. func (x *ParamSpec) GetDefaultValue() *Value { cret := xParamSpecGetDefaultValue(x.GoPointer()) return cret } var xParamSpecGetName func(uintptr) string // Get the name of a #GParamSpec. // // The name is always an "interned" string (as per g_intern_string()). // This allows for pointer-value comparisons. func (x *ParamSpec) GetName() string { cret := xParamSpecGetName(x.GoPointer()) return cret } var xParamSpecGetNameQuark func(uintptr) glib.Quark // Gets the GQuark for the name. func (x *ParamSpec) GetNameQuark() glib.Quark { cret := xParamSpecGetNameQuark(x.GoPointer()) return cret } var xParamSpecGetNick func(uintptr) string // Get the nickname of a #GParamSpec. func (x *ParamSpec) GetNick() string { cret := xParamSpecGetNick(x.GoPointer()) return cret } var xParamSpecGetQdata func(uintptr, glib.Quark) uintptr // Gets back user data pointers stored via g_param_spec_set_qdata(). func (x *ParamSpec) GetQdata(QuarkVar glib.Quark) uintptr { cret := xParamSpecGetQdata(x.GoPointer(), QuarkVar) return cret } var xParamSpecGetRedirectTarget func(uintptr) uintptr // If the paramspec redirects operations to another paramspec, // returns that paramspec. Redirect is used typically for // providing a new implementation of a property in a derived // type while preserving all the properties from the parent // type. Redirection is established by creating a property // of type #GParamSpecOverride. See g_object_class_override_property() // for an example of the use of this capability. func (x *ParamSpec) GetRedirectTarget() *ParamSpec { var cls *ParamSpec cret := xParamSpecGetRedirectTarget(x.GoPointer()) if cret == 0 { return nil } IncreaseRef(cret) cls = &ParamSpec{} cls.Ptr = cret return cls } var xParamSpecRef func(uintptr) uintptr // Increments the reference count of @pspec. func (x *ParamSpec) Ref() *ParamSpec { var cls *ParamSpec cret := xParamSpecRef(x.GoPointer()) if cret == 0 { return nil } cls = &ParamSpec{} cls.Ptr = cret return cls } var xParamSpecRefSink func(uintptr) uintptr // Convenience function to ref and sink a #GParamSpec. func (x *ParamSpec) RefSink() *ParamSpec { var cls *ParamSpec cret := xParamSpecRefSink(x.GoPointer()) if cret == 0 { return nil } cls = &ParamSpec{} cls.Ptr = cret return cls } var xParamSpecSetQdata func(uintptr, glib.Quark, uintptr) // Sets an opaque, named pointer on a #GParamSpec. The name is // specified through a #GQuark (retrieved e.g. via // g_quark_from_static_string()), and the pointer can be gotten back // from the @pspec with g_param_spec_get_qdata(). Setting a // previously set user data pointer, overrides (frees) the old pointer // set, using %NULL as pointer essentially removes the data stored. func (x *ParamSpec) SetQdata(QuarkVar glib.Quark, DataVar uintptr) { xParamSpecSetQdata(x.GoPointer(), QuarkVar, DataVar) } var xParamSpecSetQdataFull func(uintptr, glib.Quark, uintptr, uintptr) // This function works like g_param_spec_set_qdata(), but in addition, // a `void (*destroy) (gpointer)` function may be // specified which is called with @data as argument when the @pspec is // finalized, or the data is being overwritten by a call to // g_param_spec_set_qdata() with the same @quark. func (x *ParamSpec) SetQdataFull(QuarkVar glib.Quark, DataVar uintptr, DestroyVar *glib.DestroyNotify) { var DestroyVarRef uintptr if DestroyVar != nil { DestroyVarPtr := uintptr(unsafe.Pointer(DestroyVar)) if cbRefPtr, ok := glib.GetCallback(DestroyVarPtr); ok { DestroyVarRef = cbRefPtr } else { fcb := func(arg0 uintptr) { cbFn := *DestroyVar cbFn(arg0) } DestroyVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(DestroyVarPtr, DestroyVarRef, DestroyVar) } } xParamSpecSetQdataFull(x.GoPointer(), QuarkVar, DataVar, DestroyVarRef) } var xParamSpecSink func(uintptr) // The initial reference count of a newly created #GParamSpec is 1, // even though no one has explicitly called g_param_spec_ref() on it // yet. So the initial reference count is flagged as "floating", until // someone calls `g_param_spec_ref (pspec); g_param_spec_sink // (pspec);` in sequence on it, taking over the initial // reference count (thus ending up with a @pspec that has a reference // count of 1 still, but is not flagged "floating" anymore). func (x *ParamSpec) Sink() { xParamSpecSink(x.GoPointer()) } var xParamSpecStealQdata func(uintptr, glib.Quark) uintptr // Gets back user data pointers stored via g_param_spec_set_qdata() // and removes the @data from @pspec without invoking its destroy() // function (if any was set). Usually, calling this function is only // required to update user data pointers with a destroy notifier. func (x *ParamSpec) StealQdata(QuarkVar glib.Quark) uintptr { cret := xParamSpecStealQdata(x.GoPointer(), QuarkVar) return cret } var xParamSpecUnref func(uintptr) // Decrements the reference count of a @pspec. func (x *ParamSpec) Unref() { xParamSpecUnref(x.GoPointer()) } func (c *ParamSpec) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *ParamSpec) SetGoPointer(ptr uintptr) { c.Ptr = ptr } var xParamSpecInternal func(types.GType, string, uintptr, uintptr, ParamFlags) uintptr // Creates a new #GParamSpec instance. // // See [canonical parameter names][class@GObject.ParamSpec#parameter-names] // for details of the rules for @name. Names which violate these rules lead // to undefined behaviour. // // Beyond the name, #GParamSpecs have two more descriptive strings, the // @nick and @blurb, which may be used as a localized label and description. // For GTK and related libraries these are considered deprecated and may be // omitted, while for other libraries such as GStreamer and its plugins they // are essential. When in doubt, follow the conventions used in the // surrounding code and supporting libraries. func ParamSpecInternal(ParamTypeVar types.GType, NameVar string, NickVar *string, BlurbVar *string, FlagsVar ParamFlags) *ParamSpec { var cls *ParamSpec NickVarPtr := core.GStrdupNullable(NickVar) defer core.GFreeNullable(NickVarPtr) BlurbVarPtr := core.GStrdupNullable(BlurbVar) defer core.GFreeNullable(BlurbVarPtr) cret := xParamSpecInternal(ParamTypeVar, NameVar, NickVarPtr, BlurbVarPtr, FlagsVar) if cret == 0 { return nil } IncreaseRef(cret) cls = &ParamSpec{} cls.Ptr = cret return cls } var xParamSpecIsValidName func(string) bool // Validate a property name for a #GParamSpec. This can be useful for // dynamically-generated properties which need to be validated at run-time // before actually trying to create them. // // See [canonical parameter names][class@GObject.ParamSpec#parameter-names] // for details of the rules for valid names. func ParamSpecIsValidName(NameVar string) bool { cret := xParamSpecIsValidName(NameVar) return cret } func init() { core.SetPackageName("GOBJECT", "gobject-2.0") core.SetSharedLibraries("GOBJECT", []string{"libgobject-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GOBJECT") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xParamTypeRegisterStatic, libs, "g_param_type_register_static") core.PuregoSafeRegister(&xParamValueConvert, libs, "g_param_value_convert") core.PuregoSafeRegister(&xParamValueDefaults, libs, "g_param_value_defaults") core.PuregoSafeRegister(&xParamValueIsValid, libs, "g_param_value_is_valid") core.PuregoSafeRegister(&xParamValueSetDefault, libs, "g_param_value_set_default") core.PuregoSafeRegister(&xParamValueValidate, libs, "g_param_value_validate") core.PuregoSafeRegister(&xParamValuesCmp, libs, "g_param_values_cmp") core.PuregoSafeRegister(&xParamSpecPoolFree, libs, "g_param_spec_pool_free") core.PuregoSafeRegister(&xParamSpecPoolInsert, libs, "g_param_spec_pool_insert") core.PuregoSafeRegister(&xParamSpecPoolList, libs, "g_param_spec_pool_list") core.PuregoSafeRegister(&xParamSpecPoolListOwned, libs, "g_param_spec_pool_list_owned") core.PuregoSafeRegister(&xParamSpecPoolLookup, libs, "g_param_spec_pool_lookup") core.PuregoSafeRegister(&xParamSpecPoolRemove, libs, "g_param_spec_pool_remove") core.PuregoSafeRegister(&xParamSpecGLibType, libs, "intern") core.PuregoSafeRegister(&xParamSpecGetBlurb, libs, "g_param_spec_get_blurb") core.PuregoSafeRegister(&xParamSpecGetDefaultValue, libs, "g_param_spec_get_default_value") core.PuregoSafeRegister(&xParamSpecGetName, libs, "g_param_spec_get_name") core.PuregoSafeRegister(&xParamSpecGetNameQuark, libs, "g_param_spec_get_name_quark") core.PuregoSafeRegister(&xParamSpecGetNick, libs, "g_param_spec_get_nick") core.PuregoSafeRegister(&xParamSpecGetQdata, libs, "g_param_spec_get_qdata") core.PuregoSafeRegister(&xParamSpecGetRedirectTarget, libs, "g_param_spec_get_redirect_target") core.PuregoSafeRegister(&xParamSpecRef, libs, "g_param_spec_ref") core.PuregoSafeRegister(&xParamSpecRefSink, libs, "g_param_spec_ref_sink") core.PuregoSafeRegister(&xParamSpecSetQdata, libs, "g_param_spec_set_qdata") core.PuregoSafeRegister(&xParamSpecSetQdataFull, libs, "g_param_spec_set_qdata_full") core.PuregoSafeRegister(&xParamSpecSink, libs, "g_param_spec_sink") core.PuregoSafeRegister(&xParamSpecStealQdata, libs, "g_param_spec_steal_qdata") core.PuregoSafeRegister(&xParamSpecUnref, libs, "g_param_spec_unref") core.PuregoSafeRegister(&xParamSpecInternal, libs, "g_param_spec_internal") core.PuregoSafeRegister(&xParamSpecIsValidName, libs, "g_param_spec_is_valid_name") }