// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type ConstraintClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *ConstraintClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } type ConstraintTargetInterface struct { _ structs.HostLayout } func (x *ConstraintTargetInterface) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Makes it possible to use an object as source or target in a // [class@Gtk.Constraint]. // // Besides `GtkWidget`, it is also implemented by `GtkConstraintGuide`. type ConstraintTarget interface { GoPointer() uintptr SetGoPointer(uintptr) } var xConstraintTargetGLibType func() types.GType func ConstraintTargetGLibType() types.GType { return xConstraintTargetGLibType() } type ConstraintTargetBase struct { Ptr uintptr } func (x *ConstraintTargetBase) GoPointer() uintptr { if x == nil { return 0 } return x.Ptr } func (x *ConstraintTargetBase) SetGoPointer(ptr uintptr) { x.Ptr = ptr } // Describes a constraint between attributes of two widgets, // // expressed as a linear equation. // // The typical equation for a constraint is: // // ``` // // target.target_attr = source.source_attr × multiplier + constant // // ``` // // Each `GtkConstraint` is part of a system that will be solved by a // [class@Gtk.ConstraintLayout] in order to allocate and position each // child widget or guide. // // The source and target, as well as their attributes, of a `GtkConstraint` // instance are immutable after creation. type Constraint struct { gobject.Object } var xConstraintGLibType func() types.GType func ConstraintGLibType() types.GType { return xConstraintGLibType() } func ConstraintNewFromInternalPtr(ptr uintptr) *Constraint { cls := &Constraint{} cls.Ptr = ptr return cls } var xNewConstraint func(uintptr, ConstraintAttribute, ConstraintRelation, uintptr, ConstraintAttribute, float64, float64, int) uintptr // Creates a new constraint representing a relation between a layout // attribute on a source and a layout attribute on a target. func NewConstraint(TargetVar ConstraintTarget, TargetAttributeVar ConstraintAttribute, RelationVar ConstraintRelation, SourceVar ConstraintTarget, SourceAttributeVar ConstraintAttribute, MultiplierVar float64, ConstantVar float64, StrengthVar int) *Constraint { var cls *Constraint cret := xNewConstraint(TargetVar.GoPointer(), TargetAttributeVar, RelationVar, SourceVar.GoPointer(), SourceAttributeVar, MultiplierVar, ConstantVar, StrengthVar) if cret == 0 { return nil } cls = &Constraint{} cls.Ptr = cret return cls } var xNewConstraintConstant func(uintptr, ConstraintAttribute, ConstraintRelation, float64, int) uintptr // Creates a new constraint representing a relation between a layout // attribute on a target and a constant value. func NewConstraintConstant(TargetVar ConstraintTarget, TargetAttributeVar ConstraintAttribute, RelationVar ConstraintRelation, ConstantVar float64, StrengthVar int) *Constraint { var cls *Constraint cret := xNewConstraintConstant(TargetVar.GoPointer(), TargetAttributeVar, RelationVar, ConstantVar, StrengthVar) if cret == 0 { return nil } cls = &Constraint{} cls.Ptr = cret return cls } var xConstraintGetConstant func(uintptr) float64 // Retrieves the constant factor added to the source attributes' value. func (x *Constraint) GetConstant() float64 { cret := xConstraintGetConstant(x.GoPointer()) return cret } var xConstraintGetMultiplier func(uintptr) float64 // Retrieves the multiplication factor applied to the source // attribute's value. func (x *Constraint) GetMultiplier() float64 { cret := xConstraintGetMultiplier(x.GoPointer()) return cret } var xConstraintGetRelation func(uintptr) ConstraintRelation // The order relation between the terms of the constraint. func (x *Constraint) GetRelation() ConstraintRelation { cret := xConstraintGetRelation(x.GoPointer()) return cret } var xConstraintGetSource func(uintptr) uintptr // Retrieves the [iface@Gtk.ConstraintTarget] used as the source for the // constraint. // // If the source is set to `NULL` at creation, the constraint will use // the widget using the [class@Gtk.ConstraintLayout] as the source. func (x *Constraint) GetSource() *ConstraintTargetBase { var cls *ConstraintTargetBase cret := xConstraintGetSource(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ConstraintTargetBase{} cls.Ptr = cret return cls } var xConstraintGetSourceAttribute func(uintptr) ConstraintAttribute // Retrieves the attribute of the source to be read by the constraint. func (x *Constraint) GetSourceAttribute() ConstraintAttribute { cret := xConstraintGetSourceAttribute(x.GoPointer()) return cret } var xConstraintGetStrength func(uintptr) int // Retrieves the strength of the constraint. func (x *Constraint) GetStrength() int { cret := xConstraintGetStrength(x.GoPointer()) return cret } var xConstraintGetTarget func(uintptr) uintptr // Retrieves the [iface@Gtk.ConstraintTarget] used as the target for // the constraint. // // If the targe is set to `NULL` at creation, the constraint will use // the widget using the [class@Gtk.ConstraintLayout] as the target. func (x *Constraint) GetTarget() *ConstraintTargetBase { var cls *ConstraintTargetBase cret := xConstraintGetTarget(x.GoPointer()) if cret == 0 { return nil } gobject.IncreaseRef(cret) cls = &ConstraintTargetBase{} cls.Ptr = cret return cls } var xConstraintGetTargetAttribute func(uintptr) ConstraintAttribute // Retrieves the attribute of the target to be set by the constraint. func (x *Constraint) GetTargetAttribute() ConstraintAttribute { cret := xConstraintGetTargetAttribute(x.GoPointer()) return cret } var xConstraintIsAttached func(uintptr) bool // Checks whether the constraint is attached to a [class@Gtk.ConstraintLayout], // and it is contributing to the layout. func (x *Constraint) IsAttached() bool { cret := xConstraintIsAttached(x.GoPointer()) return cret } var xConstraintIsConstant func(uintptr) bool // Checks whether the constraint describes a relation between an attribute // on the [property@Gtk.Constraint:target] and a constant value. func (x *Constraint) IsConstant() bool { cret := xConstraintIsConstant(x.GoPointer()) return cret } var xConstraintIsRequired func(uintptr) bool // Checks whether the constraint is a required relation for solving the // constraint layout. func (x *Constraint) IsRequired() bool { cret := xConstraintIsRequired(x.GoPointer()) return cret } func (c *Constraint) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *Constraint) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyConstant sets the "constant" property. // The constant value to be added to the [property@Gtk.Constraint:source-attribute]. func (x *Constraint) SetPropertyConstant(value float64) { var v gobject.Value v.Init(gobject.TypeDoubleVal) v.SetDouble(value) x.SetProperty("constant", &v) } // GetPropertyConstant gets the "constant" property. // The constant value to be added to the [property@Gtk.Constraint:source-attribute]. func (x *Constraint) GetPropertyConstant() float64 { var v gobject.Value x.GetProperty("constant", &v) return v.GetDouble() } // SetPropertyMultiplier sets the "multiplier" property. // The multiplication factor to be applied to // the [property@Gtk.Constraint:source-attribute]. func (x *Constraint) SetPropertyMultiplier(value float64) { var v gobject.Value v.Init(gobject.TypeDoubleVal) v.SetDouble(value) x.SetProperty("multiplier", &v) } // GetPropertyMultiplier gets the "multiplier" property. // The multiplication factor to be applied to // the [property@Gtk.Constraint:source-attribute]. func (x *Constraint) GetPropertyMultiplier() float64 { var v gobject.Value x.GetProperty("multiplier", &v) return v.GetDouble() } // SetPropertyStrength sets the "strength" property. // The strength of the constraint. // // The strength can be expressed either using one of the symbolic values // of the [enum@Gtk.ConstraintStrength] enumeration, or any positive integer // value. func (x *Constraint) SetPropertyStrength(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("strength", &v) } // GetPropertyStrength gets the "strength" property. // The strength of the constraint. // // The strength can be expressed either using one of the symbolic values // of the [enum@Gtk.ConstraintStrength] enumeration, or any positive integer // value. func (x *Constraint) GetPropertyStrength() int { var v gobject.Value x.GetProperty("strength", &v) return v.GetInt() } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xConstraintGLibType, libs, "gtk_constraint_get_type") core.PuregoSafeRegister(&xNewConstraint, libs, "gtk_constraint_new") core.PuregoSafeRegister(&xNewConstraintConstant, libs, "gtk_constraint_new_constant") core.PuregoSafeRegister(&xConstraintGetConstant, libs, "gtk_constraint_get_constant") core.PuregoSafeRegister(&xConstraintGetMultiplier, libs, "gtk_constraint_get_multiplier") core.PuregoSafeRegister(&xConstraintGetRelation, libs, "gtk_constraint_get_relation") core.PuregoSafeRegister(&xConstraintGetSource, libs, "gtk_constraint_get_source") core.PuregoSafeRegister(&xConstraintGetSourceAttribute, libs, "gtk_constraint_get_source_attribute") core.PuregoSafeRegister(&xConstraintGetStrength, libs, "gtk_constraint_get_strength") core.PuregoSafeRegister(&xConstraintGetTarget, libs, "gtk_constraint_get_target") core.PuregoSafeRegister(&xConstraintGetTargetAttribute, libs, "gtk_constraint_get_target_attribute") core.PuregoSafeRegister(&xConstraintIsAttached, libs, "gtk_constraint_is_attached") core.PuregoSafeRegister(&xConstraintIsConstant, libs, "gtk_constraint_is_constant") core.PuregoSafeRegister(&xConstraintIsRequired, libs, "gtk_constraint_is_required") core.PuregoSafeRegister(&xConstraintTargetGLibType, libs, "gtk_constraint_target_get_type") }