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