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 ButtonContentClass struct {
17 _ structs.HostLayout
18
19 ParentClass gtk.WidgetClass
20}
21
22func (x *ButtonContentClass) GoPointer() uintptr {
23 return uintptr(unsafe.Pointer(x))
24}
25
26// A helper widget for creating buttons.
27//
28// <picture>
29//
30// <source srcset="button-content-dark.png" media="(prefers-color-scheme: dark)">
31// <img src="button-content.png" alt="button-content">
32//
33// </picture>
34//
35// `AdwButtonContent` is a box-like widget with an icon and a label.
36//
37// It's intended to be used as a direct child of [class@Gtk.Button],
38// [class@Gtk.MenuButton] or [class@SplitButton], when they need to have both an
39// icon and a label, as follows:
40//
41// ```xml
42// <object class="GtkButton">
43//
44// <property name="child">
45// <object class="AdwButtonContent">
46// <property name="icon-name">document-open-symbolic</property>
47// <property name="label" translatable="yes">_Open</property>
48// <property name="use-underline">True</property>
49// </object>
50// </property>
51//
52// </object>
53// ```
54//
55// `AdwButtonContent` handles style classes and connecting the mnemonic to the
56// button automatically.
57//
58// ## CSS nodes
59//
60// ```
61// buttoncontent
62// ╰── box
63//
64// ├── image
65// ╰── label
66//
67// ```
68//
69// `AdwButtonContent`'s CSS node is called `buttoncontent`. It contains a `box`
70// subnode that serves as a container for the `image` and `label` nodes.
71//
72// When inside a `GtkButton` or `AdwSplitButton`, the button will receive the
73// `.image-text-button` style class. When inside a `GtkMenuButton`, the
74// internal `GtkButton` will receive it instead.
75//
76// ## Accessibility
77//
78// `AdwButtonContent` uses the `GTK_ACCESSIBLE_ROLE_GROUP` role.
79type ButtonContent struct {
80 gtk.Widget
81}
82
83var xButtonContentGLibType func() types.GType
84
85func ButtonContentGLibType() types.GType {
86 return xButtonContentGLibType()
87}
88
89func ButtonContentNewFromInternalPtr(ptr uintptr) *ButtonContent {
90 cls := &ButtonContent{}
91 cls.Ptr = ptr
92 return cls
93}
94
95var xNewButtonContent func() uintptr
96
97// Creates a new `AdwButtonContent`.
98func NewButtonContent() *ButtonContent {
99 var cls *ButtonContent
100
101 cret := xNewButtonContent()
102
103 if cret == 0 {
104 return nil
105 }
106 gobject.IncreaseRef(cret)
107 cls = &ButtonContent{}
108 cls.Ptr = cret
109 return cls
110}
111
112var xButtonContentGetCanShrink func(uintptr) bool
113
114// gets whether the button can be smaller than the natural size of its contents.
115func (x *ButtonContent) GetCanShrink() bool {
116
117 cret := xButtonContentGetCanShrink(x.GoPointer())
118 return cret
119}
120
121var xButtonContentGetIconName func(uintptr) string
122
123// Gets the name of the displayed icon.
124func (x *ButtonContent) GetIconName() string {
125
126 cret := xButtonContentGetIconName(x.GoPointer())
127 return cret
128}
129
130var xButtonContentGetLabel func(uintptr) string
131
132// Gets the displayed label.
133func (x *ButtonContent) GetLabel() string {
134
135 cret := xButtonContentGetLabel(x.GoPointer())
136 return cret
137}
138
139var xButtonContentGetUseUnderline func(uintptr) bool
140
141// Gets whether an underline in the text indicates a mnemonic.
142func (x *ButtonContent) GetUseUnderline() bool {
143
144 cret := xButtonContentGetUseUnderline(x.GoPointer())
145 return cret
146}
147
148var xButtonContentSetCanShrink func(uintptr, bool)
149
150// Sets whether the button can be smaller than the natural size of its contents.
151//
152// If set to `TRUE`, the label will ellipsize.
153//
154// See [method@Gtk.Button.set_can_shrink].
155func (x *ButtonContent) SetCanShrink(CanShrinkVar bool) {
156
157 xButtonContentSetCanShrink(x.GoPointer(), CanShrinkVar)
158
159}
160
161var xButtonContentSetIconName func(uintptr, string)
162
163// Sets the name of the displayed icon.
164//
165// If empty, the icon is not shown.
166func (x *ButtonContent) SetIconName(IconNameVar string) {
167
168 xButtonContentSetIconName(x.GoPointer(), IconNameVar)
169
170}
171
172var xButtonContentSetLabel func(uintptr, string)
173
174// Sets the displayed label.
175func (x *ButtonContent) SetLabel(LabelVar string) {
176
177 xButtonContentSetLabel(x.GoPointer(), LabelVar)
178
179}
180
181var xButtonContentSetUseUnderline func(uintptr, bool)
182
183// Sets whether an underline in the text indicates a mnemonic.
184//
185// The mnemonic can be used to activate the parent button.
186//
187// See [property@ButtonContent:label].
188func (x *ButtonContent) SetUseUnderline(UseUnderlineVar bool) {
189
190 xButtonContentSetUseUnderline(x.GoPointer(), UseUnderlineVar)
191
192}
193
194func (c *ButtonContent) GoPointer() uintptr {
195 if c == nil {
196 return 0
197 }
198 return c.Ptr
199}
200
201func (c *ButtonContent) SetGoPointer(ptr uintptr) {
202 c.Ptr = ptr
203}
204
205// SetPropertyCanShrink sets the "can-shrink" property.
206// Whether the button can be smaller than the natural size of its contents.
207//
208// If set to `TRUE`, the label will ellipsize.
209//
210// See [property@Gtk.Button:can-shrink].
211func (x *ButtonContent) SetPropertyCanShrink(value bool) {
212 var v gobject.Value
213 v.Init(gobject.TypeBooleanVal)
214 v.SetBoolean(value)
215 x.SetProperty("can-shrink", &v)
216}
217
218// GetPropertyCanShrink gets the "can-shrink" property.
219// Whether the button can be smaller than the natural size of its contents.
220//
221// If set to `TRUE`, the label will ellipsize.
222//
223// See [property@Gtk.Button:can-shrink].
224func (x *ButtonContent) GetPropertyCanShrink() bool {
225 var v gobject.Value
226 x.GetProperty("can-shrink", &v)
227 return v.GetBoolean()
228}
229
230// SetPropertyIconName sets the "icon-name" property.
231// The name of the displayed icon.
232//
233// If empty, the icon is not shown.
234func (x *ButtonContent) SetPropertyIconName(value string) {
235 var v gobject.Value
236 v.Init(gobject.TypeStringVal)
237 v.SetString(&value)
238 x.SetProperty("icon-name", &v)
239}
240
241// GetPropertyIconName gets the "icon-name" property.
242// The name of the displayed icon.
243//
244// If empty, the icon is not shown.
245func (x *ButtonContent) GetPropertyIconName() string {
246 var v gobject.Value
247 x.GetProperty("icon-name", &v)
248 return v.GetString()
249}
250
251// SetPropertyLabel sets the "label" property.
252// The displayed label.
253func (x *ButtonContent) SetPropertyLabel(value string) {
254 var v gobject.Value
255 v.Init(gobject.TypeStringVal)
256 v.SetString(&value)
257 x.SetProperty("label", &v)
258}
259
260// GetPropertyLabel gets the "label" property.
261// The displayed label.
262func (x *ButtonContent) GetPropertyLabel() string {
263 var v gobject.Value
264 x.GetProperty("label", &v)
265 return v.GetString()
266}
267
268// SetPropertyUseUnderline sets the "use-underline" property.
269// Whether an underline in the text indicates a mnemonic.
270//
271// The mnemonic can be used to activate the parent button.
272//
273// See [property@ButtonContent:label].
274func (x *ButtonContent) SetPropertyUseUnderline(value bool) {
275 var v gobject.Value
276 v.Init(gobject.TypeBooleanVal)
277 v.SetBoolean(value)
278 x.SetProperty("use-underline", &v)
279}
280
281// GetPropertyUseUnderline gets the "use-underline" property.
282// Whether an underline in the text indicates a mnemonic.
283//
284// The mnemonic can be used to activate the parent button.
285//
286// See [property@ButtonContent:label].
287func (x *ButtonContent) GetPropertyUseUnderline() bool {
288 var v gobject.Value
289 x.GetProperty("use-underline", &v)
290 return v.GetBoolean()
291}
292
293// Requests the user's screen reader to announce the given message.
294//
295// This kind of notification is useful for messages that
296// either have only a visual representation or that are not
297// exposed visually at all, e.g. a notification about a
298// successful operation.
299//
300// Also, by using this API, you can ensure that the message
301// does not interrupts the user's current screen reader output.
302func (x *ButtonContent) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
303
304 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
305
306}
307
308// Retrieves the accessible parent for an accessible object.
309//
310// This function returns `NULL` for top level widgets.
311func (x *ButtonContent) GetAccessibleParent() *gtk.AccessibleBase {
312 var cls *gtk.AccessibleBase
313
314 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
315
316 if cret == 0 {
317 return nil
318 }
319 cls = >k.AccessibleBase{}
320 cls.Ptr = cret
321 return cls
322}
323
324// Retrieves the accessible role of an accessible object.
325func (x *ButtonContent) GetAccessibleRole() gtk.AccessibleRole {
326
327 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
328 return cret
329}
330
331// Retrieves the implementation for the given accessible object.
332func (x *ButtonContent) GetAtContext() *gtk.ATContext {
333 var cls *gtk.ATContext
334
335 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
336
337 if cret == 0 {
338 return nil
339 }
340 cls = >k.ATContext{}
341 cls.Ptr = cret
342 return cls
343}
344
345// Queries the coordinates and dimensions of this accessible
346//
347// This functionality can be overridden by `GtkAccessible`
348// implementations, e.g. to get the bounds from an ignored
349// child widget.
350func (x *ButtonContent) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
351
352 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
353 return cret
354}
355
356// Retrieves the first accessible child of an accessible object.
357func (x *ButtonContent) GetFirstAccessibleChild() *gtk.AccessibleBase {
358 var cls *gtk.AccessibleBase
359
360 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
361
362 if cret == 0 {
363 return nil
364 }
365 cls = >k.AccessibleBase{}
366 cls.Ptr = cret
367 return cls
368}
369
370// Retrieves the next accessible sibling of an accessible object
371func (x *ButtonContent) GetNextAccessibleSibling() *gtk.AccessibleBase {
372 var cls *gtk.AccessibleBase
373
374 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
375
376 if cret == 0 {
377 return nil
378 }
379 cls = >k.AccessibleBase{}
380 cls.Ptr = cret
381 return cls
382}
383
384// Queries a platform state, such as focus.
385//
386// This functionality can be overridden by `GtkAccessible`
387// implementations, e.g. to get platform state from an ignored
388// child widget, as is the case for `GtkText` wrappers.
389func (x *ButtonContent) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
390
391 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
392 return cret
393}
394
395// Resets the accessible property to its default value.
396func (x *ButtonContent) ResetProperty(PropertyVar gtk.AccessibleProperty) {
397
398 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
399
400}
401
402// Resets the accessible relation to its default value.
403func (x *ButtonContent) ResetRelation(RelationVar gtk.AccessibleRelation) {
404
405 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
406
407}
408
409// Resets the accessible state to its default value.
410func (x *ButtonContent) ResetState(StateVar gtk.AccessibleState) {
411
412 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
413
414}
415
416// Sets the parent and sibling of an accessible object.
417//
418// This function is meant to be used by accessible implementations that are
419// not part of the widget hierarchy, and but act as a logical bridge between
420// widgets. For instance, if a widget creates an object that holds metadata
421// for each child, and you want that object to implement the `GtkAccessible`
422// interface, you will use this function to ensure that the parent of each
423// child widget is the metadata object, and the parent of each metadata
424// object is the container widget.
425func (x *ButtonContent) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
426
427 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
428
429}
430
431// Updates the next accessible sibling.
432//
433// That might be useful when a new child of a custom accessible
434// is created, and it needs to be linked to a previous child.
435func (x *ButtonContent) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
436
437 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
438
439}
440
441// Informs ATs that the platform state has changed.
442//
443// This function should be used by `GtkAccessible` implementations that
444// have a platform state but are not widgets. Widgets handle platform
445// states automatically.
446func (x *ButtonContent) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
447
448 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
449
450}
451
452// Updates a list of accessible properties.
453//
454// See the [enum@Gtk.AccessibleProperty] documentation for the
455// value types of accessible properties.
456//
457// This function should be called by `GtkWidget` types whenever
458// an accessible property change must be communicated to assistive
459// technologies.
460//
461// Example:
462// ```c
463// value = gtk_adjustment_get_value (adjustment);
464// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
465//
466// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
467// -1);
468//
469// ```
470func (x *ButtonContent) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
471
472 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
473
474}
475
476// Updates an array of accessible properties.
477//
478// This function should be called by `GtkWidget` types whenever an accessible
479// property change must be communicated to assistive technologies.
480//
481// This function is meant to be used by language bindings.
482func (x *ButtonContent) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
483
484 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
485
486}
487
488// Updates a list of accessible relations.
489//
490// This function should be called by `GtkWidget` types whenever an accessible
491// relation change must be communicated to assistive technologies.
492//
493// If the [enum@Gtk.AccessibleRelation] requires a list of references,
494// you should pass each reference individually, followed by `NULL`, e.g.
495//
496// ```c
497// gtk_accessible_update_relation (accessible,
498//
499// GTK_ACCESSIBLE_RELATION_CONTROLS,
500// ref1, NULL,
501// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
502// ref1, ref2, ref3, NULL,
503// -1);
504//
505// ```
506func (x *ButtonContent) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
507
508 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
509
510}
511
512// Updates an array of accessible relations.
513//
514// This function should be called by `GtkWidget` types whenever an accessible
515// relation change must be communicated to assistive technologies.
516//
517// This function is meant to be used by language bindings.
518func (x *ButtonContent) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
519
520 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
521
522}
523
524// Updates a list of accessible states.
525//
526// See the [enum@Gtk.AccessibleState] documentation for the
527// value types of accessible states.
528//
529// This function should be called by `GtkWidget` types whenever
530// an accessible state change must be communicated to assistive
531// technologies.
532//
533// Example:
534//
535// ```c
536// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
537// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
538//
539// GTK_ACCESSIBLE_STATE_CHECKED, value,
540// -1);
541//
542// ```
543func (x *ButtonContent) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
544
545 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
546
547}
548
549// Updates an array of accessible states.
550//
551// This function should be called by `GtkWidget` types whenever an accessible
552// state change must be communicated to assistive technologies.
553//
554// This function is meant to be used by language bindings.
555func (x *ButtonContent) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
556
557 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
558
559}
560
561// Gets the ID of the @buildable object.
562//
563// `GtkBuilder` sets the name based on the ID attribute
564// of the `<object>` tag used to construct the @buildable.
565func (x *ButtonContent) GetBuildableId() string {
566
567 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
568 return cret
569}
570
571func init() {
572 core.SetPackageName("ADW", "libadwaita-1")
573 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
574 var libs []uintptr
575 for _, libPath := range core.GetPaths("ADW") {
576 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
577 if err != nil {
578 panic(err)
579 }
580 libs = append(libs, lib)
581 }
582
583 core.PuregoSafeRegister(&xButtonContentGLibType, libs, "adw_button_content_get_type")
584
585 core.PuregoSafeRegister(&xNewButtonContent, libs, "adw_button_content_new")
586
587 core.PuregoSafeRegister(&xButtonContentGetCanShrink, libs, "adw_button_content_get_can_shrink")
588 core.PuregoSafeRegister(&xButtonContentGetIconName, libs, "adw_button_content_get_icon_name")
589 core.PuregoSafeRegister(&xButtonContentGetLabel, libs, "adw_button_content_get_label")
590 core.PuregoSafeRegister(&xButtonContentGetUseUnderline, libs, "adw_button_content_get_use_underline")
591 core.PuregoSafeRegister(&xButtonContentSetCanShrink, libs, "adw_button_content_set_can_shrink")
592 core.PuregoSafeRegister(&xButtonContentSetIconName, libs, "adw_button_content_set_icon_name")
593 core.PuregoSafeRegister(&xButtonContentSetLabel, libs, "adw_button_content_set_label")
594 core.PuregoSafeRegister(&xButtonContentSetUseUnderline, libs, "adw_button_content_set_use_underline")
595
596}