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/gio"
12 "github.com/bnema/puregotk/v4/glib"
13 "github.com/bnema/puregotk/v4/gobject"
14 "github.com/bnema/puregotk/v4/gobject/types"
15 "github.com/bnema/puregotk/v4/gtk"
16)
17
18type PreferencesGroupClass struct {
19 _ structs.HostLayout
20
21 ParentClass gtk.WidgetClass
22
23 Padding [4]uintptr
24}
25
26func (x *PreferencesGroupClass) GoPointer() uintptr {
27 return uintptr(unsafe.Pointer(x))
28}
29
30// A group of preference rows.
31//
32// <picture>
33//
34// <source srcset="preferences-group-dark.png" media="(prefers-color-scheme: dark)">
35// <img src="preferences-group.png" alt="preferences-group">
36//
37// </picture>
38//
39// An `AdwPreferencesGroup` represents a group or tightly related preferences,
40// which in turn are represented by [class@PreferencesRow].
41//
42// To summarize the role of the preferences it gathers, a group can have both a
43// title and a description. The title will be used by [class@PreferencesDialog]
44// to let the user look for a preference.
45//
46// The [property@PreferencesGroup:separate-rows] property can be used to
47// separate the rows within the group, same as when using the
48// [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
49// instead of `.boxed-list`.
50//
51// ## AdwPreferencesGroup as GtkBuildable
52//
53// The `AdwPreferencesGroup` implementation of the [iface@Gtk.Buildable] interface
54// supports adding [class@PreferencesRow]s to the list by omitting "type". If "type"
55// is omitted and the widget isn't a [class@PreferencesRow] the child is added to
56// a box below the list.
57//
58// When the "type" attribute of a child is `header-suffix`, the child
59// is set as the suffix on the end of the title and description.
60//
61// ## CSS nodes
62//
63// `AdwPreferencesGroup` has a single CSS node with name `preferencesgroup`.
64//
65// ## Accessibility
66//
67// `AdwPreferencesGroup` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
68type PreferencesGroup struct {
69 gtk.Widget
70}
71
72var xPreferencesGroupGLibType func() types.GType
73
74func PreferencesGroupGLibType() types.GType {
75 return xPreferencesGroupGLibType()
76}
77
78func PreferencesGroupNewFromInternalPtr(ptr uintptr) *PreferencesGroup {
79 cls := &PreferencesGroup{}
80 cls.Ptr = ptr
81 return cls
82}
83
84var xNewPreferencesGroup func() uintptr
85
86// Creates a new `AdwPreferencesGroup`.
87func NewPreferencesGroup() *PreferencesGroup {
88 var cls *PreferencesGroup
89
90 cret := xNewPreferencesGroup()
91
92 if cret == 0 {
93 return nil
94 }
95 gobject.IncreaseRef(cret)
96 cls = &PreferencesGroup{}
97 cls.Ptr = cret
98 return cls
99}
100
101var xPreferencesGroupAdd func(uintptr, uintptr)
102
103// Adds a child to @self.
104func (x *PreferencesGroup) Add(ChildVar *gtk.Widget) {
105
106 xPreferencesGroupAdd(x.GoPointer(), ChildVar.GoPointer())
107
108}
109
110var xPreferencesGroupBindModel func(uintptr, uintptr, uintptr, uintptr, uintptr)
111
112// Binds @model to @self.
113//
114// See [method@Gtk.ListBox.bind_model].
115func (x *PreferencesGroup) BindModel(ModelVar gio.ListModel, CreateRowFuncVar *gtk.ListBoxCreateWidgetFunc, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) {
116
117 var CreateRowFuncVarRef uintptr
118 if CreateRowFuncVar != nil {
119 CreateRowFuncVarPtr := uintptr(unsafe.Pointer(CreateRowFuncVar))
120 if cbRefPtr, ok := glib.GetCallback(CreateRowFuncVarPtr); ok {
121 CreateRowFuncVarRef = cbRefPtr
122 } else {
123 fcb := func(arg0 uintptr, arg1 uintptr) uintptr {
124 cbFn := *CreateRowFuncVar
125 return cbFn(arg0, arg1)
126 }
127 CreateRowFuncVarRef = purego.NewCallback(fcb)
128 glib.SaveCallbackWithClosure(CreateRowFuncVarPtr, CreateRowFuncVarRef, CreateRowFuncVar)
129 }
130 }
131
132 var UserDataFreeFuncVarRef uintptr
133 if UserDataFreeFuncVar != nil {
134 UserDataFreeFuncVarPtr := uintptr(unsafe.Pointer(UserDataFreeFuncVar))
135 if cbRefPtr, ok := glib.GetCallback(UserDataFreeFuncVarPtr); ok {
136 UserDataFreeFuncVarRef = cbRefPtr
137 } else {
138 fcb := func(arg0 uintptr) {
139 cbFn := *UserDataFreeFuncVar
140 cbFn(arg0)
141 }
142 UserDataFreeFuncVarRef = purego.NewCallback(fcb)
143 glib.SaveCallbackWithClosure(UserDataFreeFuncVarPtr, UserDataFreeFuncVarRef, UserDataFreeFuncVar)
144 }
145 }
146
147 xPreferencesGroupBindModel(x.GoPointer(), ModelVar.GoPointer(), CreateRowFuncVarRef, UserDataVar, UserDataFreeFuncVarRef)
148
149}
150
151var xPreferencesGroupGetDescription func(uintptr) string
152
153// Gets the description of @self.
154func (x *PreferencesGroup) GetDescription() string {
155
156 cret := xPreferencesGroupGetDescription(x.GoPointer())
157 return cret
158}
159
160var xPreferencesGroupGetHeaderSuffix func(uintptr) uintptr
161
162// Gets the suffix for @self's header.
163func (x *PreferencesGroup) GetHeaderSuffix() *gtk.Widget {
164 var cls *gtk.Widget
165
166 cret := xPreferencesGroupGetHeaderSuffix(x.GoPointer())
167
168 if cret == 0 {
169 return nil
170 }
171 gobject.IncreaseRef(cret)
172 cls = >k.Widget{}
173 cls.Ptr = cret
174 return cls
175}
176
177var xPreferencesGroupGetRow func(uintptr, uint) uintptr
178
179// Gets the row at @index.
180//
181// Can return `NULL` if @index is larger than the number of rows in the group.
182func (x *PreferencesGroup) GetRow(IndexVar uint) *gtk.Widget {
183 var cls *gtk.Widget
184
185 cret := xPreferencesGroupGetRow(x.GoPointer(), IndexVar)
186
187 if cret == 0 {
188 return nil
189 }
190 gobject.IncreaseRef(cret)
191 cls = >k.Widget{}
192 cls.Ptr = cret
193 return cls
194}
195
196var xPreferencesGroupGetSeparateRows func(uintptr) bool
197
198// Gets whether @self's rows are separated.
199func (x *PreferencesGroup) GetSeparateRows() bool {
200
201 cret := xPreferencesGroupGetSeparateRows(x.GoPointer())
202 return cret
203}
204
205var xPreferencesGroupGetTitle func(uintptr) string
206
207// Gets the title of @self.
208func (x *PreferencesGroup) GetTitle() string {
209
210 cret := xPreferencesGroupGetTitle(x.GoPointer())
211 return cret
212}
213
214var xPreferencesGroupRemove func(uintptr, uintptr)
215
216// Removes a child from @self.
217func (x *PreferencesGroup) Remove(ChildVar *gtk.Widget) {
218
219 xPreferencesGroupRemove(x.GoPointer(), ChildVar.GoPointer())
220
221}
222
223var xPreferencesGroupSetDescription func(uintptr, uintptr)
224
225// Sets the description for @self.
226func (x *PreferencesGroup) SetDescription(DescriptionVar *string) {
227
228 DescriptionVarPtr := core.GStrdupNullable(DescriptionVar)
229 defer core.GFreeNullable(DescriptionVarPtr)
230
231 xPreferencesGroupSetDescription(x.GoPointer(), DescriptionVarPtr)
232
233}
234
235var xPreferencesGroupSetHeaderSuffix func(uintptr, uintptr)
236
237// Sets the suffix for @self's header.
238//
239// Displayed above the list, next to the title and description.
240//
241// Suffixes are commonly used to show a button or a spinner for the whole group.
242func (x *PreferencesGroup) SetHeaderSuffix(SuffixVar *gtk.Widget) {
243
244 xPreferencesGroupSetHeaderSuffix(x.GoPointer(), SuffixVar.GoPointer())
245
246}
247
248var xPreferencesGroupSetSeparateRows func(uintptr, bool)
249
250// Sets whether @self's rows are separated.
251//
252// Equivalent to using the
253// [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
254// on a [class@Gtk.ListBox] instead of `.boxed-list`.
255func (x *PreferencesGroup) SetSeparateRows(SeparateRowsVar bool) {
256
257 xPreferencesGroupSetSeparateRows(x.GoPointer(), SeparateRowsVar)
258
259}
260
261var xPreferencesGroupSetTitle func(uintptr, string)
262
263// Sets the title for @self.
264func (x *PreferencesGroup) SetTitle(TitleVar string) {
265
266 xPreferencesGroupSetTitle(x.GoPointer(), TitleVar)
267
268}
269
270func (c *PreferencesGroup) GoPointer() uintptr {
271 if c == nil {
272 return 0
273 }
274 return c.Ptr
275}
276
277func (c *PreferencesGroup) SetGoPointer(ptr uintptr) {
278 c.Ptr = ptr
279}
280
281// SetPropertyDescription sets the "description" property.
282// The description for this group of preferences.
283func (x *PreferencesGroup) SetPropertyDescription(value string) {
284 var v gobject.Value
285 v.Init(gobject.TypeStringVal)
286 v.SetString(&value)
287 x.SetProperty("description", &v)
288}
289
290// GetPropertyDescription gets the "description" property.
291// The description for this group of preferences.
292func (x *PreferencesGroup) GetPropertyDescription() string {
293 var v gobject.Value
294 x.GetProperty("description", &v)
295 return v.GetString()
296}
297
298// SetPropertySeparateRows sets the "separate-rows" property.
299// Whether to separate rows.
300//
301// Equivalent to using the
302// [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
303// on a [class@Gtk.ListBox] instead of `.boxed-list`.
304func (x *PreferencesGroup) SetPropertySeparateRows(value bool) {
305 var v gobject.Value
306 v.Init(gobject.TypeBooleanVal)
307 v.SetBoolean(value)
308 x.SetProperty("separate-rows", &v)
309}
310
311// GetPropertySeparateRows gets the "separate-rows" property.
312// Whether to separate rows.
313//
314// Equivalent to using the
315// [`.boxed-list-separate`](style-classes.html#boxed-lists-cards) style class
316// on a [class@Gtk.ListBox] instead of `.boxed-list`.
317func (x *PreferencesGroup) GetPropertySeparateRows() bool {
318 var v gobject.Value
319 x.GetProperty("separate-rows", &v)
320 return v.GetBoolean()
321}
322
323// SetPropertyTitle sets the "title" property.
324// The title for this group of preferences.
325func (x *PreferencesGroup) SetPropertyTitle(value string) {
326 var v gobject.Value
327 v.Init(gobject.TypeStringVal)
328 v.SetString(&value)
329 x.SetProperty("title", &v)
330}
331
332// GetPropertyTitle gets the "title" property.
333// The title for this group of preferences.
334func (x *PreferencesGroup) GetPropertyTitle() string {
335 var v gobject.Value
336 x.GetProperty("title", &v)
337 return v.GetString()
338}
339
340// Requests the user's screen reader to announce the given message.
341//
342// This kind of notification is useful for messages that
343// either have only a visual representation or that are not
344// exposed visually at all, e.g. a notification about a
345// successful operation.
346//
347// Also, by using this API, you can ensure that the message
348// does not interrupts the user's current screen reader output.
349func (x *PreferencesGroup) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
350
351 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
352
353}
354
355// Retrieves the accessible parent for an accessible object.
356//
357// This function returns `NULL` for top level widgets.
358func (x *PreferencesGroup) GetAccessibleParent() *gtk.AccessibleBase {
359 var cls *gtk.AccessibleBase
360
361 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
362
363 if cret == 0 {
364 return nil
365 }
366 cls = >k.AccessibleBase{}
367 cls.Ptr = cret
368 return cls
369}
370
371// Retrieves the accessible role of an accessible object.
372func (x *PreferencesGroup) GetAccessibleRole() gtk.AccessibleRole {
373
374 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
375 return cret
376}
377
378// Retrieves the implementation for the given accessible object.
379func (x *PreferencesGroup) GetAtContext() *gtk.ATContext {
380 var cls *gtk.ATContext
381
382 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
383
384 if cret == 0 {
385 return nil
386 }
387 cls = >k.ATContext{}
388 cls.Ptr = cret
389 return cls
390}
391
392// Queries the coordinates and dimensions of this accessible
393//
394// This functionality can be overridden by `GtkAccessible`
395// implementations, e.g. to get the bounds from an ignored
396// child widget.
397func (x *PreferencesGroup) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
398
399 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
400 return cret
401}
402
403// Retrieves the first accessible child of an accessible object.
404func (x *PreferencesGroup) GetFirstAccessibleChild() *gtk.AccessibleBase {
405 var cls *gtk.AccessibleBase
406
407 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
408
409 if cret == 0 {
410 return nil
411 }
412 cls = >k.AccessibleBase{}
413 cls.Ptr = cret
414 return cls
415}
416
417// Retrieves the next accessible sibling of an accessible object
418func (x *PreferencesGroup) GetNextAccessibleSibling() *gtk.AccessibleBase {
419 var cls *gtk.AccessibleBase
420
421 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
422
423 if cret == 0 {
424 return nil
425 }
426 cls = >k.AccessibleBase{}
427 cls.Ptr = cret
428 return cls
429}
430
431// Queries a platform state, such as focus.
432//
433// This functionality can be overridden by `GtkAccessible`
434// implementations, e.g. to get platform state from an ignored
435// child widget, as is the case for `GtkText` wrappers.
436func (x *PreferencesGroup) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
437
438 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
439 return cret
440}
441
442// Resets the accessible property to its default value.
443func (x *PreferencesGroup) ResetProperty(PropertyVar gtk.AccessibleProperty) {
444
445 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
446
447}
448
449// Resets the accessible relation to its default value.
450func (x *PreferencesGroup) ResetRelation(RelationVar gtk.AccessibleRelation) {
451
452 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
453
454}
455
456// Resets the accessible state to its default value.
457func (x *PreferencesGroup) ResetState(StateVar gtk.AccessibleState) {
458
459 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
460
461}
462
463// Sets the parent and sibling of an accessible object.
464//
465// This function is meant to be used by accessible implementations that are
466// not part of the widget hierarchy, and but act as a logical bridge between
467// widgets. For instance, if a widget creates an object that holds metadata
468// for each child, and you want that object to implement the `GtkAccessible`
469// interface, you will use this function to ensure that the parent of each
470// child widget is the metadata object, and the parent of each metadata
471// object is the container widget.
472func (x *PreferencesGroup) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
473
474 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
475
476}
477
478// Updates the next accessible sibling.
479//
480// That might be useful when a new child of a custom accessible
481// is created, and it needs to be linked to a previous child.
482func (x *PreferencesGroup) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
483
484 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
485
486}
487
488// Informs ATs that the platform state has changed.
489//
490// This function should be used by `GtkAccessible` implementations that
491// have a platform state but are not widgets. Widgets handle platform
492// states automatically.
493func (x *PreferencesGroup) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
494
495 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
496
497}
498
499// Updates a list of accessible properties.
500//
501// See the [enum@Gtk.AccessibleProperty] documentation for the
502// value types of accessible properties.
503//
504// This function should be called by `GtkWidget` types whenever
505// an accessible property change must be communicated to assistive
506// technologies.
507//
508// Example:
509// ```c
510// value = gtk_adjustment_get_value (adjustment);
511// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
512//
513// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
514// -1);
515//
516// ```
517func (x *PreferencesGroup) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
518
519 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
520
521}
522
523// Updates an array of accessible properties.
524//
525// This function should be called by `GtkWidget` types whenever an accessible
526// property change must be communicated to assistive technologies.
527//
528// This function is meant to be used by language bindings.
529func (x *PreferencesGroup) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
530
531 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
532
533}
534
535// Updates a list of accessible relations.
536//
537// This function should be called by `GtkWidget` types whenever an accessible
538// relation change must be communicated to assistive technologies.
539//
540// If the [enum@Gtk.AccessibleRelation] requires a list of references,
541// you should pass each reference individually, followed by `NULL`, e.g.
542//
543// ```c
544// gtk_accessible_update_relation (accessible,
545//
546// GTK_ACCESSIBLE_RELATION_CONTROLS,
547// ref1, NULL,
548// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
549// ref1, ref2, ref3, NULL,
550// -1);
551//
552// ```
553func (x *PreferencesGroup) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
554
555 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
556
557}
558
559// Updates an array of accessible relations.
560//
561// This function should be called by `GtkWidget` types whenever an accessible
562// relation change must be communicated to assistive technologies.
563//
564// This function is meant to be used by language bindings.
565func (x *PreferencesGroup) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
566
567 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
568
569}
570
571// Updates a list of accessible states.
572//
573// See the [enum@Gtk.AccessibleState] documentation for the
574// value types of accessible states.
575//
576// This function should be called by `GtkWidget` types whenever
577// an accessible state change must be communicated to assistive
578// technologies.
579//
580// Example:
581//
582// ```c
583// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
584// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
585//
586// GTK_ACCESSIBLE_STATE_CHECKED, value,
587// -1);
588//
589// ```
590func (x *PreferencesGroup) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
591
592 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
593
594}
595
596// Updates an array of accessible states.
597//
598// This function should be called by `GtkWidget` types whenever an accessible
599// state change must be communicated to assistive technologies.
600//
601// This function is meant to be used by language bindings.
602func (x *PreferencesGroup) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
603
604 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
605
606}
607
608// Gets the ID of the @buildable object.
609//
610// `GtkBuilder` sets the name based on the ID attribute
611// of the `<object>` tag used to construct the @buildable.
612func (x *PreferencesGroup) GetBuildableId() string {
613
614 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
615 return cret
616}
617
618func init() {
619 core.SetPackageName("ADW", "libadwaita-1")
620 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
621 var libs []uintptr
622 for _, libPath := range core.GetPaths("ADW") {
623 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
624 if err != nil {
625 panic(err)
626 }
627 libs = append(libs, lib)
628 }
629
630 core.PuregoSafeRegister(&xPreferencesGroupGLibType, libs, "adw_preferences_group_get_type")
631
632 core.PuregoSafeRegister(&xNewPreferencesGroup, libs, "adw_preferences_group_new")
633
634 core.PuregoSafeRegister(&xPreferencesGroupAdd, libs, "adw_preferences_group_add")
635 core.PuregoSafeRegister(&xPreferencesGroupBindModel, libs, "adw_preferences_group_bind_model")
636 core.PuregoSafeRegister(&xPreferencesGroupGetDescription, libs, "adw_preferences_group_get_description")
637 core.PuregoSafeRegister(&xPreferencesGroupGetHeaderSuffix, libs, "adw_preferences_group_get_header_suffix")
638 core.PuregoSafeRegister(&xPreferencesGroupGetRow, libs, "adw_preferences_group_get_row")
639 core.PuregoSafeRegister(&xPreferencesGroupGetSeparateRows, libs, "adw_preferences_group_get_separate_rows")
640 core.PuregoSafeRegister(&xPreferencesGroupGetTitle, libs, "adw_preferences_group_get_title")
641 core.PuregoSafeRegister(&xPreferencesGroupRemove, libs, "adw_preferences_group_remove")
642 core.PuregoSafeRegister(&xPreferencesGroupSetDescription, libs, "adw_preferences_group_set_description")
643 core.PuregoSafeRegister(&xPreferencesGroupSetHeaderSuffix, libs, "adw_preferences_group_set_header_suffix")
644 core.PuregoSafeRegister(&xPreferencesGroupSetSeparateRows, libs, "adw_preferences_group_set_separate_rows")
645 core.PuregoSafeRegister(&xPreferencesGroupSetTitle, libs, "adw_preferences_group_set_title")
646
647}