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 ClampLayoutClass struct {
17 _ structs.HostLayout
18
19 ParentClass gtk.LayoutManagerClass
20}
21
22func (x *ClampLayoutClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// A layout manager constraining its children 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// `AdwClampLayout` constraints the size of the widgets it contains to a given
42// maximum size. It will constrain the width if it is horizontal, or the height
43// if it is vertical. The expansion of the children from their minimum to their
44// maximum size is eased out for a smooth transition.
45//
46// If a child requires more than the requested maximum size, it will be
47// allocated the minimum size it can fit in instead.
48//
49// `AdwClampLayout` can scale with the text scale factor, use the
50// [property@ClampLayout:unit] property to enable that behavior.
51//
52// See also: [class@Clamp], [class@ClampScrollable].
53type ClampLayout struct {
54 gtk.LayoutManager
55}
56
57var xClampLayoutGLibType func() types.GType
58
59func ClampLayoutGLibType() types.GType {
60 return xClampLayoutGLibType()
61}
62
63func ClampLayoutNewFromInternalPtr(ptr uintptr) *ClampLayout {
64 cls := &ClampLayout{}
65 cls.Ptr = ptr
66 return cls
67}
68
69var xNewClampLayout func() uintptr
70
71// Creates a new `AdwClampLayout`.
72func NewClampLayout() *ClampLayout {
73 var cls *ClampLayout
74
75 cret := xNewClampLayout()
76
77 if cret == 0 {
78 return nil
79 }
80 cls = &ClampLayout{}
81 cls.Ptr = cret
82 return cls
83}
84
85var xClampLayoutGetMaximumSize func(uintptr) int
86
87// Gets the maximum size allocated to the children.
88func (x *ClampLayout) GetMaximumSize() int {
89
90 cret := xClampLayoutGetMaximumSize(x.GoPointer())
91 return cret
92}
93
94var xClampLayoutGetTighteningThreshold func(uintptr) int
95
96// Gets the size above which the children are clamped.
97func (x *ClampLayout) GetTighteningThreshold() int {
98
99 cret := xClampLayoutGetTighteningThreshold(x.GoPointer())
100 return cret
101}
102
103var xClampLayoutGetUnit func(uintptr) LengthUnit
104
105// Gets the length unit for maximum size and tightening threshold.
106func (x *ClampLayout) GetUnit() LengthUnit {
107
108 cret := xClampLayoutGetUnit(x.GoPointer())
109 return cret
110}
111
112var xClampLayoutSetMaximumSize func(uintptr, int)
113
114// Sets the maximum size allocated to the children.
115//
116// It is the width if the layout is horizontal, or the height if it is vertical.
117func (x *ClampLayout) SetMaximumSize(MaximumSizeVar int) {
118
119 xClampLayoutSetMaximumSize(x.GoPointer(), MaximumSizeVar)
120
121}
122
123var xClampLayoutSetTighteningThreshold func(uintptr, int)
124
125// Sets the size above which the children are clamped.
126//
127// Starting from this size, the layout will tighten its grip on the children,
128// slowly allocating less and less of the available size up to the maximum
129// allocated size. Below that threshold and below the maximum size, the children
130// will be allocated all the available size.
131//
132// If the threshold is greater than the maximum size to allocate to the
133// children, they will be allocated the whole size up to the maximum. If the
134// threshold is lower than the minimum size to allocate to the children, that
135// size will be used as the tightening threshold.
136//
137// Effectively, tightening the grip on a child before it reaches its maximum
138// size makes transitions to and from the maximum size smoother when resizing.
139func (x *ClampLayout) SetTighteningThreshold(TighteningThresholdVar int) {
140
141 xClampLayoutSetTighteningThreshold(x.GoPointer(), TighteningThresholdVar)
142
143}
144
145var xClampLayoutSetUnit func(uintptr, LengthUnit)
146
147// Sets the length unit for maximum size and tightening threshold.
148//
149// Allows the sizes to vary depending on the text scale factor.
150func (x *ClampLayout) SetUnit(UnitVar LengthUnit) {
151
152 xClampLayoutSetUnit(x.GoPointer(), UnitVar)
153
154}
155
156func (c *ClampLayout) GoPointer() uintptr {
157 if c == nil {
158 return 0
159 }
160 return c.Ptr
161}
162
163func (c *ClampLayout) SetGoPointer(ptr uintptr) {
164 c.Ptr = ptr
165}
166
167// SetPropertyMaximumSize sets the "maximum-size" property.
168// The maximum size to allocate to the children.
169//
170// It is the width if the layout is horizontal, or the height if it is
171// vertical.
172func (x *ClampLayout) SetPropertyMaximumSize(value int) {
173 var v gobject.Value
174 v.Init(gobject.TypeIntVal)
175 v.SetInt(value)
176 x.SetProperty("maximum-size", &v)
177}
178
179// GetPropertyMaximumSize gets the "maximum-size" property.
180// The maximum size to allocate to the children.
181//
182// It is the width if the layout is horizontal, or the height if it is
183// vertical.
184func (x *ClampLayout) GetPropertyMaximumSize() int {
185 var v gobject.Value
186 x.GetProperty("maximum-size", &v)
187 return v.GetInt()
188}
189
190// SetPropertyTighteningThreshold sets the "tightening-threshold" property.
191// The size above which the children are clamped.
192//
193// Starting from this size, the layout will tighten its grip on the children,
194// slowly allocating less and less of the available size up to the maximum
195// allocated size. Below that threshold and below the maximum size, the
196// children will be allocated all the available size.
197//
198// If the threshold is greater than the maximum size to allocate to the
199// children, they will be allocated the whole size up to the maximum. If the
200// threshold is lower than the minimum size to allocate to the children, that
201// size will be used as the tightening threshold.
202//
203// Effectively, tightening the grip on a child before it reaches its maximum
204// size makes transitions to and from the maximum size smoother when resizing.
205func (x *ClampLayout) SetPropertyTighteningThreshold(value int) {
206 var v gobject.Value
207 v.Init(gobject.TypeIntVal)
208 v.SetInt(value)
209 x.SetProperty("tightening-threshold", &v)
210}
211
212// GetPropertyTighteningThreshold gets the "tightening-threshold" property.
213// The size above which the children are clamped.
214//
215// Starting from this size, the layout will tighten its grip on the children,
216// slowly allocating less and less of the available size up to the maximum
217// allocated size. Below that threshold and below the maximum size, the
218// children will be allocated all the available size.
219//
220// If the threshold is greater than the maximum size to allocate to the
221// children, they will be allocated the whole size up to the maximum. If the
222// threshold is lower than the minimum size to allocate to the children, that
223// size will be used as the tightening threshold.
224//
225// Effectively, tightening the grip on a child before it reaches its maximum
226// size makes transitions to and from the maximum size smoother when resizing.
227func (x *ClampLayout) GetPropertyTighteningThreshold() int {
228 var v gobject.Value
229 x.GetProperty("tightening-threshold", &v)
230 return v.GetInt()
231}
232
233// Retrieves the orientation of the @orientable.
234func (x *ClampLayout) GetOrientation() gtk.Orientation {
235
236 cret := gtk.XGtkOrientableGetOrientation(x.GoPointer())
237 return cret
238}
239
240// Sets the orientation of the @orientable.
241func (x *ClampLayout) SetOrientation(OrientationVar gtk.Orientation) {
242
243 gtk.XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
244
245}
246
247func init() {
248 core.SetPackageName("ADW", "libadwaita-1")
249 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
250 var libs []uintptr
251 for _, libPath := range core.GetPaths("ADW") {
252 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
253 if err != nil {
254 panic(err)
255 }
256 libs = append(libs, lib)
257 }
258
259 core.PuregoSafeRegister(&xClampLayoutGLibType, libs, "adw_clamp_layout_get_type")
260
261 core.PuregoSafeRegister(&xNewClampLayout, libs, "adw_clamp_layout_new")
262
263 core.PuregoSafeRegister(&xClampLayoutGetMaximumSize, libs, "adw_clamp_layout_get_maximum_size")
264 core.PuregoSafeRegister(&xClampLayoutGetTighteningThreshold, libs, "adw_clamp_layout_get_tightening_threshold")
265 core.PuregoSafeRegister(&xClampLayoutGetUnit, libs, "adw_clamp_layout_get_unit")
266 core.PuregoSafeRegister(&xClampLayoutSetMaximumSize, libs, "adw_clamp_layout_set_maximum_size")
267 core.PuregoSafeRegister(&xClampLayoutSetTighteningThreshold, libs, "adw_clamp_layout_set_tightening_threshold")
268 core.PuregoSafeRegister(&xClampLayoutSetUnit, libs, "adw_clamp_layout_set_unit")
269
270}