v0.2.1 c0399be

gtkconstraint.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type ConstraintClass struct {
16	_ structs.HostLayout
17
18	ParentClass gobject.ObjectClass
19}
20
21func (x *ConstraintClass) GoPointer() uintptr {
22	return uintptr(unsafe.Pointer(x))
23}
24
25type ConstraintTargetInterface struct {
26	_ structs.HostLayout
27}
28
29func (x *ConstraintTargetInterface) GoPointer() uintptr {
30	return uintptr(unsafe.Pointer(x))
31}
32
33// Makes it possible to use an object as source or target in a
34// [class@Gtk.Constraint].
35//
36// Besides `GtkWidget`, it is also implemented by `GtkConstraintGuide`.
37type ConstraintTarget interface {
38	GoPointer() uintptr
39	SetGoPointer(uintptr)
40}
41
42var xConstraintTargetGLibType func() types.GType
43
44func ConstraintTargetGLibType() types.GType {
45	return xConstraintTargetGLibType()
46}
47
48type ConstraintTargetBase struct {
49	Ptr uintptr
50}
51
52func (x *ConstraintTargetBase) GoPointer() uintptr {
53	if x == nil {
54		return 0
55	}
56	return x.Ptr
57}
58
59func (x *ConstraintTargetBase) SetGoPointer(ptr uintptr) {
60	x.Ptr = ptr
61}
62
63// Describes a constraint between attributes of two widgets,
64//
65//	expressed as a linear equation.
66//
67// The typical equation for a constraint is:
68//
69// ```
70//
71//	target.target_attr = source.source_attr × multiplier + constant
72//
73// ```
74//
75// Each `GtkConstraint` is part of a system that will be solved by a
76// [class@Gtk.ConstraintLayout] in order to allocate and position each
77// child widget or guide.
78//
79// The source and target, as well as their attributes, of a `GtkConstraint`
80// instance are immutable after creation.
81type Constraint struct {
82	gobject.Object
83}
84
85var xConstraintGLibType func() types.GType
86
87func ConstraintGLibType() types.GType {
88	return xConstraintGLibType()
89}
90
91func ConstraintNewFromInternalPtr(ptr uintptr) *Constraint {
92	cls := &Constraint{}
93	cls.Ptr = ptr
94	return cls
95}
96
97var xNewConstraint func(uintptr, ConstraintAttribute, ConstraintRelation, uintptr, ConstraintAttribute, float64, float64, int) uintptr
98
99// Creates a new constraint representing a relation between a layout
100// attribute on a source and a layout attribute on a target.
101func NewConstraint(TargetVar ConstraintTarget, TargetAttributeVar ConstraintAttribute, RelationVar ConstraintRelation, SourceVar ConstraintTarget, SourceAttributeVar ConstraintAttribute, MultiplierVar float64, ConstantVar float64, StrengthVar int) *Constraint {
102	var cls *Constraint
103
104	cret := xNewConstraint(TargetVar.GoPointer(), TargetAttributeVar, RelationVar, SourceVar.GoPointer(), SourceAttributeVar, MultiplierVar, ConstantVar, StrengthVar)
105
106	if cret == 0 {
107		return nil
108	}
109	cls = &Constraint{}
110	cls.Ptr = cret
111	return cls
112}
113
114var xNewConstraintConstant func(uintptr, ConstraintAttribute, ConstraintRelation, float64, int) uintptr
115
116// Creates a new constraint representing a relation between a layout
117// attribute on a target and a constant value.
118func NewConstraintConstant(TargetVar ConstraintTarget, TargetAttributeVar ConstraintAttribute, RelationVar ConstraintRelation, ConstantVar float64, StrengthVar int) *Constraint {
119	var cls *Constraint
120
121	cret := xNewConstraintConstant(TargetVar.GoPointer(), TargetAttributeVar, RelationVar, ConstantVar, StrengthVar)
122
123	if cret == 0 {
124		return nil
125	}
126	cls = &Constraint{}
127	cls.Ptr = cret
128	return cls
129}
130
131var xConstraintGetConstant func(uintptr) float64
132
133// Retrieves the constant factor added to the source attributes' value.
134func (x *Constraint) GetConstant() float64 {
135
136	cret := xConstraintGetConstant(x.GoPointer())
137	return cret
138}
139
140var xConstraintGetMultiplier func(uintptr) float64
141
142// Retrieves the multiplication factor applied to the source
143// attribute's value.
144func (x *Constraint) GetMultiplier() float64 {
145
146	cret := xConstraintGetMultiplier(x.GoPointer())
147	return cret
148}
149
150var xConstraintGetRelation func(uintptr) ConstraintRelation
151
152// The order relation between the terms of the constraint.
153func (x *Constraint) GetRelation() ConstraintRelation {
154
155	cret := xConstraintGetRelation(x.GoPointer())
156	return cret
157}
158
159var xConstraintGetSource func(uintptr) uintptr
160
161// Retrieves the [iface@Gtk.ConstraintTarget] used as the source for the
162// constraint.
163//
164// If the source is set to `NULL` at creation, the constraint will use
165// the widget using the [class@Gtk.ConstraintLayout] as the source.
166func (x *Constraint) GetSource() *ConstraintTargetBase {
167	var cls *ConstraintTargetBase
168
169	cret := xConstraintGetSource(x.GoPointer())
170
171	if cret == 0 {
172		return nil
173	}
174	gobject.IncreaseRef(cret)
175	cls = &ConstraintTargetBase{}
176	cls.Ptr = cret
177	return cls
178}
179
180var xConstraintGetSourceAttribute func(uintptr) ConstraintAttribute
181
182// Retrieves the attribute of the source to be read by the constraint.
183func (x *Constraint) GetSourceAttribute() ConstraintAttribute {
184
185	cret := xConstraintGetSourceAttribute(x.GoPointer())
186	return cret
187}
188
189var xConstraintGetStrength func(uintptr) int
190
191// Retrieves the strength of the constraint.
192func (x *Constraint) GetStrength() int {
193
194	cret := xConstraintGetStrength(x.GoPointer())
195	return cret
196}
197
198var xConstraintGetTarget func(uintptr) uintptr
199
200// Retrieves the [iface@Gtk.ConstraintTarget] used as the target for
201// the constraint.
202//
203// If the targe is set to `NULL` at creation, the constraint will use
204// the widget using the [class@Gtk.ConstraintLayout] as the target.
205func (x *Constraint) GetTarget() *ConstraintTargetBase {
206	var cls *ConstraintTargetBase
207
208	cret := xConstraintGetTarget(x.GoPointer())
209
210	if cret == 0 {
211		return nil
212	}
213	gobject.IncreaseRef(cret)
214	cls = &ConstraintTargetBase{}
215	cls.Ptr = cret
216	return cls
217}
218
219var xConstraintGetTargetAttribute func(uintptr) ConstraintAttribute
220
221// Retrieves the attribute of the target to be set by the constraint.
222func (x *Constraint) GetTargetAttribute() ConstraintAttribute {
223
224	cret := xConstraintGetTargetAttribute(x.GoPointer())
225	return cret
226}
227
228var xConstraintIsAttached func(uintptr) bool
229
230// Checks whether the constraint is attached to a [class@Gtk.ConstraintLayout],
231// and it is contributing to the layout.
232func (x *Constraint) IsAttached() bool {
233
234	cret := xConstraintIsAttached(x.GoPointer())
235	return cret
236}
237
238var xConstraintIsConstant func(uintptr) bool
239
240// Checks whether the constraint describes a relation between an attribute
241// on the [property@Gtk.Constraint:target] and a constant value.
242func (x *Constraint) IsConstant() bool {
243
244	cret := xConstraintIsConstant(x.GoPointer())
245	return cret
246}
247
248var xConstraintIsRequired func(uintptr) bool
249
250// Checks whether the constraint is a required relation for solving the
251// constraint layout.
252func (x *Constraint) IsRequired() bool {
253
254	cret := xConstraintIsRequired(x.GoPointer())
255	return cret
256}
257
258func (c *Constraint) GoPointer() uintptr {
259	if c == nil {
260		return 0
261	}
262	return c.Ptr
263}
264
265func (c *Constraint) SetGoPointer(ptr uintptr) {
266	c.Ptr = ptr
267}
268
269// SetPropertyConstant sets the "constant" property.
270// The constant value to be added to the [property@Gtk.Constraint:source-attribute].
271func (x *Constraint) SetPropertyConstant(value float64) {
272	var v gobject.Value
273	v.Init(gobject.TypeDoubleVal)
274	v.SetDouble(value)
275	x.SetProperty("constant", &v)
276}
277
278// GetPropertyConstant gets the "constant" property.
279// The constant value to be added to the [property@Gtk.Constraint:source-attribute].
280func (x *Constraint) GetPropertyConstant() float64 {
281	var v gobject.Value
282	x.GetProperty("constant", &v)
283	return v.GetDouble()
284}
285
286// SetPropertyMultiplier sets the "multiplier" property.
287// The multiplication factor to be applied to
288// the [property@Gtk.Constraint:source-attribute].
289func (x *Constraint) SetPropertyMultiplier(value float64) {
290	var v gobject.Value
291	v.Init(gobject.TypeDoubleVal)
292	v.SetDouble(value)
293	x.SetProperty("multiplier", &v)
294}
295
296// GetPropertyMultiplier gets the "multiplier" property.
297// The multiplication factor to be applied to
298// the [property@Gtk.Constraint:source-attribute].
299func (x *Constraint) GetPropertyMultiplier() float64 {
300	var v gobject.Value
301	x.GetProperty("multiplier", &v)
302	return v.GetDouble()
303}
304
305// SetPropertyStrength sets the "strength" property.
306// The strength of the constraint.
307//
308// The strength can be expressed either using one of the symbolic values
309// of the [enum@Gtk.ConstraintStrength] enumeration, or any positive integer
310// value.
311func (x *Constraint) SetPropertyStrength(value int) {
312	var v gobject.Value
313	v.Init(gobject.TypeIntVal)
314	v.SetInt(value)
315	x.SetProperty("strength", &v)
316}
317
318// GetPropertyStrength gets the "strength" property.
319// The strength of the constraint.
320//
321// The strength can be expressed either using one of the symbolic values
322// of the [enum@Gtk.ConstraintStrength] enumeration, or any positive integer
323// value.
324func (x *Constraint) GetPropertyStrength() int {
325	var v gobject.Value
326	x.GetProperty("strength", &v)
327	return v.GetInt()
328}
329
330func init() {
331	core.SetPackageName("GTK", "gtk4")
332	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
333	var libs []uintptr
334	for _, libPath := range core.GetPaths("GTK") {
335		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
336		if err != nil {
337			panic(err)
338		}
339		libs = append(libs, lib)
340	}
341
342	core.PuregoSafeRegister(&xConstraintGLibType, libs, "gtk_constraint_get_type")
343
344	core.PuregoSafeRegister(&xNewConstraint, libs, "gtk_constraint_new")
345	core.PuregoSafeRegister(&xNewConstraintConstant, libs, "gtk_constraint_new_constant")
346
347	core.PuregoSafeRegister(&xConstraintGetConstant, libs, "gtk_constraint_get_constant")
348	core.PuregoSafeRegister(&xConstraintGetMultiplier, libs, "gtk_constraint_get_multiplier")
349	core.PuregoSafeRegister(&xConstraintGetRelation, libs, "gtk_constraint_get_relation")
350	core.PuregoSafeRegister(&xConstraintGetSource, libs, "gtk_constraint_get_source")
351	core.PuregoSafeRegister(&xConstraintGetSourceAttribute, libs, "gtk_constraint_get_source_attribute")
352	core.PuregoSafeRegister(&xConstraintGetStrength, libs, "gtk_constraint_get_strength")
353	core.PuregoSafeRegister(&xConstraintGetTarget, libs, "gtk_constraint_get_target")
354	core.PuregoSafeRegister(&xConstraintGetTargetAttribute, libs, "gtk_constraint_get_target_attribute")
355	core.PuregoSafeRegister(&xConstraintIsAttached, libs, "gtk_constraint_is_attached")
356	core.PuregoSafeRegister(&xConstraintIsConstant, libs, "gtk_constraint_is_constant")
357	core.PuregoSafeRegister(&xConstraintIsRequired, libs, "gtk_constraint_is_required")
358
359	core.PuregoSafeRegister(&xConstraintTargetGLibType, libs, "gtk_constraint_target_get_type")
360
361}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close