v0.2.1 c0399be

gtkbutton.go RawHistoryFolder

1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
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)
15
16type ButtonClass struct {
17	_ structs.HostLayout
18
19	ParentClass WidgetClass
20
21	xClicked uintptr
22
23	xActivate uintptr
24
25	Padding [8]uintptr
26}
27
28func (x *ButtonClass) GoPointer() uintptr {
29	return uintptr(unsafe.Pointer(x))
30}
31
32// OverrideClicked sets the "clicked" callback function.
33// Signal emitted when the button has been activated (pressed and released).
34func (x *ButtonClass) OverrideClicked(cb func(*Button)) {
35	if cb == nil {
36		x.xClicked = 0
37	} else {
38		x.xClicked = purego.NewCallback(func(ButtonVarp uintptr) {
39			cb(ButtonNewFromInternalPtr(ButtonVarp))
40		})
41	}
42}
43
44// GetClicked gets the "clicked" callback function.
45// Signal emitted when the button has been activated (pressed and released).
46func (x *ButtonClass) GetClicked() func(*Button) {
47	if x.xClicked == 0 {
48		return nil
49	}
50	var rawCallback func(ButtonVarp uintptr)
51	purego.RegisterFunc(&rawCallback, x.xClicked)
52	return func(ButtonVar *Button) {
53		rawCallback(ButtonVar.GoPointer())
54	}
55}
56
57// OverrideActivate sets the "activate" callback function.
58// Signal that causes the button to animate press then
59//
60//	release. Applications should never connect to this signal, but use
61//	the @clicked signal.
62func (x *ButtonClass) OverrideActivate(cb func(*Button)) {
63	if cb == nil {
64		x.xActivate = 0
65	} else {
66		x.xActivate = purego.NewCallback(func(ButtonVarp uintptr) {
67			cb(ButtonNewFromInternalPtr(ButtonVarp))
68		})
69	}
70}
71
72// GetActivate gets the "activate" callback function.
73// Signal that causes the button to animate press then
74//
75//	release. Applications should never connect to this signal, but use
76//	the @clicked signal.
77func (x *ButtonClass) GetActivate() func(*Button) {
78	if x.xActivate == 0 {
79		return nil
80	}
81	var rawCallback func(ButtonVarp uintptr)
82	purego.RegisterFunc(&rawCallback, x.xActivate)
83	return func(ButtonVar *Button) {
84		rawCallback(ButtonVar.GoPointer())
85	}
86}
87
88type ButtonPrivate struct {
89	_ structs.HostLayout
90}
91
92func (x *ButtonPrivate) GoPointer() uintptr {
93	return uintptr(unsafe.Pointer(x))
94}
95
96// Calls a callback function when the button is clicked.
97//
98// <picture>
99//
100//	<source srcset="button-dark.png" media="(prefers-color-scheme: dark)">
101//	<img alt="An example GtkButton" src="button.png">
102//
103// </picture>
104//
105// The `GtkButton` widget can hold any valid child widget. That is, it can hold
106// almost any other standard `GtkWidget`. The most commonly used child is the
107// `GtkLabel`.
108//
109// # Shortcuts and Gestures
110//
111// The following signals have default keybindings:
112//
113// - [signal@Gtk.Button::activate]
114//
115// # CSS nodes
116//
117// `GtkButton` has a single CSS node with name button. The node will get the
118// style classes .image-button or .text-button, if the content is just an
119// image or label, respectively. It may also receive the .flat style class.
120// When activating a button via the keyboard, the button will temporarily
121// gain the .keyboard-activating style class.
122//
123// Other style classes that are commonly used with `GtkButton` include
124// .suggested-action and .destructive-action. In special cases, buttons
125// can be made round by adding the .circular style class.
126//
127// Button-like widgets like [class@Gtk.ToggleButton], [class@Gtk.MenuButton],
128// [class@Gtk.VolumeButton], [class@Gtk.LockButton], [class@Gtk.ColorButton]
129// or [class@Gtk.FontButton] use style classes such as .toggle, .popup, .scale,
130// .lock, .color on the button node to differentiate themselves from a plain
131// `GtkButton`.
132//
133// # Accessibility
134//
135// `GtkButton` uses the [enum@Gtk.AccessibleRole.button] role.
136type Button struct {
137	Widget
138}
139
140var xButtonGLibType func() types.GType
141
142func ButtonGLibType() types.GType {
143	return xButtonGLibType()
144}
145
146func ButtonNewFromInternalPtr(ptr uintptr) *Button {
147	cls := &Button{}
148	cls.Ptr = ptr
149	return cls
150}
151
152var xNewButton func() uintptr
153
154// Creates a new `GtkButton` widget.
155//
156// To add a child widget to the button, use [method@Gtk.Button.set_child].
157func NewButton() *Button {
158	var cls *Button
159
160	cret := xNewButton()
161
162	if cret == 0 {
163		return nil
164	}
165	gobject.IncreaseRef(cret)
166	cls = &Button{}
167	cls.Ptr = cret
168	return cls
169}
170
171var xNewButtonFromIconName func(string) uintptr
172
173// Creates a new button containing an icon from the current icon theme.
174//
175// If the icon name isn’t known, a “broken image” icon will be
176// displayed instead. If the current icon theme is changed, the icon
177// will be updated appropriately.
178func NewButtonFromIconName(IconNameVar string) *Button {
179	var cls *Button
180
181	cret := xNewButtonFromIconName(IconNameVar)
182
183	if cret == 0 {
184		return nil
185	}
186	gobject.IncreaseRef(cret)
187	cls = &Button{}
188	cls.Ptr = cret
189	return cls
190}
191
192var xNewButtonWithLabel func(string) uintptr
193
194// Creates a `GtkButton` widget with a `GtkLabel` child.
195func NewButtonWithLabel(LabelVar string) *Button {
196	var cls *Button
197
198	cret := xNewButtonWithLabel(LabelVar)
199
200	if cret == 0 {
201		return nil
202	}
203	gobject.IncreaseRef(cret)
204	cls = &Button{}
205	cls.Ptr = cret
206	return cls
207}
208
209var xNewButtonWithMnemonic func(string) uintptr
210
211// Creates a new `GtkButton` containing a label.
212//
213// If characters in @label are preceded by an underscore, they are underlined.
214// If you need a literal underscore character in a label, use “__” (two
215// underscores). The first underlined character represents a keyboard
216// accelerator called a mnemonic. Pressing <kbd>Alt</kbd> and that key
217// activates the button.
218func NewButtonWithMnemonic(LabelVar string) *Button {
219	var cls *Button
220
221	cret := xNewButtonWithMnemonic(LabelVar)
222
223	if cret == 0 {
224		return nil
225	}
226	gobject.IncreaseRef(cret)
227	cls = &Button{}
228	cls.Ptr = cret
229	return cls
230}
231
232var xButtonGetCanShrink func(uintptr) bool
233
234// Retrieves whether the button can be smaller than the natural
235// size of its contents.
236func (x *Button) GetCanShrink() bool {
237
238	cret := xButtonGetCanShrink(x.GoPointer())
239	return cret
240}
241
242var xButtonGetChild func(uintptr) uintptr
243
244// Gets the child widget of @button.
245func (x *Button) GetChild() *Widget {
246	var cls *Widget
247
248	cret := xButtonGetChild(x.GoPointer())
249
250	if cret == 0 {
251		return nil
252	}
253	gobject.IncreaseRef(cret)
254	cls = &Widget{}
255	cls.Ptr = cret
256	return cls
257}
258
259var xButtonGetHasFrame func(uintptr) bool
260
261// Returns whether the button has a frame.
262func (x *Button) GetHasFrame() bool {
263
264	cret := xButtonGetHasFrame(x.GoPointer())
265	return cret
266}
267
268var xButtonGetIconName func(uintptr) string
269
270// Returns the icon name of the button.
271//
272// If the icon name has not been set with [method@Gtk.Button.set_icon_name]
273// the return value will be %NULL. This will be the case if you create
274// an empty button with [ctor@Gtk.Button.new] to use as a container.
275func (x *Button) GetIconName() string {
276
277	cret := xButtonGetIconName(x.GoPointer())
278	return cret
279}
280
281var xButtonGetLabel func(uintptr) string
282
283// Fetches the text from the label of the button.
284//
285// If the label text has not been set with [method@Gtk.Button.set_label]
286// the return value will be %NULL. This will be the case if you create
287// an empty button with [ctor@Gtk.Button.new] to use as a container.
288func (x *Button) GetLabel() string {
289
290	cret := xButtonGetLabel(x.GoPointer())
291	return cret
292}
293
294var xButtonGetUseUnderline func(uintptr) bool
295
296// gets whether underlines are interpreted as mnemonics.
297//
298// See [method@Gtk.Button.set_use_underline].
299func (x *Button) GetUseUnderline() bool {
300
301	cret := xButtonGetUseUnderline(x.GoPointer())
302	return cret
303}
304
305var xButtonSetCanShrink func(uintptr, bool)
306
307// Sets whether the button size can be smaller than the natural size of
308// its contents.
309//
310// For text buttons, setting @can_shrink to true will ellipsize the label.
311//
312// For icons and custom children, this function has no effect.
313func (x *Button) SetCanShrink(CanShrinkVar bool) {
314
315	xButtonSetCanShrink(x.GoPointer(), CanShrinkVar)
316
317}
318
319var xButtonSetChild func(uintptr, uintptr)
320
321// Sets the child widget of @button.
322//
323// Note that by using this API, you take full responsibility for setting
324// up the proper accessibility label and description information for @button.
325// Most likely, you'll either set the accessibility label or description
326// for @button explicitly, or you'll set a labelled-by or described-by
327// relations from @child to @button.
328func (x *Button) SetChild(ChildVar *Widget) {
329
330	xButtonSetChild(x.GoPointer(), ChildVar.GoPointer())
331
332}
333
334var xButtonSetHasFrame func(uintptr, bool)
335
336// Sets the style of the button.
337//
338// Buttons can have a flat appearance or have a frame drawn around them.
339func (x *Button) SetHasFrame(HasFrameVar bool) {
340
341	xButtonSetHasFrame(x.GoPointer(), HasFrameVar)
342
343}
344
345var xButtonSetIconName func(uintptr, string)
346
347// Adds a `GtkImage` with the given icon name as a child.
348//
349// If @button already contains a child widget, that child widget will
350// be removed and replaced with the image.
351func (x *Button) SetIconName(IconNameVar string) {
352
353	xButtonSetIconName(x.GoPointer(), IconNameVar)
354
355}
356
357var xButtonSetLabel func(uintptr, string)
358
359// Sets the text of the label of the button to @label.
360//
361// This will also clear any previously set labels.
362func (x *Button) SetLabel(LabelVar string) {
363
364	xButtonSetLabel(x.GoPointer(), LabelVar)
365
366}
367
368var xButtonSetUseUnderline func(uintptr, bool)
369
370// Sets whether to use underlines as mnemonics.
371//
372// If true, an underline in the text of the button label indicates
373// the next character should be used for the mnemonic accelerator key.
374func (x *Button) SetUseUnderline(UseUnderlineVar bool) {
375
376	xButtonSetUseUnderline(x.GoPointer(), UseUnderlineVar)
377
378}
379
380func (c *Button) GoPointer() uintptr {
381	if c == nil {
382		return 0
383	}
384	return c.Ptr
385}
386
387func (c *Button) SetGoPointer(ptr uintptr) {
388	c.Ptr = ptr
389}
390
391// SetPropertyCanShrink sets the "can-shrink" property.
392// Whether the size of the button can be made smaller than the natural
393// size of its contents.
394//
395// For text buttons, setting this property will allow ellipsizing the label.
396//
397// If the contents of a button are an icon or a custom widget, setting this
398// property has no effect.
399func (x *Button) SetPropertyCanShrink(value bool) {
400	var v gobject.Value
401	v.Init(gobject.TypeBooleanVal)
402	v.SetBoolean(value)
403	x.SetProperty("can-shrink", &v)
404}
405
406// GetPropertyCanShrink gets the "can-shrink" property.
407// Whether the size of the button can be made smaller than the natural
408// size of its contents.
409//
410// For text buttons, setting this property will allow ellipsizing the label.
411//
412// If the contents of a button are an icon or a custom widget, setting this
413// property has no effect.
414func (x *Button) GetPropertyCanShrink() bool {
415	var v gobject.Value
416	x.GetProperty("can-shrink", &v)
417	return v.GetBoolean()
418}
419
420// SetPropertyHasFrame sets the "has-frame" property.
421// Whether the button has a frame.
422func (x *Button) SetPropertyHasFrame(value bool) {
423	var v gobject.Value
424	v.Init(gobject.TypeBooleanVal)
425	v.SetBoolean(value)
426	x.SetProperty("has-frame", &v)
427}
428
429// GetPropertyHasFrame gets the "has-frame" property.
430// Whether the button has a frame.
431func (x *Button) GetPropertyHasFrame() bool {
432	var v gobject.Value
433	x.GetProperty("has-frame", &v)
434	return v.GetBoolean()
435}
436
437// SetPropertyIconName sets the "icon-name" property.
438// The name of the icon used to automatically populate the button.
439func (x *Button) SetPropertyIconName(value string) {
440	var v gobject.Value
441	v.Init(gobject.TypeStringVal)
442	v.SetString(&value)
443	x.SetProperty("icon-name", &v)
444}
445
446// GetPropertyIconName gets the "icon-name" property.
447// The name of the icon used to automatically populate the button.
448func (x *Button) GetPropertyIconName() string {
449	var v gobject.Value
450	x.GetProperty("icon-name", &v)
451	return v.GetString()
452}
453
454// SetPropertyLabel sets the "label" property.
455// Text of the label inside the button, if the button contains a label widget.
456func (x *Button) SetPropertyLabel(value string) {
457	var v gobject.Value
458	v.Init(gobject.TypeStringVal)
459	v.SetString(&value)
460	x.SetProperty("label", &v)
461}
462
463// GetPropertyLabel gets the "label" property.
464// Text of the label inside the button, if the button contains a label widget.
465func (x *Button) GetPropertyLabel() string {
466	var v gobject.Value
467	x.GetProperty("label", &v)
468	return v.GetString()
469}
470
471// SetPropertyUseUnderline sets the "use-underline" property.
472// If set, an underline in the text indicates that the following character is
473// to be used as mnemonic.
474func (x *Button) SetPropertyUseUnderline(value bool) {
475	var v gobject.Value
476	v.Init(gobject.TypeBooleanVal)
477	v.SetBoolean(value)
478	x.SetProperty("use-underline", &v)
479}
480
481// GetPropertyUseUnderline gets the "use-underline" property.
482// If set, an underline in the text indicates that the following character is
483// to be used as mnemonic.
484func (x *Button) GetPropertyUseUnderline() bool {
485	var v gobject.Value
486	x.GetProperty("use-underline", &v)
487	return v.GetBoolean()
488}
489
490// Emitted to animate press then release.
491//
492// This is an action signal. Applications should never connect
493// to this signal, but use the [signal@Gtk.Button::clicked] signal.
494//
495// The default bindings for this signal are all forms of the
496// <kbd>␣</kbd> and <kbd>Enter</kbd> keys.
497func (x *Button) ConnectActivate(cb *func(Button)) uint {
498	cbPtr := uintptr(unsafe.Pointer(cb))
499	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
500		handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
501		glib.SaveHandlerMapping(handlerID, cbPtr)
502		return handlerID
503	}
504
505	fcb := func(clsPtr uintptr) {
506		fa := Button{}
507		fa.Ptr = clsPtr
508		cbFn := *cb
509
510		cbFn(fa)
511
512	}
513	cbRefPtr := purego.NewCallback(fcb)
514	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
515	handlerID := gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr)
516	glib.SaveHandlerMapping(handlerID, cbPtr)
517	return handlerID
518}
519
520// Emitted when the button has been activated (pressed and released).
521func (x *Button) ConnectClicked(cb *func(Button)) uint {
522	cbPtr := uintptr(unsafe.Pointer(cb))
523	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
524		handlerID := gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr)
525		glib.SaveHandlerMapping(handlerID, cbPtr)
526		return handlerID
527	}
528
529	fcb := func(clsPtr uintptr) {
530		fa := Button{}
531		fa.Ptr = clsPtr
532		cbFn := *cb
533
534		cbFn(fa)
535
536	}
537	cbRefPtr := purego.NewCallback(fcb)
538	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
539	handlerID := gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr)
540	glib.SaveHandlerMapping(handlerID, cbPtr)
541	return handlerID
542}
543
544// Requests the user's screen reader to announce the given message.
545//
546// This kind of notification is useful for messages that
547// either have only a visual representation or that are not
548// exposed visually at all, e.g. a notification about a
549// successful operation.
550//
551// Also, by using this API, you can ensure that the message
552// does not interrupts the user's current screen reader output.
553func (x *Button) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
554
555	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
556
557}
558
559// Retrieves the accessible parent for an accessible object.
560//
561// This function returns `NULL` for top level widgets.
562func (x *Button) GetAccessibleParent() *AccessibleBase {
563	var cls *AccessibleBase
564
565	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
566
567	if cret == 0 {
568		return nil
569	}
570	cls = &AccessibleBase{}
571	cls.Ptr = cret
572	return cls
573}
574
575// Retrieves the accessible role of an accessible object.
576func (x *Button) GetAccessibleRole() AccessibleRole {
577
578	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
579	return cret
580}
581
582// Retrieves the implementation for the given accessible object.
583func (x *Button) GetAtContext() *ATContext {
584	var cls *ATContext
585
586	cret := XGtkAccessibleGetAtContext(x.GoPointer())
587
588	if cret == 0 {
589		return nil
590	}
591	cls = &ATContext{}
592	cls.Ptr = cret
593	return cls
594}
595
596// Queries the coordinates and dimensions of this accessible
597//
598// This functionality can be overridden by `GtkAccessible`
599// implementations, e.g. to get the bounds from an ignored
600// child widget.
601func (x *Button) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
602
603	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
604	return cret
605}
606
607// Retrieves the first accessible child of an accessible object.
608func (x *Button) GetFirstAccessibleChild() *AccessibleBase {
609	var cls *AccessibleBase
610
611	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
612
613	if cret == 0 {
614		return nil
615	}
616	cls = &AccessibleBase{}
617	cls.Ptr = cret
618	return cls
619}
620
621// Retrieves the next accessible sibling of an accessible object
622func (x *Button) GetNextAccessibleSibling() *AccessibleBase {
623	var cls *AccessibleBase
624
625	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
626
627	if cret == 0 {
628		return nil
629	}
630	cls = &AccessibleBase{}
631	cls.Ptr = cret
632	return cls
633}
634
635// Queries a platform state, such as focus.
636//
637// This functionality can be overridden by `GtkAccessible`
638// implementations, e.g. to get platform state from an ignored
639// child widget, as is the case for `GtkText` wrappers.
640func (x *Button) GetPlatformState(StateVar AccessiblePlatformState) bool {
641
642	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
643	return cret
644}
645
646// Resets the accessible property to its default value.
647func (x *Button) ResetProperty(PropertyVar AccessibleProperty) {
648
649	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
650
651}
652
653// Resets the accessible relation to its default value.
654func (x *Button) ResetRelation(RelationVar AccessibleRelation) {
655
656	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
657
658}
659
660// Resets the accessible state to its default value.
661func (x *Button) ResetState(StateVar AccessibleState) {
662
663	XGtkAccessibleResetState(x.GoPointer(), StateVar)
664
665}
666
667// Sets the parent and sibling of an accessible object.
668//
669// This function is meant to be used by accessible implementations that are
670// not part of the widget hierarchy, and but act as a logical bridge between
671// widgets. For instance, if a widget creates an object that holds metadata
672// for each child, and you want that object to implement the `GtkAccessible`
673// interface, you will use this function to ensure that the parent of each
674// child widget is the metadata object, and the parent of each metadata
675// object is the container widget.
676func (x *Button) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
677
678	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
679
680}
681
682// Updates the next accessible sibling.
683//
684// That might be useful when a new child of a custom accessible
685// is created, and it needs to be linked to a previous child.
686func (x *Button) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
687
688	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
689
690}
691
692// Informs ATs that the platform state has changed.
693//
694// This function should be used by `GtkAccessible` implementations that
695// have a platform state but are not widgets. Widgets handle platform
696// states automatically.
697func (x *Button) UpdatePlatformState(StateVar AccessiblePlatformState) {
698
699	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
700
701}
702
703// Updates a list of accessible properties.
704//
705// See the [enum@Gtk.AccessibleProperty] documentation for the
706// value types of accessible properties.
707//
708// This function should be called by `GtkWidget` types whenever
709// an accessible property change must be communicated to assistive
710// technologies.
711//
712// Example:
713// ```c
714// value = gtk_adjustment_get_value (adjustment);
715// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
716//
717//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
718//	-1);
719//
720// ```
721func (x *Button) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
722
723	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
724
725}
726
727// Updates an array of accessible properties.
728//
729// This function should be called by `GtkWidget` types whenever an accessible
730// property change must be communicated to assistive technologies.
731//
732// This function is meant to be used by language bindings.
733func (x *Button) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
734
735	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
736
737}
738
739// Updates a list of accessible relations.
740//
741// This function should be called by `GtkWidget` types whenever an accessible
742// relation change must be communicated to assistive technologies.
743//
744// If the [enum@Gtk.AccessibleRelation] requires a list of references,
745// you should pass each reference individually, followed by `NULL`, e.g.
746//
747// ```c
748// gtk_accessible_update_relation (accessible,
749//
750//	GTK_ACCESSIBLE_RELATION_CONTROLS,
751//	  ref1, NULL,
752//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
753//	  ref1, ref2, ref3, NULL,
754//	-1);
755//
756// ```
757func (x *Button) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
758
759	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
760
761}
762
763// Updates an array of accessible relations.
764//
765// This function should be called by `GtkWidget` types whenever an accessible
766// relation change must be communicated to assistive technologies.
767//
768// This function is meant to be used by language bindings.
769func (x *Button) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
770
771	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
772
773}
774
775// Updates a list of accessible states.
776//
777// See the [enum@Gtk.AccessibleState] documentation for the
778// value types of accessible states.
779//
780// This function should be called by `GtkWidget` types whenever
781// an accessible state change must be communicated to assistive
782// technologies.
783//
784// Example:
785//
786// ```c
787// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
788// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
789//
790//	GTK_ACCESSIBLE_STATE_CHECKED, value,
791//	-1);
792//
793// ```
794func (x *Button) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
795
796	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
797
798}
799
800// Updates an array of accessible states.
801//
802// This function should be called by `GtkWidget` types whenever an accessible
803// state change must be communicated to assistive technologies.
804//
805// This function is meant to be used by language bindings.
806func (x *Button) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
807
808	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
809
810}
811
812// Gets the action name for @actionable.
813func (x *Button) GetActionName() string {
814
815	cret := XGtkActionableGetActionName(x.GoPointer())
816	return cret
817}
818
819// Gets the current target value of @actionable.
820func (x *Button) GetActionTargetValue() *glib.Variant {
821
822	cret := XGtkActionableGetActionTargetValue(x.GoPointer())
823	return cret
824}
825
826// Specifies the name of the action with which this widget should be
827// associated.
828//
829// If @action_name is %NULL then the widget will be unassociated from
830// any previous action.
831//
832// Usually this function is used when the widget is located (or will be
833// located) within the hierarchy of a `GtkApplicationWindow`.
834//
835// Names are of the form “win.save” or “app.quit” for actions on the
836// containing [class@ApplicationWindow] or its associated [class@Application],
837// respectively. This is the same form used for actions in the [class@Gio.Menu]
838// associated with the window.
839func (x *Button) SetActionName(ActionNameVar *string) {
840
841	ActionNameVarPtr := core.GStrdupNullable(ActionNameVar)
842	defer core.GFreeNullable(ActionNameVarPtr)
843
844	XGtkActionableSetActionName(x.GoPointer(), ActionNameVarPtr)
845
846}
847
848// Sets the target of an actionable widget.
849//
850// This is a convenience function that calls [ctor@GLib.Variant.new] for
851// @format_string and uses the result to call
852// [method@Gtk.Actionable.set_action_target_value].
853//
854// If you are setting a string-valued target and want to set
855// the action name at the same time, you can use
856// [method@Gtk.Actionable.set_detailed_action_name].
857func (x *Button) SetActionTarget(FormatStringVar string, varArgs ...interface{}) {
858
859	XGtkActionableSetActionTarget(x.GoPointer(), FormatStringVar, varArgs...)
860
861}
862
863// Sets the target value of an actionable widget.
864//
865// If @target_value is %NULL then the target value is unset.
866//
867// The target value has two purposes. First, it is used as the parameter
868// to activation of the action associated with the `GtkActionable` widget.
869// Second, it is used to determine if the widget should be rendered as
870// “active” — the widget is active if the state is equal to the given target.
871//
872// Consider the example of associating a set of buttons with a [iface@Gio.Action]
873// with string state in a typical “radio button” situation. Each button
874// will be associated with the same action, but with a different target
875// value for that action. Clicking on a particular button will activate
876// the action with the target of that button, which will typically cause
877// the action’s state to change to that value. Since the action’s state
878// is now equal to the target value of the button, the button will now
879// be rendered as active (and the other buttons, with different targets,
880// rendered inactive).
881func (x *Button) SetActionTargetValue(TargetValueVar *glib.Variant) {
882
883	XGtkActionableSetActionTargetValue(x.GoPointer(), TargetValueVar)
884
885}
886
887// Sets the action-name and associated string target value of an
888// actionable widget.
889//
890// @detailed_action_name is a string in the format accepted by
891// [func@Gio.Action.parse_detailed_name].
892func (x *Button) SetDetailedActionName(DetailedActionNameVar string) {
893
894	XGtkActionableSetDetailedActionName(x.GoPointer(), DetailedActionNameVar)
895
896}
897
898// Gets the ID of the @buildable object.
899//
900// `GtkBuilder` sets the name based on the ID attribute
901// of the `<object>` tag used to construct the @buildable.
902func (x *Button) GetBuildableId() string {
903
904	cret := XGtkBuildableGetBuildableId(x.GoPointer())
905	return cret
906}
907
908func init() {
909	core.SetPackageName("GTK", "gtk4")
910	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
911	var libs []uintptr
912	for _, libPath := range core.GetPaths("GTK") {
913		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
914		if err != nil {
915			panic(err)
916		}
917		libs = append(libs, lib)
918	}
919
920	core.PuregoSafeRegister(&xButtonGLibType, libs, "gtk_button_get_type")
921
922	core.PuregoSafeRegister(&xNewButton, libs, "gtk_button_new")
923	core.PuregoSafeRegister(&xNewButtonFromIconName, libs, "gtk_button_new_from_icon_name")
924	core.PuregoSafeRegister(&xNewButtonWithLabel, libs, "gtk_button_new_with_label")
925	core.PuregoSafeRegister(&xNewButtonWithMnemonic, libs, "gtk_button_new_with_mnemonic")
926
927	core.PuregoSafeRegister(&xButtonGetCanShrink, libs, "gtk_button_get_can_shrink")
928	core.PuregoSafeRegister(&xButtonGetChild, libs, "gtk_button_get_child")
929	core.PuregoSafeRegister(&xButtonGetHasFrame, libs, "gtk_button_get_has_frame")
930	core.PuregoSafeRegister(&xButtonGetIconName, libs, "gtk_button_get_icon_name")
931	core.PuregoSafeRegister(&xButtonGetLabel, libs, "gtk_button_get_label")
932	core.PuregoSafeRegister(&xButtonGetUseUnderline, libs, "gtk_button_get_use_underline")
933	core.PuregoSafeRegister(&xButtonSetCanShrink, libs, "gtk_button_set_can_shrink")
934	core.PuregoSafeRegister(&xButtonSetChild, libs, "gtk_button_set_child")
935	core.PuregoSafeRegister(&xButtonSetHasFrame, libs, "gtk_button_set_has_frame")
936	core.PuregoSafeRegister(&xButtonSetIconName, libs, "gtk_button_set_icon_name")
937	core.PuregoSafeRegister(&xButtonSetLabel, libs, "gtk_button_set_label")
938	core.PuregoSafeRegister(&xButtonSetUseUnderline, libs, "gtk_button_set_use_underline")
939
940}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close