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/glib"
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 ButtonRowClass struct {
18 _ structs.HostLayout
19
20 ParentClass PreferencesRowClass
21}
22
23func (x *ButtonRowClass) GoPointer() uintptr {
24 return uintptr(unsafe.Pointer(x))
25}
26
27// A [class@Gtk.ListBoxRow] that looks like a button.
28//
29// <picture>
30//
31// <source srcset="button-rows-dark.png" media="(prefers-color-scheme: dark)">
32// <img src="button-rows.png" alt="button-rows">
33//
34// </picture>
35//
36// The `AdwButtonRow` widget has a title and two icons: before and after the
37// title.
38//
39// It is convenient for presenting actions like "Delete" at the end of a boxed
40// list.
41//
42// `AdwButtonRow` is always activatable.
43//
44// ## CSS nodes
45//
46// `AdwButtonRow` has a main CSS node with name `row` and the style class
47// `.button`.
48//
49// It contains the subnode `box` for its main horizontal box, which contains the
50// nodes: `image.icon.start` for the start icon, `label.title` for the title,
51// and `image.icon.end` for the end icon.
52//
53// ## Style classes
54//
55// The [`.suggested-action`](style-classes.html#suggested-action) style class
56// makes `AdwButtonRow` use accent color for its background. It should be used
57// very sparingly to denote important buttons.
58//
59// <picture>
60//
61// <source srcset="button-row-suggested-action-dark.png" media="(prefers-color-scheme: dark)">
62// <img src="button-row-suggested-action.png" alt="button-row-suggested-action">
63//
64// </picture>
65//
66// The [`.destructive-action`](style-classes.html#destructive-action) style
67// makes the row use destructive colors. It can be used to draw attention to the
68// potentially damaging consequences of using it. This style acts as a warning
69// to the user.
70//
71// <picture>
72//
73// <source srcset="button-row-destructive-action-dark.png" media="(prefers-color-scheme: dark)">
74// <img src="button-row-destructive-action.png" alt="button-row-destructive-action">
75//
76// </picture>
77type ButtonRow struct {
78 PreferencesRow
79}
80
81var xButtonRowGLibType func() types.GType
82
83func ButtonRowGLibType() types.GType {
84 return xButtonRowGLibType()
85}
86
87func ButtonRowNewFromInternalPtr(ptr uintptr) *ButtonRow {
88 cls := &ButtonRow{}
89 cls.Ptr = ptr
90 return cls
91}
92
93var xNewButtonRow func() uintptr
94
95// Creates a new `AdwButtonRow`.
96func NewButtonRow() *ButtonRow {
97 var cls *ButtonRow
98
99 cret := xNewButtonRow()
100
101 if cret == 0 {
102 return nil
103 }
104 gobject.IncreaseRef(cret)
105 cls = &ButtonRow{}
106 cls.Ptr = cret
107 return cls
108}
109
110var xButtonRowGetEndIconName func(uintptr) string
111
112// Gets the end icon name for @self.
113func (x *ButtonRow) GetEndIconName() string {
114
115 cret := xButtonRowGetEndIconName(x.GoPointer())
116 return cret
117}
118
119var xButtonRowGetStartIconName func(uintptr) string
120
121// Gets the start icon name for @self.
122func (x *ButtonRow) GetStartIconName() string {
123
124 cret := xButtonRowGetStartIconName(x.GoPointer())
125 return cret
126}
127
128var xButtonRowSetEndIconName func(uintptr, uintptr)
129
130// Sets the end icon name for @self.
131func (x *ButtonRow) SetEndIconName(IconNameVar *string) {
132
133 IconNameVarPtr := core.GStrdupNullable(IconNameVar)
134 defer core.GFreeNullable(IconNameVarPtr)
135
136 xButtonRowSetEndIconName(x.GoPointer(), IconNameVarPtr)
137
138}
139
140var xButtonRowSetStartIconName func(uintptr, uintptr)
141
142// Sets the start icon name for @self.
143func (x *ButtonRow) SetStartIconName(IconNameVar *string) {
144
145 IconNameVarPtr := core.GStrdupNullable(IconNameVar)
146 defer core.GFreeNullable(IconNameVarPtr)
147
148 xButtonRowSetStartIconName(x.GoPointer(), IconNameVarPtr)
149
150}
151
152func (c *ButtonRow) GoPointer() uintptr {
153 if c == nil {
154 return 0
155 }
156 return c.Ptr
157}
158
159func (c *ButtonRow) SetGoPointer(ptr uintptr) {
160 c.Ptr = ptr
161}
162
163// SetPropertyEndIconName sets the "end-icon-name" property.
164// The icon name to show after the title.
165func (x *ButtonRow) SetPropertyEndIconName(value string) {
166 var v gobject.Value
167 v.Init(gobject.TypeStringVal)
168 v.SetString(&value)
169 x.SetProperty("end-icon-name", &v)
170}
171
172// GetPropertyEndIconName gets the "end-icon-name" property.
173// The icon name to show after the title.
174func (x *ButtonRow) GetPropertyEndIconName() string {
175 var v gobject.Value
176 x.GetProperty("end-icon-name", &v)
177 return v.GetString()
178}
179
180// SetPropertyStartIconName sets the "start-icon-name" property.
181// The icon name to show before the title.
182func (x *ButtonRow) SetPropertyStartIconName(value string) {
183 var v gobject.Value
184 v.Init(gobject.TypeStringVal)
185 v.SetString(&value)
186 x.SetProperty("start-icon-name", &v)
187}
188
189// GetPropertyStartIconName gets the "start-icon-name" property.
190// The icon name to show before the title.
191func (x *ButtonRow) GetPropertyStartIconName() string {
192 var v gobject.Value
193 x.GetProperty("start-icon-name", &v)
194 return v.GetString()
195}
196
197// This signal is emitted after the row has been activated.
198func (x *ButtonRow) ConnectActivated(cb *func(ButtonRow)) uint {
199 cbPtr := uintptr(unsafe.Pointer(cb))
200 if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
201 handlerID := gobject.SignalConnect(x.GoPointer(), "activated", cbRefPtr)
202 glib.SaveHandlerMapping(handlerID, cbPtr)
203 return handlerID
204 }
205
206 fcb := func(clsPtr uintptr) {
207 fa := ButtonRow{}
208 fa.Ptr = clsPtr
209 cbFn := *cb
210
211 cbFn(fa)
212
213 }
214 cbRefPtr := purego.NewCallback(fcb)
215 glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
216 handlerID := gobject.SignalConnect(x.GoPointer(), "activated", cbRefPtr)
217 glib.SaveHandlerMapping(handlerID, cbPtr)
218 return handlerID
219}
220
221// Requests the user's screen reader to announce the given message.
222//
223// This kind of notification is useful for messages that
224// either have only a visual representation or that are not
225// exposed visually at all, e.g. a notification about a
226// successful operation.
227//
228// Also, by using this API, you can ensure that the message
229// does not interrupts the user's current screen reader output.
230func (x *ButtonRow) Announce(MessageVar string, PriorityVar gtk.AccessibleAnnouncementPriority) {
231
232 gtk.XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
233
234}
235
236// Retrieves the accessible parent for an accessible object.
237//
238// This function returns `NULL` for top level widgets.
239func (x *ButtonRow) GetAccessibleParent() *gtk.AccessibleBase {
240 var cls *gtk.AccessibleBase
241
242 cret := gtk.XGtkAccessibleGetAccessibleParent(x.GoPointer())
243
244 if cret == 0 {
245 return nil
246 }
247 cls = >k.AccessibleBase{}
248 cls.Ptr = cret
249 return cls
250}
251
252// Retrieves the accessible role of an accessible object.
253func (x *ButtonRow) GetAccessibleRole() gtk.AccessibleRole {
254
255 cret := gtk.XGtkAccessibleGetAccessibleRole(x.GoPointer())
256 return cret
257}
258
259// Retrieves the implementation for the given accessible object.
260func (x *ButtonRow) GetAtContext() *gtk.ATContext {
261 var cls *gtk.ATContext
262
263 cret := gtk.XGtkAccessibleGetAtContext(x.GoPointer())
264
265 if cret == 0 {
266 return nil
267 }
268 cls = >k.ATContext{}
269 cls.Ptr = cret
270 return cls
271}
272
273// Queries the coordinates and dimensions of this accessible
274//
275// This functionality can be overridden by `GtkAccessible`
276// implementations, e.g. to get the bounds from an ignored
277// child widget.
278func (x *ButtonRow) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
279
280 cret := gtk.XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
281 return cret
282}
283
284// Retrieves the first accessible child of an accessible object.
285func (x *ButtonRow) GetFirstAccessibleChild() *gtk.AccessibleBase {
286 var cls *gtk.AccessibleBase
287
288 cret := gtk.XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
289
290 if cret == 0 {
291 return nil
292 }
293 cls = >k.AccessibleBase{}
294 cls.Ptr = cret
295 return cls
296}
297
298// Retrieves the next accessible sibling of an accessible object
299func (x *ButtonRow) GetNextAccessibleSibling() *gtk.AccessibleBase {
300 var cls *gtk.AccessibleBase
301
302 cret := gtk.XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
303
304 if cret == 0 {
305 return nil
306 }
307 cls = >k.AccessibleBase{}
308 cls.Ptr = cret
309 return cls
310}
311
312// Queries a platform state, such as focus.
313//
314// This functionality can be overridden by `GtkAccessible`
315// implementations, e.g. to get platform state from an ignored
316// child widget, as is the case for `GtkText` wrappers.
317func (x *ButtonRow) GetPlatformState(StateVar gtk.AccessiblePlatformState) bool {
318
319 cret := gtk.XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
320 return cret
321}
322
323// Resets the accessible property to its default value.
324func (x *ButtonRow) ResetProperty(PropertyVar gtk.AccessibleProperty) {
325
326 gtk.XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
327
328}
329
330// Resets the accessible relation to its default value.
331func (x *ButtonRow) ResetRelation(RelationVar gtk.AccessibleRelation) {
332
333 gtk.XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
334
335}
336
337// Resets the accessible state to its default value.
338func (x *ButtonRow) ResetState(StateVar gtk.AccessibleState) {
339
340 gtk.XGtkAccessibleResetState(x.GoPointer(), StateVar)
341
342}
343
344// Sets the parent and sibling of an accessible object.
345//
346// This function is meant to be used by accessible implementations that are
347// not part of the widget hierarchy, and but act as a logical bridge between
348// widgets. For instance, if a widget creates an object that holds metadata
349// for each child, and you want that object to implement the `GtkAccessible`
350// interface, you will use this function to ensure that the parent of each
351// child widget is the metadata object, and the parent of each metadata
352// object is the container widget.
353func (x *ButtonRow) SetAccessibleParent(ParentVar gtk.Accessible, NextSiblingVar gtk.Accessible) {
354
355 gtk.XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
356
357}
358
359// Updates the next accessible sibling.
360//
361// That might be useful when a new child of a custom accessible
362// is created, and it needs to be linked to a previous child.
363func (x *ButtonRow) UpdateNextAccessibleSibling(NewSiblingVar gtk.Accessible) {
364
365 gtk.XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
366
367}
368
369// Informs ATs that the platform state has changed.
370//
371// This function should be used by `GtkAccessible` implementations that
372// have a platform state but are not widgets. Widgets handle platform
373// states automatically.
374func (x *ButtonRow) UpdatePlatformState(StateVar gtk.AccessiblePlatformState) {
375
376 gtk.XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
377
378}
379
380// Updates a list of accessible properties.
381//
382// See the [enum@Gtk.AccessibleProperty] documentation for the
383// value types of accessible properties.
384//
385// This function should be called by `GtkWidget` types whenever
386// an accessible property change must be communicated to assistive
387// technologies.
388//
389// Example:
390// ```c
391// value = gtk_adjustment_get_value (adjustment);
392// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
393//
394// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
395// -1);
396//
397// ```
398func (x *ButtonRow) UpdateProperty(FirstPropertyVar gtk.AccessibleProperty, varArgs ...interface{}) {
399
400 gtk.XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
401
402}
403
404// Updates an array of accessible properties.
405//
406// This function should be called by `GtkWidget` types whenever an accessible
407// property change must be communicated to assistive technologies.
408//
409// This function is meant to be used by language bindings.
410func (x *ButtonRow) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []gtk.AccessibleProperty, ValuesVar []gobject.Value) {
411
412 gtk.XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
413
414}
415
416// Updates a list of accessible relations.
417//
418// This function should be called by `GtkWidget` types whenever an accessible
419// relation change must be communicated to assistive technologies.
420//
421// If the [enum@Gtk.AccessibleRelation] requires a list of references,
422// you should pass each reference individually, followed by `NULL`, e.g.
423//
424// ```c
425// gtk_accessible_update_relation (accessible,
426//
427// GTK_ACCESSIBLE_RELATION_CONTROLS,
428// ref1, NULL,
429// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
430// ref1, ref2, ref3, NULL,
431// -1);
432//
433// ```
434func (x *ButtonRow) UpdateRelation(FirstRelationVar gtk.AccessibleRelation, varArgs ...interface{}) {
435
436 gtk.XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
437
438}
439
440// Updates an array of accessible relations.
441//
442// This function should be called by `GtkWidget` types whenever an accessible
443// relation change must be communicated to assistive technologies.
444//
445// This function is meant to be used by language bindings.
446func (x *ButtonRow) UpdateRelationValue(NRelationsVar int, RelationsVar []gtk.AccessibleRelation, ValuesVar []gobject.Value) {
447
448 gtk.XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
449
450}
451
452// Updates a list of accessible states.
453//
454// See the [enum@Gtk.AccessibleState] documentation for the
455// value types of accessible states.
456//
457// This function should be called by `GtkWidget` types whenever
458// an accessible state change must be communicated to assistive
459// technologies.
460//
461// Example:
462//
463// ```c
464// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
465// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
466//
467// GTK_ACCESSIBLE_STATE_CHECKED, value,
468// -1);
469//
470// ```
471func (x *ButtonRow) UpdateState(FirstStateVar gtk.AccessibleState, varArgs ...interface{}) {
472
473 gtk.XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
474
475}
476
477// Updates an array of accessible states.
478//
479// This function should be called by `GtkWidget` types whenever an accessible
480// state change must be communicated to assistive technologies.
481//
482// This function is meant to be used by language bindings.
483func (x *ButtonRow) UpdateStateValue(NStatesVar int, StatesVar []gtk.AccessibleState, ValuesVar []gobject.Value) {
484
485 gtk.XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
486
487}
488
489// Gets the action name for @actionable.
490func (x *ButtonRow) GetActionName() string {
491
492 cret := gtk.XGtkActionableGetActionName(x.GoPointer())
493 return cret
494}
495
496// Gets the current target value of @actionable.
497func (x *ButtonRow) GetActionTargetValue() *glib.Variant {
498
499 cret := gtk.XGtkActionableGetActionTargetValue(x.GoPointer())
500 return cret
501}
502
503// Specifies the name of the action with which this widget should be
504// associated.
505//
506// If @action_name is %NULL then the widget will be unassociated from
507// any previous action.
508//
509// Usually this function is used when the widget is located (or will be
510// located) within the hierarchy of a `GtkApplicationWindow`.
511//
512// Names are of the form “win.save” or “app.quit” for actions on the
513// containing [class@ApplicationWindow] or its associated [class@Application],
514// respectively. This is the same form used for actions in the [class@Gio.Menu]
515// associated with the window.
516func (x *ButtonRow) SetActionName(ActionNameVar *string) {
517
518 ActionNameVarPtr := core.GStrdupNullable(ActionNameVar)
519 defer core.GFreeNullable(ActionNameVarPtr)
520
521 gtk.XGtkActionableSetActionName(x.GoPointer(), ActionNameVarPtr)
522
523}
524
525// Sets the target of an actionable widget.
526//
527// This is a convenience function that calls [ctor@GLib.Variant.new] for
528// @format_string and uses the result to call
529// [method@Gtk.Actionable.set_action_target_value].
530//
531// If you are setting a string-valued target and want to set
532// the action name at the same time, you can use
533// [method@Gtk.Actionable.set_detailed_action_name].
534func (x *ButtonRow) SetActionTarget(FormatStringVar string, varArgs ...interface{}) {
535
536 gtk.XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...)
537
538}
539
540// Sets the target value of an actionable widget.
541//
542// If @target_value is %NULL then the target value is unset.
543//
544// The target value has two purposes. First, it is used as the parameter
545// to activation of the action associated with the `GtkActionable` widget.
546// Second, it is used to determine if the widget should be rendered as
547// “active” — the widget is active if the state is equal to the given target.
548//
549// Consider the example of associating a set of buttons with a [iface@Gio.Action]
550// with string state in a typical “radio button” situation. Each button
551// will be associated with the same action, but with a different target
552// value for that action. Clicking on a particular button will activate
553// the action with the target of that button, which will typically cause
554// the action’s state to change to that value. Since the action’s state
555// is now equal to the target value of the button, the button will now
556// be rendered as active (and the other buttons, with different targets,
557// rendered inactive).
558func (x *ButtonRow) SetActionTargetValue(TargetValueVar *glib.Variant) {
559
560 gtk.XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar)
561
562}
563
564// Sets the action-name and associated string target value of an
565// actionable widget.
566//
567// @detailed_action_name is a string in the format accepted by
568// [func@Gio.Action.parse_detailed_name].
569func (x *ButtonRow) SetDetailedActionName(DetailedActionNameVar string) {
570
571 gtk.XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar)
572
573}
574
575// Gets the ID of the @buildable object.
576//
577// `GtkBuilder` sets the name based on the ID attribute
578// of the `<object>` tag used to construct the @buildable.
579func (x *ButtonRow) GetBuildableId() string {
580
581 cret := gtk.XGtkBuildableGetBuildableId(x.GoPointer())
582 return cret
583}
584
585func init() {
586 core.SetPackageName("ADW", "libadwaita-1")
587 core.SetSharedLibraries("ADW", []string{"libadwaita-1.so.0"})
588 var libs []uintptr
589 for _, libPath := range core.GetPaths("ADW") {
590 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
591 if err != nil {
592 panic(err)
593 }
594 libs = append(libs, lib)
595 }
596
597 core.PuregoSafeRegister(&xButtonRowGLibType, libs, "adw_button_row_get_type")
598
599 core.PuregoSafeRegister(&xNewButtonRow, libs, "adw_button_row_new")
600
601 core.PuregoSafeRegister(&xButtonRowGetEndIconName, libs, "adw_button_row_get_end_icon_name")
602 core.PuregoSafeRegister(&xButtonRowGetStartIconName, libs, "adw_button_row_get_start_icon_name")
603 core.PuregoSafeRegister(&xButtonRowSetEndIconName, libs, "adw_button_row_set_end_icon_name")
604 core.PuregoSafeRegister(&xButtonRowSetStartIconName, libs, "adw_button_row_set_start_icon_name")
605
606}