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 ToastOverlayClass struct {
17 _ structs.HostLayout
18
19 ParentClass gtk.WidgetClass
20}
21
22func (x *ToastOverlayClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// A widget showing toasts above its content.
27//
28// <picture>
29//
30// <source srcset="toast-overlay-dark.png" media="(prefers-color-scheme: dark)">
31// <img src="toast-overlay.png" alt="toast-overlay">
32//
33// </picture>
34//
35// Much like [class@Gtk.Overlay], `AdwToastOverlay` is a container with a single
36// main child, on top of which it can display a [class@Toast], overlaid.
37// Toasts can be shown with [method@ToastOverlay.add_toast].
38//
39// Use [method@ToastOverlay.dismiss_all] to dismiss all toasts at once, or
40// [method@Toast.dismiss] to dismiss a single toast.
41//
42// See [class@Toast] for details.
43//
44// ## CSS nodes
45//
46// ```
47// toastoverlay
48// ├── [child]
49// ├── toast
50// ┊ ├── widget
51// ┊ │ ├── [label.heading]
52//
53// │ ╰── [custom title]
54// ├── [button]
55// ╰── button.circular.flat
56//
57// ```
58//
59// `AdwToastOverlay`'s CSS node is called `toastoverlay`. It contains the child,
60// as well as zero or more `toast` subnodes.
61//
62// Each of the `toast` nodes contains a `widget` subnode, optionally a `button`
63// subnode, and another `button` subnode with `.circular` and `.flat` style
64// classes.
65//
66// The `widget` subnode contains a `label` subnode with the `.heading` style
67// class, or a custom widget provided by the application.
68//
69// ## Accessibility
70//
71// `AdwToastOverlay` uses the [enum@Gtk.AccessibleRole.GROUP] role.
72type ToastOverlay struct {
73 gtk.Widget
74}
75
76var xToastOverlayGLibType func() types.GType
77
78func ToastOverlayGLibType() types.GType {
79 return xToastOverlayGLibType()
80}
81
82func ToastOverlayNewFromInternalPtr(ptr uintptr) *ToastOverlay {
83 cls := &ToastOverlay{}
84 cls.Ptr = ptr
85 return cls
86}
87
88var xNewToastOverlay func() uintptr
89
90// Creates a new `AdwToastOverlay`.
91func NewToastOverlay() *ToastOverlay {
92 var cls *ToastOverlay
93
94 cret := xNewToastOverlay()
95
96 if cret == 0 {
97 return nil
98 }
99 gobject.IncreaseRef(cret)
100 cls = &ToastOverlay{}
101 cls.Ptr = cret
102 return cls
103}
104
105var xToastOverlayAddToast func(uintptr, uintptr)
106
107// Displays @toast.
108//
109// Only one toast can be shown at a time; if a toast is already being displayed,
110// either @toast or the original toast will be placed in a queue, depending on
111// the priority of @toast. See [property@Toast:priority].
112//
113// If called on a toast that's already displayed, its timeout will be reset.
114//
115// If called on a toast currently in the queue, the toast will be bumped
116// forward to be shown as soon as possible.
117func (x *ToastOverlay) AddToast(ToastVar *Toast) {
118
119 xToastOverlayAddToast(x.GoPointer(), ToastVar.GoPointer())
120
121}
122
123var xToastOverlayDismissAll func(uintptr)
124
125// Dismisses all displayed toasts.
126//
127// Use [method@Toast.dismiss] to dismiss a single toast.
128func (x *ToastOverlay) DismissAll() {
129
130 xToastOverlayDismissAll(x.GoPointer())
131
132}
133
134var xToastOverlayGetChild func(uintptr) uintptr
135
136// Gets the child widget of @self.
137func (x *ToastOverlay) GetChild() *gtk.Widget {
138 var cls *gtk.Widget
139
140 cret := xToastOverlayGetChild(x.GoPointer())
141
142 if cret == 0 {
143 return nil
144 }
145 gobject.IncreaseRef(cret)
146 cls = >k.Widget{}
147 cls.Ptr = cret
148 return cls
149}
150
151var xToastOverlaySetChild func(uintptr, uintptr)
152
153// Sets the child widget of @self.
154func (x *ToastOverlay) SetChild(ChildVar *gtk.Widget) {
155
156 xToastOverlaySetChild(x.GoPointer(), ChildVar.GoPointer())
157
158}
159
160func (c *ToastOverlay) GoPointer() uintptr {
161 if c == nil {
162 return 0
163 }
164 return c.Ptr
165}
166
167func (c *ToastOverlay) SetGoPointer(ptr uintptr) {
168 c.Ptr = ptr
169}
170
171// Requests the user's screen reader to announce the given message.
172//
173// This kind of notification is useful for messages that
174// either have only a visual representation or that are not
175// exposed visually at all, e.g. a notification about a
176// successful operation.
177//
178// Also, by using this API, you can ensure that the message
179// does not interrupts the user's current screen reader output.
180func (x *ToastOverlay) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
181
182 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
183
184}
185
186// Retrieves the accessible parent for an accessible object.
187//
188// This function returns `NULL` for top level widgets.
189func (x *ToastOverlay) GetAccessibleParent() *gtk.AccessibleBase {
190 var cls *gtk.AccessibleBase
191
192 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
193
194 if cret == 0 {
195 return nil
196 }
197 cls = >k.AccessibleBase{}
198 cls.Ptr = cret
199 return cls
200}
201
202// Retrieves the accessible role of an accessible object.
203func (x *ToastOverlay) GetAccessibleRole() gtk.AccessibleRole {
204
205 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
206 return cret
207}
208
209// Retrieves the implementation for the given accessible object.
210func (x *ToastOverlay) GetAtContext() *gtk.ATContext {
211 var cls *gtk.ATContext
212
213 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
214
215 if cret == 0 {
216 return nil
217 }
218 cls = >k.ATContext{}
219 cls.Ptr = cret
220 return cls
221}
222
223// Queries the coordinates and dimensions of this accessible
224//
225// This functionality can be overridden by `GtkAccessible`
226// implementations, e.g. to get the bounds from an ignored
227// child widget.
228func (x *ToastOverlay) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
229
230 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
231 return cret
232}
233
234// Retrieves the first accessible child of an accessible object.
235func (x *ToastOverlay) GetFirstAccessibleChild() *gtk.AccessibleBase {
236 var cls *gtk.AccessibleBase
237
238 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
239
240 if cret == 0 {
241 return nil
242 }
243 cls = >k.AccessibleBase{}
244 cls.Ptr = cret
245 return cls
246}
247
248// Retrieves the next accessible sibling of an accessible object
249func (x *ToastOverlay) GetNextAccessibleSibling() *gtk.AccessibleBase {
250 var cls *gtk.AccessibleBase
251
252 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
253
254 if cret == 0 {
255 return nil
256 }
257 cls = >k.AccessibleBase{}
258 cls.Ptr = cret
259 return cls
260}
261
262// Queries a platform state, such as focus.
263//
264// This functionality can be overridden by `GtkAccessible`
265// implementations, e.g. to get platform state from an ignored
266// child widget, as is the case for `GtkText` wrappers.
267func (x *ToastOverlay) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
268
269 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
270 return cret
271}
272
273// Resets the accessible property to its default value.
274func (x *ToastOverlay) ResetProperty(PropertyVar gtk.AccessibleProperty) {
275
276 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
277
278}
279
280// Resets the accessible relation to its default value.
281func (x *ToastOverlay) ResetRelation(RelationVar gtk.AccessibleRelation) {
282
283 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
284
285}
286
287// Resets the accessible state to its default value.
288func (x *ToastOverlay) ResetState(StateVar gtk.AccessibleState) {
289
290 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
291
292}
293
294// Sets the parent and sibling of an accessible object.
295//
296// This function is meant to be used by accessible implementations that are
297// not part of the widget hierarchy, and but act as a logical bridge between
298// widgets. For instance, if a widget creates an object that holds metadata
299// for each child, and you want that object to implement the `GtkAccessible`
300// interface, you will use this function to ensure that the parent of each
301// child widget is the metadata object, and the parent of each metadata
302// object is the container widget.
303func (x *ToastOverlay) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
304
305 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
306
307}
308
309// Updates the next accessible sibling.
310//
311// That might be useful when a new child of a custom accessible
312// is created, and it needs to be linked to a previous child.
313func (x *ToastOverlay) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
314
315 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
316
317}
318
319// Informs ATs that the platform state has changed.
320//
321// This function should be used by `GtkAccessible` implementations that
322// have a platform state but are not widgets. Widgets handle platform
323// states automatically.
324func (x *ToastOverlay) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
325
326 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
327
328}
329
330// Updates a list of accessible properties.
331//
332// See the [enum@Gtk.AccessibleProperty] documentation for the
333// value types of accessible properties.
334//
335// This function should be called by `GtkWidget` types whenever
336// an accessible property change must be communicated to assistive
337// technologies.
338//
339// Example:
340// ```c
341// value = gtk_adjustment_get_value (adjustment);
342// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
343//
344// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
345// -1);
346//
347// ```
348func (x *ToastOverlay) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
349
350 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
351
352}
353
354// Updates an array of accessible properties.
355//
356// This function should be called by `GtkWidget` types whenever an accessible
357// property change must be communicated to assistive technologies.
358//
359// This function is meant to be used by language bindings.
360func (x *ToastOverlay) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
361
362 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
363
364}
365
366// Updates a list of accessible relations.
367//
368// This function should be called by `GtkWidget` types whenever an accessible
369// relation change must be communicated to assistive technologies.
370//
371// If the [enum@Gtk.AccessibleRelation] requires a list of references,
372// you should pass each reference individually, followed by `NULL`, e.g.
373//
374// ```c
375// gtk_accessible_update_relation (accessible,
376//
377// GTK_ACCESSIBLE_RELATION_CONTROLS,
378// ref1, NULL,
379// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
380// ref1, ref2, ref3, NULL,
381// -1);
382//
383// ```
384func (x *ToastOverlay) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
385
386 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
387
388}
389
390// Updates an array of accessible relations.
391//
392// This function should be called by `GtkWidget` types whenever an accessible
393// relation change must be communicated to assistive technologies.
394//
395// This function is meant to be used by language bindings.
396func (x *ToastOverlay) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
397
398 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
399
400}
401
402// Updates a list of accessible states.
403//
404// See the [enum@Gtk.AccessibleState] documentation for the
405// value types of accessible states.
406//
407// This function should be called by `GtkWidget` types whenever
408// an accessible state change must be communicated to assistive
409// technologies.
410//
411// Example:
412//
413// ```c
414// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
415// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
416//
417// GTK_ACCESSIBLE_STATE_CHECKED, value,
418// -1);
419//
420// ```
421func (x *ToastOverlay) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
422
423 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
424
425}
426
427// Updates an array of accessible states.
428//
429// This function should be called by `GtkWidget` types whenever an accessible
430// state change must be communicated to assistive technologies.
431//
432// This function is meant to be used by language bindings.
433func (x *ToastOverlay) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
434
435 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
436
437}
438
439// Gets the ID of the @buildable object.
440//
441// `GtkBuilder` sets the name based on the ID attribute
442// of the `<object>` tag used to construct the @buildable.
443func (x *ToastOverlay) GetBuildableId() string {
444
445 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
446 return cret
447}
448
449func init() {
450 core.SetPackageName("ADW", "libadwaita-1")
451 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
452 var libs []uintptr
453 for _, libPath := range core.GetPaths("ADW") {
454 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
455 if err != nil {
456 panic(err)
457 }
458 libs = append(libs, lib)
459 }
460
461 core.PuregoSafeRegister(&xToastOverlayGLibType, libs, "adw_toast_overlay_get_type")
462
463 core.PuregoSafeRegister(&xNewToastOverlay, libs, "adw_toast_overlay_new")
464
465 core.PuregoSafeRegister(&xToastOverlayAddToast, libs, "adw_toast_overlay_add_toast")
466 core.PuregoSafeRegister(&xToastOverlayDismissAll, libs, "adw_toast_overlay_dismiss_all")
467 core.PuregoSafeRegister(&xToastOverlayGetChild, libs, "adw_toast_overlay_get_child")
468 core.PuregoSafeRegister(&xToastOverlaySetChild, libs, "adw_toast_overlay_set_child")
469
470}