1// Package adw was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package adw
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 "github.com/bnema/puregotk/v4/gtk"
14)
15
16type ClampClass struct {
17 _ structs.HostLayout
18
19 ParentClass gtk.WidgetClass
20}
21
22func (x *ClampClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// A widget constraining its child to a given size.
27//
28// <picture>
29//
30// <source srcset="clamp-wide-dark.png" media="(prefers-color-scheme: dark)">
31// <img src="clamp-wide.png" alt="clamp-wide">
32//
33// </picture>
34// <picture>
35//
36// <source srcset="clamp-narrow-dark.png" media="(prefers-color-scheme: dark)">
37// <img src="clamp-narrow.png" alt="clamp-narrow">
38//
39// </picture>
40//
41// The `AdwClamp` widget constrains the size of the widget it contains to a
42// given maximum size. It will constrain the width if it is horizontal, or the
43// height if it is vertical. The expansion of the child from its minimum to its
44// maximum size is eased out for a smooth transition.
45//
46// If the child requires more than the requested maximum size, it will be
47// allocated the minimum size it can fit in instead.
48//
49// `AdwClamp` can scale with the text scale factor, use the
50// [property@Clamp:unit] property to enable that behavior.
51//
52// See also: [class@ClampLayout], [class@ClampScrollable].
53//
54// ## CSS nodes
55//
56// `AdwClamp` has a single CSS node with name `clamp`.
57type Clamp struct {
58 gtk.Widget
59}
60
61var xClampGLibType func() types.GType
62
63func ClampGLibType() types.GType {
64 return xClampGLibType()
65}
66
67func ClampNewFromInternalPtr(ptr uintptr) *Clamp {
68 cls := &Clamp{}
69 cls.Ptr = ptr
70 return cls
71}
72
73var xNewClamp func() uintptr
74
75// Creates a new `AdwClamp`.
76func NewClamp() *Clamp {
77 var cls *Clamp
78
79 cret := xNewClamp()
80
81 if cret == 0 {
82 return nil
83 }
84 gobject.IncreaseRef(cret)
85 cls = &Clamp{}
86 cls.Ptr = cret
87 return cls
88}
89
90var xClampGetChild func(uintptr) uintptr
91
92// Gets the child widget of @self.
93func (x *Clamp) GetChild() *gtk.Widget {
94 var cls *gtk.Widget
95
96 cret := xClampGetChild(x.GoPointer())
97
98 if cret == 0 {
99 return nil
100 }
101 gobject.IncreaseRef(cret)
102 cls = >k.Widget{}
103 cls.Ptr = cret
104 return cls
105}
106
107var xClampGetMaximumSize func(uintptr) int
108
109// Gets the maximum size allocated to the child.
110func (x *Clamp) GetMaximumSize() int {
111
112 cret := xClampGetMaximumSize(x.GoPointer())
113 return cret
114}
115
116var xClampGetTighteningThreshold func(uintptr) int
117
118// Gets the size above which the child is clamped.
119func (x *Clamp) GetTighteningThreshold() int {
120
121 cret := xClampGetTighteningThreshold(x.GoPointer())
122 return cret
123}
124
125var xClampGetUnit func(uintptr) LengthUnit
126
127// Gets the length unit for maximum size and tightening threshold.
128func (x *Clamp) GetUnit() LengthUnit {
129
130 cret := xClampGetUnit(x.GoPointer())
131 return cret
132}
133
134var xClampSetChild func(uintptr, uintptr)
135
136// Sets the child widget of @self.
137func (x *Clamp) SetChild(ChildVar *gtk.Widget) {
138
139 xClampSetChild(x.GoPointer(), ChildVar.GoPointer())
140
141}
142
143var xClampSetMaximumSize func(uintptr, int)
144
145// Sets the maximum size allocated to the child.
146//
147// It is the width if the clamp is horizontal, or the height if it is vertical.
148func (x *Clamp) SetMaximumSize(MaximumSizeVar int) {
149
150 xClampSetMaximumSize(x.GoPointer(), MaximumSizeVar)
151
152}
153
154var xClampSetTighteningThreshold func(uintptr, int)
155
156// Sets the size above which the child is clamped.
157//
158// Starting from this size, the clamp will tighten its grip on the child, slowly
159// allocating less and less of the available size up to the maximum allocated
160// size. Below that threshold and below the maximum size, the child will be
161// allocated all the available size.
162//
163// If the threshold is greater than the maximum size to allocate to the child,
164// the child will be allocated all the size up to the maximum. If the threshold
165// is lower than the minimum size to allocate to the child, that size will be
166// used as the tightening threshold.
167//
168// Effectively, tightening the grip on the child before it reaches its maximum
169// size makes transitions to and from the maximum size smoother when resizing.
170func (x *Clamp) SetTighteningThreshold(TighteningThresholdVar int) {
171
172 xClampSetTighteningThreshold(x.GoPointer(), TighteningThresholdVar)
173
174}
175
176var xClampSetUnit func(uintptr, LengthUnit)
177
178// Sets the length unit for maximum size and tightening threshold.
179//
180// Allows the sizes to vary depending on the text scale factor.
181func (x *Clamp) SetUnit(UnitVar LengthUnit) {
182
183 xClampSetUnit(x.GoPointer(), UnitVar)
184
185}
186
187func (c *Clamp) GoPointer() uintptr {
188 if c == nil {
189 return 0
190 }
191 return c.Ptr
192}
193
194func (c *Clamp) SetGoPointer(ptr uintptr) {
195 c.Ptr = ptr
196}
197
198// SetPropertyMaximumSize sets the "maximum-size" property.
199// The maximum size allocated to the child.
200//
201// It is the width if the clamp is horizontal, or the height if it is vertical.
202func (x *Clamp) SetPropertyMaximumSize(value int) {
203 var v gobject.Value
204 v.Init(gobject.TypeIntVal)
205 v.SetInt(value)
206 x.SetProperty("maximum-size", &v)
207}
208
209// GetPropertyMaximumSize gets the "maximum-size" property.
210// The maximum size allocated to the child.
211//
212// It is the width if the clamp is horizontal, or the height if it is vertical.
213func (x *Clamp) GetPropertyMaximumSize() int {
214 var v gobject.Value
215 x.GetProperty("maximum-size", &v)
216 return v.GetInt()
217}
218
219// SetPropertyTighteningThreshold sets the "tightening-threshold" property.
220// The size above which the child is clamped.
221//
222// Starting from this size, the clamp will tighten its grip on the child,
223// slowly allocating less and less of the available size up to the maximum
224// allocated size. Below that threshold and below the maximum size, the child
225// will be allocated all the available size.
226//
227// If the threshold is greater than the maximum size to allocate to the child,
228// the child will be allocated all the size up to the maximum.
229// If the threshold is lower than the minimum size to allocate to the child,
230// that size will be used as the tightening threshold.
231//
232// Effectively, tightening the grip on the child before it reaches its maximum
233// size makes transitions to and from the maximum size smoother when resizing.
234func (x *Clamp) SetPropertyTighteningThreshold(value int) {
235 var v gobject.Value
236 v.Init(gobject.TypeIntVal)
237 v.SetInt(value)
238 x.SetProperty("tightening-threshold", &v)
239}
240
241// GetPropertyTighteningThreshold gets the "tightening-threshold" property.
242// The size above which the child is clamped.
243//
244// Starting from this size, the clamp will tighten its grip on the child,
245// slowly allocating less and less of the available size up to the maximum
246// allocated size. Below that threshold and below the maximum size, the child
247// will be allocated all the available size.
248//
249// If the threshold is greater than the maximum size to allocate to the child,
250// the child will be allocated all the size up to the maximum.
251// If the threshold is lower than the minimum size to allocate to the child,
252// that size will be used as the tightening threshold.
253//
254// Effectively, tightening the grip on the child before it reaches its maximum
255// size makes transitions to and from the maximum size smoother when resizing.
256func (x *Clamp) GetPropertyTighteningThreshold() int {
257 var v gobject.Value
258 x.GetProperty("tightening-threshold", &v)
259 return v.GetInt()
260}
261
262// Requests the user's screen reader to announce the given message.
263//
264// This kind of notification is useful for messages that
265// either have only a visual representation or that are not
266// exposed visually at all, e.g. a notification about a
267// successful operation.
268//
269// Also, by using this API, you can ensure that the message
270// does not interrupts the user's current screen reader output.
271func (x *Clamp) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
272
273 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
274
275}
276
277// Retrieves the accessible parent for an accessible object.
278//
279// This function returns `NULL` for top level widgets.
280func (x *Clamp) GetAccessibleParent() *gtk.AccessibleBase {
281 var cls *gtk.AccessibleBase
282
283 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
284
285 if cret == 0 {
286 return nil
287 }
288 cls = >k.AccessibleBase{}
289 cls.Ptr = cret
290 return cls
291}
292
293// Retrieves the accessible role of an accessible object.
294func (x *Clamp) GetAccessibleRole() gtk.AccessibleRole {
295
296 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
297 return cret
298}
299
300// Retrieves the implementation for the given accessible object.
301func (x *Clamp) GetAtContext() *gtk.ATContext {
302 var cls *gtk.ATContext
303
304 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
305
306 if cret == 0 {
307 return nil
308 }
309 cls = >k.ATContext{}
310 cls.Ptr = cret
311 return cls
312}
313
314// Queries the coordinates and dimensions of this accessible
315//
316// This functionality can be overridden by `GtkAccessible`
317// implementations, e.g. to get the bounds from an ignored
318// child widget.
319func (x *Clamp) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
320
321 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
322 return cret
323}
324
325// Retrieves the first accessible child of an accessible object.
326func (x *Clamp) GetFirstAccessibleChild() *gtk.AccessibleBase {
327 var cls *gtk.AccessibleBase
328
329 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
330
331 if cret == 0 {
332 return nil
333 }
334 cls = >k.AccessibleBase{}
335 cls.Ptr = cret
336 return cls
337}
338
339// Retrieves the next accessible sibling of an accessible object
340func (x *Clamp) GetNextAccessibleSibling() *gtk.AccessibleBase {
341 var cls *gtk.AccessibleBase
342
343 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
344
345 if cret == 0 {
346 return nil
347 }
348 cls = >k.AccessibleBase{}
349 cls.Ptr = cret
350 return cls
351}
352
353// Queries a platform state, such as focus.
354//
355// This functionality can be overridden by `GtkAccessible`
356// implementations, e.g. to get platform state from an ignored
357// child widget, as is the case for `GtkText` wrappers.
358func (x *Clamp) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
359
360 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
361 return cret
362}
363
364// Resets the accessible property to its default value.
365func (x *Clamp) ResetProperty(PropertyVar gtk.AccessibleProperty) {
366
367 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
368
369}
370
371// Resets the accessible relation to its default value.
372func (x *Clamp) ResetRelation(RelationVar gtk.AccessibleRelation) {
373
374 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
375
376}
377
378// Resets the accessible state to its default value.
379func (x *Clamp) ResetState(StateVar gtk.AccessibleState) {
380
381 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
382
383}
384
385// Sets the parent and sibling of an accessible object.
386//
387// This function is meant to be used by accessible implementations that are
388// not part of the widget hierarchy, and but act as a logical bridge between
389// widgets. For instance, if a widget creates an object that holds metadata
390// for each child, and you want that object to implement the `GtkAccessible`
391// interface, you will use this function to ensure that the parent of each
392// child widget is the metadata object, and the parent of each metadata
393// object is the container widget.
394func (x *Clamp) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
395
396 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
397
398}
399
400// Updates the next accessible sibling.
401//
402// That might be useful when a new child of a custom accessible
403// is created, and it needs to be linked to a previous child.
404func (x *Clamp) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
405
406 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
407
408}
409
410// Informs ATs that the platform state has changed.
411//
412// This function should be used by `GtkAccessible` implementations that
413// have a platform state but are not widgets. Widgets handle platform
414// states automatically.
415func (x *Clamp) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
416
417 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
418
419}
420
421// Updates a list of accessible properties.
422//
423// See the [enum@Gtk.AccessibleProperty] documentation for the
424// value types of accessible properties.
425//
426// This function should be called by `GtkWidget` types whenever
427// an accessible property change must be communicated to assistive
428// technologies.
429//
430// Example:
431// ```c
432// value = gtk_adjustment_get_value (adjustment);
433// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
434//
435// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
436// -1);
437//
438// ```
439func (x *Clamp) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
440
441 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
442
443}
444
445// Updates an array of accessible properties.
446//
447// This function should be called by `GtkWidget` types whenever an accessible
448// property change must be communicated to assistive technologies.
449//
450// This function is meant to be used by language bindings.
451func (x *Clamp) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
452
453 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
454
455}
456
457// Updates a list of accessible relations.
458//
459// This function should be called by `GtkWidget` types whenever an accessible
460// relation change must be communicated to assistive technologies.
461//
462// If the [enum@Gtk.AccessibleRelation] requires a list of references,
463// you should pass each reference individually, followed by `NULL`, e.g.
464//
465// ```c
466// gtk_accessible_update_relation (accessible,
467//
468// GTK_ACCESSIBLE_RELATION_CONTROLS,
469// ref1, NULL,
470// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
471// ref1, ref2, ref3, NULL,
472// -1);
473//
474// ```
475func (x *Clamp) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
476
477 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
478
479}
480
481// Updates an array of accessible relations.
482//
483// This function should be called by `GtkWidget` types whenever an accessible
484// relation change must be communicated to assistive technologies.
485//
486// This function is meant to be used by language bindings.
487func (x *Clamp) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
488
489 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
490
491}
492
493// Updates a list of accessible states.
494//
495// See the [enum@Gtk.AccessibleState] documentation for the
496// value types of accessible states.
497//
498// This function should be called by `GtkWidget` types whenever
499// an accessible state change must be communicated to assistive
500// technologies.
501//
502// Example:
503//
504// ```c
505// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
506// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
507//
508// GTK_ACCESSIBLE_STATE_CHECKED, value,
509// -1);
510//
511// ```
512func (x *Clamp) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
513
514 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
515
516}
517
518// Updates an array of accessible states.
519//
520// This function should be called by `GtkWidget` types whenever an accessible
521// state change must be communicated to assistive technologies.
522//
523// This function is meant to be used by language bindings.
524func (x *Clamp) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
525
526 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
527
528}
529
530// Gets the ID of the @buildable object.
531//
532// `GtkBuilder` sets the name based on the ID attribute
533// of the `<object>` tag used to construct the @buildable.
534func (x *Clamp) GetBuildableId() string {
535
536 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
537 return cret
538}
539
540// Retrieves the orientation of the @orientable.
541func (x *Clamp) GetOrientation() gtk.Orientation {
542
543 cret := gtk.XGtkOrientableGetOrientation(x.GoPointer())
544 return cret
545}
546
547// Sets the orientation of the @orientable.
548func (x *Clamp) SetOrientation(OrientationVar gtk.Orientation) {
549
550 gtk.XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
551
552}
553
554func init() {
555 core.SetPackageName("ADW", "libadwaita-1")
556 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
557 var libs []uintptr
558 for _, libPath := range core.GetPaths("ADW") {
559 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
560 if err != nil {
561 panic(err)
562 }
563 libs = append(libs, lib)
564 }
565
566 core.PuregoSafeRegister(&xClampGLibType, libs, "adw_clamp_get_type")
567
568 core.PuregoSafeRegister(&xNewClamp, libs, "adw_clamp_new")
569
570 core.PuregoSafeRegister(&xClampGetChild, libs, "adw_clamp_get_child")
571 core.PuregoSafeRegister(&xClampGetMaximumSize, libs, "adw_clamp_get_maximum_size")
572 core.PuregoSafeRegister(&xClampGetTighteningThreshold, libs, "adw_clamp_get_tightening_threshold")
573 core.PuregoSafeRegister(&xClampGetUnit, libs, "adw_clamp_get_unit")
574 core.PuregoSafeRegister(&xClampSetChild, libs, "adw_clamp_set_child")
575 core.PuregoSafeRegister(&xClampSetMaximumSize, libs, "adw_clamp_set_maximum_size")
576 core.PuregoSafeRegister(&xClampSetTighteningThreshold, libs, "adw_clamp_set_tightening_threshold")
577 core.PuregoSafeRegister(&xClampSetUnit, libs, "adw_clamp_set_unit")
578
579}