v0.2.1 c0399be

gtkdialog.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/gdk"
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/gsk"
16)
17
18type DialogClass struct {
19	_ structs.HostLayout
20
21	ParentClass WindowClass
22
23	xResponse uintptr
24
25	xClose uintptr
26
27	Padding [8]uintptr
28}
29
30func (x *DialogClass) GoPointer() uintptr {
31	return uintptr(unsafe.Pointer(x))
32}
33
34// OverrideResponse sets the "response" callback function.
35// Signal emitted when an action widget is activated.
36func (x *DialogClass) OverrideResponse(cb func(*Dialog, int)) {
37	if cb == nil {
38		x.xResponse = 0
39	} else {
40		x.xResponse = purego.NewCallback(func(DialogVarp uintptr, ResponseIdVarp int) {
41			cb(DialogNewFromInternalPtr(DialogVarp), ResponseIdVarp)
42		})
43	}
44}
45
46// GetResponse gets the "response" callback function.
47// Signal emitted when an action widget is activated.
48func (x *DialogClass) GetResponse() func(*Dialog, int) {
49	if x.xResponse == 0 {
50		return nil
51	}
52	var rawCallback func(DialogVarp uintptr, ResponseIdVarp int)
53	purego.RegisterFunc(&rawCallback, x.xResponse)
54	return func(DialogVar *Dialog, ResponseIdVar int) {
55		rawCallback(DialogVar.GoPointer(), ResponseIdVar)
56	}
57}
58
59// OverrideClose sets the "close" callback function.
60// Signal emitted when the user uses a keybinding to close the dialog.
61func (x *DialogClass) OverrideClose(cb func(*Dialog)) {
62	if cb == nil {
63		x.xClose = 0
64	} else {
65		x.xClose = purego.NewCallback(func(DialogVarp uintptr) {
66			cb(DialogNewFromInternalPtr(DialogVarp))
67		})
68	}
69}
70
71// GetClose gets the "close" callback function.
72// Signal emitted when the user uses a keybinding to close the dialog.
73func (x *DialogClass) GetClose() func(*Dialog) {
74	if x.xClose == 0 {
75		return nil
76	}
77	var rawCallback func(DialogVarp uintptr)
78	purego.RegisterFunc(&rawCallback, x.xClose)
79	return func(DialogVar *Dialog) {
80		rawCallback(DialogVar.GoPointer())
81	}
82}
83
84// Flags used to influence dialog construction.
85type DialogFlags int
86
87var xDialogFlagsGLibType func() types.GType
88
89func DialogFlagsGLibType() types.GType {
90	return xDialogFlagsGLibType()
91}
92
93const (
94
95	// Make the constructed dialog modal
96	DialogModalValue DialogFlags = 1
97	// Destroy the dialog when its parent is destroyed
98	DialogDestroyWithParentValue DialogFlags = 2
99	// Create dialog with actions in header
100	//   bar instead of action area
101	DialogUseHeaderBarValue DialogFlags = 4
102)
103
104// Predefined values for use as response ids in gtk_dialog_add_button().
105//
106// All predefined values are negative; GTK leaves values of 0 or greater for
107// application-defined response ids.
108type ResponseType int
109
110var xResponseTypeGLibType func() types.GType
111
112func ResponseTypeGLibType() types.GType {
113	return xResponseTypeGLibType()
114}
115
116const (
117
118	// Returned if an action widget has no response id,
119	//   or if the dialog gets programmatically hidden or destroyed
120	ResponseNoneValue ResponseType = -1
121	// Generic response id, not used by GTK dialogs
122	ResponseRejectValue ResponseType = -2
123	// Generic response id, not used by GTK dialogs
124	ResponseAcceptValue ResponseType = -3
125	// Returned if the dialog is deleted
126	ResponseDeleteEventValue ResponseType = -4
127	// Returned by OK buttons in GTK dialogs
128	ResponseOkValue ResponseType = -5
129	// Returned by Cancel buttons in GTK dialogs
130	ResponseCancelValue ResponseType = -6
131	// Returned by Close buttons in GTK dialogs
132	ResponseCloseValue ResponseType = -7
133	// Returned by Yes buttons in GTK dialogs
134	ResponseYesValue ResponseType = -8
135	// Returned by No buttons in GTK dialogs
136	ResponseNoValue ResponseType = -9
137	// Returned by Apply buttons in GTK dialogs
138	ResponseApplyValue ResponseType = -10
139	// Returned by Help buttons in GTK dialogs
140	ResponseHelpValue ResponseType = -11
141)
142
143// Dialogs are a convenient way to prompt the user for a small amount
144// of input.
145//
146// <picture>
147//
148//	<source srcset="dialog-dark.png" media="(prefers-color-scheme: dark)">
149//	<img alt="An example GtkDialog" src="dialog.png">
150//
151// </picture>
152//
153// Typical uses are to display a message, ask a question, or anything else
154// that does not require extensive effort on the user’s part.
155//
156// The main area of a `GtkDialog` is called the "content area", and is yours
157// to populate with widgets such a `GtkLabel` or `GtkEntry`, to present
158// your information, questions, or tasks to the user.
159//
160// In addition, dialogs allow you to add "action widgets". Most commonly,
161// action widgets are buttons. Depending on the platform, action widgets may
162// be presented in the header bar at the top of the window, or at the bottom
163// of the window. To add action widgets, create your `GtkDialog` using
164// [ctor@Gtk.Dialog.new_with_buttons], or use
165// [method@Gtk.Dialog.add_button], [method@Gtk.Dialog.add_buttons],
166// or [method@Gtk.Dialog.add_action_widget].
167//
168// `GtkDialogs` uses some heuristics to decide whether to add a close
169// button to the window decorations. If any of the action buttons use
170// the response ID %GTK_RESPONSE_CLOSE or %GTK_RESPONSE_CANCEL, the
171// close button is omitted.
172//
173// Clicking a button that was added as an action widget will emit the
174// [signal@Gtk.Dialog::response] signal with a response ID that you specified.
175// GTK will never assign a meaning to positive response IDs; these are
176// entirely user-defined. But for convenience, you can use the response
177// IDs in the [enum@Gtk.ResponseType] enumeration (these all have values
178// less than zero). If a dialog receives a delete event, the
179// [signal@Gtk.Dialog::response] signal will be emitted with the
180// %GTK_RESPONSE_DELETE_EVENT response ID.
181//
182// Dialogs are created with a call to [ctor@Gtk.Dialog.new] or
183// [ctor@Gtk.Dialog.new_with_buttons]. The latter is recommended; it allows
184// you to set the dialog title, some convenient flags, and add buttons.
185//
186// A “modal” dialog (that is, one which freezes the rest of the application
187// from user input), can be created by calling [method@Gtk.Window.set_modal]
188// on the dialog. When using [ctor@Gtk.Dialog.new_with_buttons], you can also
189// pass the %GTK_DIALOG_MODAL flag to make a dialog modal.
190//
191// For the simple dialog in the following example, a [class@Gtk.MessageDialog]
192// would save some effort. But you’d need to create the dialog contents manually
193// if you had more than a simple message in the dialog.
194//
195// An example for simple `GtkDialog` usage:
196//
197// ```c
198// // Function to open a dialog box with a message
199// void
200// quick_message (GtkWindow *parent, char *message)
201//
202//	{
203//	 GtkWidget *dialog, *label, *content_area;
204//	 GtkDialogFlags flags;
205//
206//	 // Create the widgets
207//	 flags = GTK_DIALOG_DESTROY_WITH_PARENT;
208//	 dialog = gtk_dialog_new_with_buttons ("Message",
209//	                                       parent,
210//	                                       flags,
211//	                                       _("_OK"),
212//	                                       GTK_RESPONSE_NONE,
213//	                                       NULL);
214//	 content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
215//	 label = gtk_label_new (message);
216//
217//	 // Ensure that the dialog box is destroyed when the user responds
218//
219//	 g_signal_connect_swapped (dialog,
220//	                           "response",
221//	                           G_CALLBACK (gtk_window_destroy),
222//	                           dialog);
223//
224//	 // Add the label, and show everything we’ve added
225//
226//	 gtk_box_append (GTK_BOX (content_area), label);
227//	 gtk_widget_show (dialog);
228//	}
229//
230// ```
231//
232// # GtkDialog as GtkBuildable
233//
234// The `GtkDialog` implementation of the `GtkBuildable` interface exposes the
235// @content_area as an internal child with the name “content_area”.
236//
237// `GtkDialog` supports a custom `<action-widgets>` element, which can contain
238// multiple `<action-widget>` elements. The “response” attribute specifies a
239// numeric response, and the content of the element is the id of widget
240// (which should be a child of the dialogs @action_area). To mark a response
241// as default, set the “default” attribute of the `<action-widget>` element
242// to true.
243//
244// `GtkDialog` supports adding action widgets by specifying “action” as
245// the “type” attribute of a `<child>` element. The widget will be added
246// either to the action area or the headerbar of the dialog, depending
247// on the “use-header-bar” property. The response id has to be associated
248// with the action widget using the `<action-widgets>` element.
249//
250// An example of a `GtkDialog` UI definition fragment:
251//
252// ```xml
253// <object class="GtkDialog" id="dialog1">
254//
255//	<child type="action">
256//	  <object class="GtkButton" id="button_cancel"/>
257//	</child>
258//	<child type="action">
259//	  <object class="GtkButton" id="button_ok">
260//	  </object>
261//	</child>
262//	<action-widgets>
263//	  <action-widget response="cancel">button_cancel</action-widget>
264//	  <action-widget response="ok" default="true">button_ok</action-widget>
265//	</action-widgets>
266//
267// </object>
268// ```
269//
270// # Accessibility
271//
272// `GtkDialog` uses the %GTK_ACCESSIBLE_ROLE_DIALOG role.
273type Dialog struct {
274	Window
275}
276
277var xDialogGLibType func() types.GType
278
279func DialogGLibType() types.GType {
280	return xDialogGLibType()
281}
282
283func DialogNewFromInternalPtr(ptr uintptr) *Dialog {
284	cls := &Dialog{}
285	cls.Ptr = ptr
286	return cls
287}
288
289var xNewDialog func() uintptr
290
291// Creates a new dialog box.
292//
293// Widgets should not be packed into the `GtkWindow`
294// directly, but into the @content_area and @action_area,
295// as described above.
296func NewDialog() *Dialog {
297	var cls *Dialog
298
299	cret := xNewDialog()
300
301	if cret == 0 {
302		return nil
303	}
304	gobject.IncreaseRef(cret)
305	cls = &Dialog{}
306	cls.Ptr = cret
307	return cls
308}
309
310var xNewDialogWithButtons func(uintptr, uintptr, DialogFlags, uintptr, ...interface{}) uintptr
311
312// Creates a new `GtkDialog` with the given title and transient parent.
313//
314// The @flags argument can be used to make the dialog modal, have it
315// destroyed along with its transient parent, or make it use a headerbar.
316//
317// Button text/response ID pairs should be listed in pairs, with a %NULL
318// pointer ending the list. Button text can be arbitrary text. A response
319// ID can be any positive number, or one of the values in the
320// [enum@Gtk.ResponseType] enumeration. If the user clicks one of these
321// buttons, `GtkDialog` will emit the [signal@Gtk.Dialog::response] signal
322// with the corresponding response ID.
323//
324// If a `GtkDialog` receives a delete event, it will emit ::response with a
325// response ID of %GTK_RESPONSE_DELETE_EVENT.
326//
327// However, destroying a dialog does not emit the ::response signal;
328// so be careful relying on ::response when using the
329// %GTK_DIALOG_DESTROY_WITH_PARENT flag.
330//
331// Here’s a simple example:
332// ```c
333// GtkWindow *main_app_window; // Window the dialog should show up on
334// GtkWidget *dialog;
335// GtkDialogFlags flags = GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT;
336// dialog = gtk_dialog_new_with_buttons ("My dialog",
337//
338//	main_app_window,
339//	flags,
340//	_("_OK"),
341//	GTK_RESPONSE_ACCEPT,
342//	_("_Cancel"),
343//	GTK_RESPONSE_REJECT,
344//	NULL);
345//
346// ```
347func NewDialogWithButtons(TitleVar *string, ParentVar *Window, FlagsVar DialogFlags, FirstButtonTextVar *string, varArgs ...interface{}) *Dialog {
348	var cls *Dialog
349
350	TitleVarPtr := core.GStrdupNullable(TitleVar)
351	defer core.GFreeNullable(TitleVarPtr)
352
353	FirstButtonTextVarPtr := core.GStrdupNullable(FirstButtonTextVar)
354	defer core.GFreeNullable(FirstButtonTextVarPtr)
355
356	cret := xNewDialogWithButtons(TitleVarPtr, ParentVar.GoPointer(), FlagsVar, FirstButtonTextVarPtr, varArgs...)
357
358	if cret == 0 {
359		return nil
360	}
361	gobject.IncreaseRef(cret)
362	cls = &Dialog{}
363	cls.Ptr = cret
364	return cls
365}
366
367var xDialogAddActionWidget func(uintptr, uintptr, int)
368
369// Adds an activatable widget to the action area of a `GtkDialog`.
370//
371// GTK connects a signal handler that will emit the
372// [signal@Gtk.Dialog::response] signal on the dialog when the widget
373// is activated. The widget is appended to the end of the dialog’s action
374// area.
375//
376// If you want to add a non-activatable widget, simply pack it into
377// the @action_area field of the `GtkDialog` struct.
378func (x *Dialog) AddActionWidget(ChildVar *Widget, ResponseIdVar int) {
379
380	xDialogAddActionWidget(x.GoPointer(), ChildVar.GoPointer(), ResponseIdVar)
381
382}
383
384var xDialogAddButton func(uintptr, string, int) uintptr
385
386// Adds a button with the given text.
387//
388// GTK arranges things so that clicking the button will emit the
389// [signal@Gtk.Dialog::response] signal with the given @response_id.
390// The button is appended to the end of the dialog’s action area.
391// The button widget is returned, but usually you don’t need it.
392func (x *Dialog) AddButton(ButtonTextVar string, ResponseIdVar int) *Widget {
393	var cls *Widget
394
395	cret := xDialogAddButton(x.GoPointer(), ButtonTextVar, ResponseIdVar)
396
397	if cret == 0 {
398		return nil
399	}
400	gobject.IncreaseRef(cret)
401	cls = &Widget{}
402	cls.Ptr = cret
403	return cls
404}
405
406var xDialogAddButtons func(uintptr, string, ...interface{})
407
408// Adds multiple buttons.
409//
410// This is the same as calling [method@Gtk.Dialog.add_button]
411// repeatedly. The variable argument list should be %NULL-terminated
412// as with [ctor@Gtk.Dialog.new_with_buttons]. Each button must have both
413// text and response ID.
414func (x *Dialog) AddButtons(FirstButtonTextVar string, varArgs ...interface{}) {
415
416	xDialogAddButtons(x.GoPointer(), FirstButtonTextVar, varArgs...)
417
418}
419
420var xDialogGetContentArea func(uintptr) uintptr
421
422// Returns the content area of @dialog.
423func (x *Dialog) GetContentArea() *Box {
424	var cls *Box
425
426	cret := xDialogGetContentArea(x.GoPointer())
427
428	if cret == 0 {
429		return nil
430	}
431	gobject.IncreaseRef(cret)
432	cls = &Box{}
433	cls.Ptr = cret
434	return cls
435}
436
437var xDialogGetHeaderBar func(uintptr) uintptr
438
439// Returns the header bar of @dialog.
440//
441// Note that the headerbar is only used by the dialog if the
442// [property@Gtk.Dialog:use-header-bar] property is %TRUE.
443func (x *Dialog) GetHeaderBar() *HeaderBar {
444	var cls *HeaderBar
445
446	cret := xDialogGetHeaderBar(x.GoPointer())
447
448	if cret == 0 {
449		return nil
450	}
451	gobject.IncreaseRef(cret)
452	cls = &HeaderBar{}
453	cls.Ptr = cret
454	return cls
455}
456
457var xDialogGetResponseForWidget func(uintptr, uintptr) int
458
459// Gets the response id of a widget in the action area
460// of a dialog.
461func (x *Dialog) GetResponseForWidget(WidgetVar *Widget) int {
462
463	cret := xDialogGetResponseForWidget(x.GoPointer(), WidgetVar.GoPointer())
464	return cret
465}
466
467var xDialogGetWidgetForResponse func(uintptr, int) uintptr
468
469// Gets the widget button that uses the given response ID in the action area
470// of a dialog.
471func (x *Dialog) GetWidgetForResponse(ResponseIdVar int) *Widget {
472	var cls *Widget
473
474	cret := xDialogGetWidgetForResponse(x.GoPointer(), ResponseIdVar)
475
476	if cret == 0 {
477		return nil
478	}
479	gobject.IncreaseRef(cret)
480	cls = &Widget{}
481	cls.Ptr = cret
482	return cls
483}
484
485var xDialogResponse func(uintptr, int)
486
487// Emits the ::response signal with the given response ID.
488//
489// Used to indicate that the user has responded to the dialog in some way.
490func (x *Dialog) Response(ResponseIdVar int) {
491
492	xDialogResponse(x.GoPointer(), ResponseIdVar)
493
494}
495
496var xDialogSetDefaultResponse func(uintptr, int)
497
498// Sets the default widget for the dialog based on the response ID.
499//
500// Pressing “Enter” normally activates the default widget.
501func (x *Dialog) SetDefaultResponse(ResponseIdVar int) {
502
503	xDialogSetDefaultResponse(x.GoPointer(), ResponseIdVar)
504
505}
506
507var xDialogSetResponseSensitive func(uintptr, int, bool)
508
509// A convenient way to sensitize/desensitize dialog buttons.
510//
511// Calls `gtk_widget_set_sensitive (widget, @setting)`
512// for each widget in the dialog’s action area with the given @response_id.
513func (x *Dialog) SetResponseSensitive(ResponseIdVar int, SettingVar bool) {
514
515	xDialogSetResponseSensitive(x.GoPointer(), ResponseIdVar, SettingVar)
516
517}
518
519func (c *Dialog) GoPointer() uintptr {
520	if c == nil {
521		return 0
522	}
523	return c.Ptr
524}
525
526func (c *Dialog) SetGoPointer(ptr uintptr) {
527	c.Ptr = ptr
528}
529
530// SetPropertyUseHeaderBar sets the "use-header-bar" property.
531// %TRUE if the dialog uses a headerbar for action buttons
532// instead of the action-area.
533//
534// For technical reasons, this property is declared as an integer
535// property, but you should only set it to %TRUE or %FALSE.
536//
537// ## Creating a dialog with headerbar
538//
539// Builtin `GtkDialog` subclasses such as [class@Gtk.ColorChooserDialog]
540// set this property according to platform conventions (using the
541// [property@Gtk.Settings:gtk-dialogs-use-header] setting).
542//
543// Here is how you can achieve the same:
544//
545// ```c
546// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
547// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
548// ```
549func (x *Dialog) SetPropertyUseHeaderBar(value int) {
550	var v gobject.Value
551	v.Init(gobject.TypeIntVal)
552	v.SetInt(value)
553	x.SetProperty("use-header-bar", &v)
554}
555
556// GetPropertyUseHeaderBar gets the "use-header-bar" property.
557// %TRUE if the dialog uses a headerbar for action buttons
558// instead of the action-area.
559//
560// For technical reasons, this property is declared as an integer
561// property, but you should only set it to %TRUE or %FALSE.
562//
563// ## Creating a dialog with headerbar
564//
565// Builtin `GtkDialog` subclasses such as [class@Gtk.ColorChooserDialog]
566// set this property according to platform conventions (using the
567// [property@Gtk.Settings:gtk-dialogs-use-header] setting).
568//
569// Here is how you can achieve the same:
570//
571// ```c
572// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
573// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
574// ```
575func (x *Dialog) GetPropertyUseHeaderBar() int {
576	var v gobject.Value
577	x.GetProperty("use-header-bar", &v)
578	return v.GetInt()
579}
580
581// Emitted when the user uses a keybinding to close the dialog.
582//
583// This is a [keybinding signal](class.SignalAction.html).
584//
585// The default binding for this signal is the Escape key.
586func (x *Dialog) ConnectClose(cb *func(Dialog)) uint {
587	cbPtr := uintptr(unsafe.Pointer(cb))
588	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
589		handlerID := gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr)
590		glib.SaveHandlerMapping(handlerID, cbPtr)
591		return handlerID
592	}
593
594	fcb := func(clsPtr uintptr) {
595		fa := Dialog{}
596		fa.Ptr = clsPtr
597		cbFn := *cb
598
599		cbFn(fa)
600
601	}
602	cbRefPtr := purego.NewCallback(fcb)
603	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
604	handlerID := gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr)
605	glib.SaveHandlerMapping(handlerID, cbPtr)
606	return handlerID
607}
608
609// Emitted when an action widget is clicked.
610//
611// The signal is also emitted when the dialog receives a
612// delete event, and when [method@Gtk.Dialog.response] is called.
613// On a delete event, the response ID is %GTK_RESPONSE_DELETE_EVENT.
614// Otherwise, it depends on which action widget was clicked.
615func (x *Dialog) ConnectResponse(cb *func(Dialog, int)) uint {
616	cbPtr := uintptr(unsafe.Pointer(cb))
617	if cbRefPtr, ok := glib.GetCallback(cbPtr); ok {
618		handlerID := gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr)
619		glib.SaveHandlerMapping(handlerID, cbPtr)
620		return handlerID
621	}
622
623	fcb := func(clsPtr uintptr, ResponseIdVarp int) {
624		fa := Dialog{}
625		fa.Ptr = clsPtr
626		cbFn := *cb
627
628		cbFn(fa, ResponseIdVarp)
629
630	}
631	cbRefPtr := purego.NewCallback(fcb)
632	glib.SaveCallbackWithClosure(cbPtr, cbRefPtr, cb)
633	handlerID := gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr)
634	glib.SaveHandlerMapping(handlerID, cbPtr)
635	return handlerID
636}
637
638// Requests the user's screen reader to announce the given message.
639//
640// This kind of notification is useful for messages that
641// either have only a visual representation or that are not
642// exposed visually at all, e.g. a notification about a
643// successful operation.
644//
645// Also, by using this API, you can ensure that the message
646// does not interrupts the user's current screen reader output.
647func (x *Dialog) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
648
649	XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
650
651}
652
653// Retrieves the accessible parent for an accessible object.
654//
655// This function returns `NULL` for top level widgets.
656func (x *Dialog) GetAccessibleParent() *AccessibleBase {
657	var cls *AccessibleBase
658
659	cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
660
661	if cret == 0 {
662		return nil
663	}
664	cls = &AccessibleBase{}
665	cls.Ptr = cret
666	return cls
667}
668
669// Retrieves the accessible role of an accessible object.
670func (x *Dialog) GetAccessibleRole() AccessibleRole {
671
672	cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
673	return cret
674}
675
676// Retrieves the implementation for the given accessible object.
677func (x *Dialog) GetAtContext() *ATContext {
678	var cls *ATContext
679
680	cret := XGtkAccessibleGetAtContext(x.GoPointer())
681
682	if cret == 0 {
683		return nil
684	}
685	cls = &ATContext{}
686	cls.Ptr = cret
687	return cls
688}
689
690// Queries the coordinates and dimensions of this accessible
691//
692// This functionality can be overridden by `GtkAccessible`
693// implementations, e.g. to get the bounds from an ignored
694// child widget.
695func (x *Dialog) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
696
697	cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
698	return cret
699}
700
701// Retrieves the first accessible child of an accessible object.
702func (x *Dialog) GetFirstAccessibleChild() *AccessibleBase {
703	var cls *AccessibleBase
704
705	cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
706
707	if cret == 0 {
708		return nil
709	}
710	cls = &AccessibleBase{}
711	cls.Ptr = cret
712	return cls
713}
714
715// Retrieves the next accessible sibling of an accessible object
716func (x *Dialog) GetNextAccessibleSibling() *AccessibleBase {
717	var cls *AccessibleBase
718
719	cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
720
721	if cret == 0 {
722		return nil
723	}
724	cls = &AccessibleBase{}
725	cls.Ptr = cret
726	return cls
727}
728
729// Queries a platform state, such as focus.
730//
731// This functionality can be overridden by `GtkAccessible`
732// implementations, e.g. to get platform state from an ignored
733// child widget, as is the case for `GtkText` wrappers.
734func (x *Dialog) GetPlatformState(StateVar AccessiblePlatformState) bool {
735
736	cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
737	return cret
738}
739
740// Resets the accessible property to its default value.
741func (x *Dialog) ResetProperty(PropertyVar AccessibleProperty) {
742
743	XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
744
745}
746
747// Resets the accessible relation to its default value.
748func (x *Dialog) ResetRelation(RelationVar AccessibleRelation) {
749
750	XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
751
752}
753
754// Resets the accessible state to its default value.
755func (x *Dialog) ResetState(StateVar AccessibleState) {
756
757	XGtkAccessibleResetState(x.GoPointer(), StateVar)
758
759}
760
761// Sets the parent and sibling of an accessible object.
762//
763// This function is meant to be used by accessible implementations that are
764// not part of the widget hierarchy, and but act as a logical bridge between
765// widgets. For instance, if a widget creates an object that holds metadata
766// for each child, and you want that object to implement the `GtkAccessible`
767// interface, you will use this function to ensure that the parent of each
768// child widget is the metadata object, and the parent of each metadata
769// object is the container widget.
770func (x *Dialog) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
771
772	XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
773
774}
775
776// Updates the next accessible sibling.
777//
778// That might be useful when a new child of a custom accessible
779// is created, and it needs to be linked to a previous child.
780func (x *Dialog) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
781
782	XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
783
784}
785
786// Informs ATs that the platform state has changed.
787//
788// This function should be used by `GtkAccessible` implementations that
789// have a platform state but are not widgets. Widgets handle platform
790// states automatically.
791func (x *Dialog) UpdatePlatformState(StateVar AccessiblePlatformState) {
792
793	XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
794
795}
796
797// Updates a list of accessible properties.
798//
799// See the [enum@Gtk.AccessibleProperty] documentation for the
800// value types of accessible properties.
801//
802// This function should be called by `GtkWidget` types whenever
803// an accessible property change must be communicated to assistive
804// technologies.
805//
806// Example:
807// ```c
808// value = gtk_adjustment_get_value (adjustment);
809// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
810//
811//	GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
812//	-1);
813//
814// ```
815func (x *Dialog) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
816
817	XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
818
819}
820
821// Updates an array of accessible properties.
822//
823// This function should be called by `GtkWidget` types whenever an accessible
824// property change must be communicated to assistive technologies.
825//
826// This function is meant to be used by language bindings.
827func (x *Dialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
828
829	XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
830
831}
832
833// Updates a list of accessible relations.
834//
835// This function should be called by `GtkWidget` types whenever an accessible
836// relation change must be communicated to assistive technologies.
837//
838// If the [enum@Gtk.AccessibleRelation] requires a list of references,
839// you should pass each reference individually, followed by `NULL`, e.g.
840//
841// ```c
842// gtk_accessible_update_relation (accessible,
843//
844//	GTK_ACCESSIBLE_RELATION_CONTROLS,
845//	  ref1, NULL,
846//	GTK_ACCESSIBLE_RELATION_LABELLED_BY,
847//	  ref1, ref2, ref3, NULL,
848//	-1);
849//
850// ```
851func (x *Dialog) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
852
853	XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
854
855}
856
857// Updates an array of accessible relations.
858//
859// This function should be called by `GtkWidget` types whenever an accessible
860// relation change must be communicated to assistive technologies.
861//
862// This function is meant to be used by language bindings.
863func (x *Dialog) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
864
865	XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
866
867}
868
869// Updates a list of accessible states.
870//
871// See the [enum@Gtk.AccessibleState] documentation for the
872// value types of accessible states.
873//
874// This function should be called by `GtkWidget` types whenever
875// an accessible state change must be communicated to assistive
876// technologies.
877//
878// Example:
879//
880// ```c
881// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
882// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
883//
884//	GTK_ACCESSIBLE_STATE_CHECKED, value,
885//	-1);
886//
887// ```
888func (x *Dialog) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
889
890	XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
891
892}
893
894// Updates an array of accessible states.
895//
896// This function should be called by `GtkWidget` types whenever an accessible
897// state change must be communicated to assistive technologies.
898//
899// This function is meant to be used by language bindings.
900func (x *Dialog) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
901
902	XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
903
904}
905
906// Gets the ID of the @buildable object.
907//
908// `GtkBuilder` sets the name based on the ID attribute
909// of the `<object>` tag used to construct the @buildable.
910func (x *Dialog) GetBuildableId() string {
911
912	cret := XGtkBuildableGetBuildableId(x.GoPointer())
913	return cret
914}
915
916// Returns the renderer that is used for this `GtkNative`.
917func (x *Dialog) GetRenderer() *gsk.Renderer {
918	var cls *gsk.Renderer
919
920	cret := XGtkNativeGetRenderer(x.GoPointer())
921
922	if cret == 0 {
923		return nil
924	}
925	gobject.IncreaseRef(cret)
926	cls = &gsk.Renderer{}
927	cls.Ptr = cret
928	return cls
929}
930
931// Returns the surface of this `GtkNative`.
932func (x *Dialog) GetSurface() *gdk.Surface {
933	var cls *gdk.Surface
934
935	cret := XGtkNativeGetSurface(x.GoPointer())
936
937	if cret == 0 {
938		return nil
939	}
940	gobject.IncreaseRef(cret)
941	cls = &gdk.Surface{}
942	cls.Ptr = cret
943	return cls
944}
945
946// Retrieves the surface transform of @self.
947//
948// This is the translation from @self's surface coordinates into
949// @self's widget coordinates.
950func (x *Dialog) GetSurfaceTransform(XVar *float64, YVar *float64) {
951
952	XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
953
954}
955
956// Realizes a `GtkNative`.
957//
958// This should only be used by subclasses.
959func (x *Dialog) Realize() {
960
961	XGtkNativeRealize(x.GoPointer())
962
963}
964
965// Unrealizes a `GtkNative`.
966//
967// This should only be used by subclasses.
968func (x *Dialog) Unrealize() {
969
970	XGtkNativeUnrealize(x.GoPointer())
971
972}
973
974// Returns the display that this `GtkRoot` is on.
975func (x *Dialog) GetDisplay() *gdk.Display {
976	var cls *gdk.Display
977
978	cret := XGtkRootGetDisplay(x.GoPointer())
979
980	if cret == 0 {
981		return nil
982	}
983	gobject.IncreaseRef(cret)
984	cls = &gdk.Display{}
985	cls.Ptr = cret
986	return cls
987}
988
989// Retrieves the current focused widget within the root.
990//
991// Note that this is the widget that would have the focus
992// if the root is active; if the root is not focused then
993// `gtk_widget_has_focus (widget)` will be %FALSE for the
994// widget.
995func (x *Dialog) GetFocus() *Widget {
996	var cls *Widget
997
998	cret := XGtkRootGetFocus(x.GoPointer())
999
1000	if cret == 0 {
1001		return nil
1002	}
1003	gobject.IncreaseRef(cret)
1004	cls = &Widget{}
1005	cls.Ptr = cret
1006	return cls
1007}
1008
1009// If @focus is not the current focus widget, and is focusable, sets
1010// it as the focus widget for the root.
1011//
1012// If @focus is %NULL, unsets the focus widget for the root.
1013//
1014// To set the focus to a particular widget in the root, it is usually
1015// more convenient to use [method@Gtk.Widget.grab_focus] instead of
1016// this function.
1017func (x *Dialog) SetFocus(FocusVar *Widget) {
1018
1019	XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
1020
1021}
1022
1023func init() {
1024	core.SetPackageName("GTK", "gtk4")
1025	core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
1026	var libs []uintptr
1027	for _, libPath := range core.GetPaths("GTK") {
1028		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
1029		if err != nil {
1030			panic(err)
1031		}
1032		libs = append(libs, lib)
1033	}
1034
1035	core.PuregoSafeRegister(&xDialogFlagsGLibType, libs, "gtk_dialog_flags_get_type")
1036
1037	core.PuregoSafeRegister(&xResponseTypeGLibType, libs, "gtk_response_type_get_type")
1038
1039	core.PuregoSafeRegister(&xDialogGLibType, libs, "gtk_dialog_get_type")
1040
1041	core.PuregoSafeRegister(&xNewDialog, libs, "gtk_dialog_new")
1042	core.PuregoSafeRegister(&xNewDialogWithButtons, libs, "gtk_dialog_new_with_buttons")
1043
1044	core.PuregoSafeRegister(&xDialogAddActionWidget, libs, "gtk_dialog_add_action_widget")
1045	core.PuregoSafeRegister(&xDialogAddButton, libs, "gtk_dialog_add_button")
1046	core.PuregoSafeRegister(&xDialogAddButtons, libs, "gtk_dialog_add_buttons")
1047	core.PuregoSafeRegister(&xDialogGetContentArea, libs, "gtk_dialog_get_content_area")
1048	core.PuregoSafeRegister(&xDialogGetHeaderBar, libs, "gtk_dialog_get_header_bar")
1049	core.PuregoSafeRegister(&xDialogGetResponseForWidget, libs, "gtk_dialog_get_response_for_widget")
1050	core.PuregoSafeRegister(&xDialogGetWidgetForResponse, libs, "gtk_dialog_get_widget_for_response")
1051	core.PuregoSafeRegister(&xDialogResponse, libs, "gtk_dialog_response")
1052	core.PuregoSafeRegister(&xDialogSetDefaultResponse, libs, "gtk_dialog_set_default_response")
1053	core.PuregoSafeRegister(&xDialogSetResponseSensitive, libs, "gtk_dialog_set_response_sensitive")
1054
1055}

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