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/gdk"
12 "github.com/bnema/puregotk/v4/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14 "github.com/bnema/puregotk/v4/gtk"
15)
16
17type SpinnerPaintableClass struct {
18 _ structs.HostLayout
19
20 ParentClass gobject.ObjectClass
21}
22
23func (x *SpinnerPaintableClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27// A paintable showing a loading spinner.
28//
29// <picture>
30//
31// <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)">
32// <img src="spinner.png" alt="spinner">
33//
34// </picture>
35//
36// `AdwSpinnerPaintable` size varies depending on the available space, but is
37// capped at 64×64 pixels.
38//
39// To be able to animate, `AdwSpinnerPaintable` needs a widget. It will be
40// animated according to that widget's frame clock, and only if that widget is
41// mapped. Ideally it should be the same widget the paintable is displayed in,
42// but that's not a requirement.
43//
44// Most applications should be using [class@Spinner] instead.
45// `AdwSpinnerPaintable` is provided for the cases where using a widget is
46// impractical or impossible, such as [property@StatusPage:paintable]:
47//
48// ```xml
49// <object class="AdwStatusPage" id="status_page">
50//
51// <property name="paintable">
52// <object class="AdwSpinnerPaintable">
53// <property name="widget">status_page</property>
54// </object>
55// </property>
56// <!-- ... -->
57//
58// </object>
59// ```
60type SpinnerPaintable struct {
61 gobject.Object
62}
63
64var xSpinnerPaintableGLibType func() types.GType
65
66func SpinnerPaintableGLibType() types.GType {
67 return xSpinnerPaintableGLibType()
68}
69
70func SpinnerPaintableNewFromInternalPtr(ptr uintptr) *SpinnerPaintable {
71 cls := &SpinnerPaintable{}
72 cls.Ptr = ptr
73 return cls
74}
75
76var xNewSpinnerPaintable func(uintptr) uintptr
77
78// Creates a new `AdwSpinnerPaintable` for @widget.
79func NewSpinnerPaintable(WidgetVar *gtk.Widget) *SpinnerPaintable {
80 var cls *SpinnerPaintable
81
82 cret := xNewSpinnerPaintable(WidgetVar.GoPointer())
83
84 if cret == 0 {
85 return nil
86 }
87 cls = &SpinnerPaintable{}
88 cls.Ptr = cret
89 return cls
90}
91
92var xSpinnerPaintableGetWidget func(uintptr) uintptr
93
94// Gets the widget used for frame clock.
95func (x *SpinnerPaintable) GetWidget() *gtk.Widget {
96 var cls *gtk.Widget
97
98 cret := xSpinnerPaintableGetWidget(x.GoPointer())
99
100 if cret == 0 {
101 return nil
102 }
103 gobject.IncreaseRef(cret)
104 cls = >k.Widget{}
105 cls.Ptr = cret
106 return cls
107}
108
109var xSpinnerPaintableSetWidget func(uintptr, uintptr)
110
111// Sets the widget used for frame clock.
112func (x *SpinnerPaintable) SetWidget(WidgetVar *gtk.Widget) {
113
114 xSpinnerPaintableSetWidget(x.GoPointer(), WidgetVar.GoPointer())
115
116}
117
118func (c *SpinnerPaintable) GoPointer() uintptr {
119 if c == nil {
120 return 0
121 }
122 return c.Ptr
123}
124
125func (c *SpinnerPaintable) SetGoPointer(ptr uintptr) {
126 c.Ptr = ptr
127}
128
129// Compute a concrete size for the `GdkPaintable`.
130//
131// Applies the sizing algorithm outlined in the
132// [CSS Image spec](https://drafts.csswg.org/css-images-3/#default-sizing)
133// to the given @paintable. See that link for more details.
134//
135// It is not necessary to call this function when both @specified_width
136// and @specified_height are known, but it is useful to call this
137// function in GtkWidget:measure implementations to compute the
138// other dimension when only one dimension is given.
139func (x *SpinnerPaintable) ComputeConcreteSize(SpecifiedWidthVar float64, SpecifiedHeightVar float64, DefaultWidthVar float64, DefaultHeightVar float64, ConcreteWidthVar *float64, ConcreteHeightVar *float64) {
140
141 gdk.XGdkPaintableComputeConcreteSize(x.GoPointer(), SpecifiedWidthVar, SpecifiedHeightVar, DefaultWidthVar, DefaultHeightVar, ConcreteWidthVar, ConcreteHeightVar)
142
143}
144
145// Gets an immutable paintable for the current contents displayed by @paintable.
146//
147// This is useful when you want to retain the current state of an animation,
148// for example to take a screenshot of a running animation.
149//
150// If the @paintable is already immutable, it will return itself.
151func (x *SpinnerPaintable) GetCurrentImage() *gdk.PaintableBase {
152 var cls *gdk.PaintableBase
153
154 cret := gdk.XGdkPaintableGetCurrentImage(x.GoPointer())
155
156 if cret == 0 {
157 return nil
158 }
159 cls = &gdk.PaintableBase{}
160 cls.Ptr = cret
161 return cls
162}
163
164// Get flags for the paintable.
165//
166// This is oftentimes useful for optimizations.
167//
168// See [flags@Gdk.PaintableFlags] for the flags and what they mean.
169func (x *SpinnerPaintable) GetFlags() gdk.PaintableFlags {
170
171 cret := gdk.XGdkPaintableGetFlags(x.GoPointer())
172 return cret
173}
174
175// Gets the preferred aspect ratio the @paintable would like to be displayed at.
176//
177// The aspect ratio is the width divided by the height, so a value of 0.5
178// means that the @paintable prefers to be displayed twice as high as it
179// is wide. Consumers of this interface can use this to preserve aspect
180// ratio when displaying the paintable.
181//
182// This is a purely informational value and does not in any way limit the
183// values that may be passed to [method@Gdk.Paintable.snapshot].
184//
185// Usually when a @paintable returns nonzero values from
186// [method@Gdk.Paintable.get_intrinsic_width] and
187// [method@Gdk.Paintable.get_intrinsic_height] the aspect ratio
188// should conform to those values, though that is not required.
189//
190// If the @paintable does not have a preferred aspect ratio,
191// it returns 0. Negative values are never returned.
192func (x *SpinnerPaintable) GetIntrinsicAspectRatio() float64 {
193
194 cret := gdk.XGdkPaintableGetIntrinsicAspectRatio(x.GoPointer())
195 return cret
196}
197
198// Gets the preferred height the @paintable would like to be displayed at.
199//
200// Consumers of this interface can use this to reserve enough space to draw
201// the paintable.
202//
203// This is a purely informational value and does not in any way limit the
204// values that may be passed to [method@Gdk.Paintable.snapshot].
205//
206// If the @paintable does not have a preferred height, it returns 0.
207// Negative values are never returned.
208func (x *SpinnerPaintable) GetIntrinsicHeight() int {
209
210 cret := gdk.XGdkPaintableGetIntrinsicHeight(x.GoPointer())
211 return cret
212}
213
214// Gets the preferred width the @paintable would like to be displayed at.
215//
216// Consumers of this interface can use this to reserve enough space to draw
217// the paintable.
218//
219// This is a purely informational value and does not in any way limit the
220// values that may be passed to [method@Gdk.Paintable.snapshot].
221//
222// If the @paintable does not have a preferred width, it returns 0.
223// Negative values are never returned.
224func (x *SpinnerPaintable) GetIntrinsicWidth() int {
225
226 cret := gdk.XGdkPaintableGetIntrinsicWidth(x.GoPointer())
227 return cret
228}
229
230// Called by implementations of `GdkPaintable` to invalidate their contents.
231//
232// Unless the contents are invalidated, implementations must guarantee that
233// multiple calls of [method@Gdk.Paintable.snapshot] produce the same output.
234//
235// This function will emit the [signal@Gdk.Paintable::invalidate-contents]
236// signal.
237//
238// If a @paintable reports the %GDK_PAINTABLE_STATIC_CONTENTS flag,
239// it must not call this function.
240func (x *SpinnerPaintable) InvalidateContents() {
241
242 gdk.XGdkPaintableInvalidateContents(x.GoPointer())
243
244}
245
246// Called by implementations of `GdkPaintable` to invalidate their size.
247//
248// As long as the size is not invalidated, @paintable must return the same
249// values for its intrinsic width, height and aspect ratio.
250//
251// This function will emit the [signal@Gdk.Paintable::invalidate-size]
252// signal.
253//
254// If a @paintable reports the %GDK_PAINTABLE_STATIC_SIZE flag,
255// it must not call this function.
256func (x *SpinnerPaintable) InvalidateSize() {
257
258 gdk.XGdkPaintableInvalidateSize(x.GoPointer())
259
260}
261
262// Snapshots the given paintable with the given @width and @height.
263//
264// The paintable is drawn at the current (0,0) offset of the @snapshot.
265// If @width and @height are not larger than zero, this function will
266// do nothing.
267func (x *SpinnerPaintable) Snapshot(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64) {
268
269 gdk.XGdkPaintableSnapshot(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar)
270
271}
272
273// Snapshots the paintable with the given colors.
274//
275// If less than 4 colors are provided, GTK will pad the array with default
276// colors.
277func (x *SpinnerPaintable) SnapshotSymbolic(SnapshotVar *gdk.Snapshot, WidthVar float64, HeightVar float64, ColorsVar []gdk.RGBA, NColorsVar uint) {
278
279 gtk.XGtkSymbolicPaintableSnapshotSymbolic(x.GoPointer(), SnapshotVar.GoPointer(), WidthVar, HeightVar, ColorsVar, NColorsVar)
280
281}
282
283func init() {
284 core.SetPackageName("ADW", "libadwaita-1")
285 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
286 var libs []uintptr
287 for _, libPath := range core.GetPaths("ADW") {
288 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
289 if err != nil {
290 panic(err)
291 }
292 libs = append(libs, lib)
293 }
294
295 core.PuregoSafeRegister(&xSpinnerPaintableGLibType, libs, "adw_spinner_paintable_get_type")
296
297 core.PuregoSafeRegister(&xNewSpinnerPaintable, libs, "adw_spinner_paintable_new")
298
299 core.PuregoSafeRegister(&xSpinnerPaintableGetWidget, libs, "adw_spinner_paintable_get_widget")
300 core.PuregoSafeRegister(&xSpinnerPaintableSetWidget, libs, "adw_spinner_paintable_set_widget")
301
302}