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/gobject"
13 "github.com/bnema/puregotk/v4/gobject/types"
14 "github.com/bnema/puregotk/v4/gsk"
15)
16
17type MessageDialogClass struct {
18 _ structs.HostLayout
19}
20
21func (x *MessageDialogClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25// Prebuilt sets of buttons for `GtkDialog`.
26//
27// If none of these choices are appropriate, simply use
28// %GTK_BUTTONS_NONE and call [method@Gtk.Dialog.add_buttons].
29//
30// > Please note that %GTK_BUTTONS_OK, %GTK_BUTTONS_YES_NO
31// > and %GTK_BUTTONS_OK_CANCEL are discouraged by the
32// > [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/).
33type ButtonsType int
34
35var xButtonsTypeGLibType func() types.GType
36
37func ButtonsTypeGLibType() types.GType {
38 return xButtonsTypeGLibType()
39}
40
41const (
42
43 // no buttons at all
44 ButtonsNoneValue ButtonsType = 0
45 // an OK button
46 ButtonsOkValue ButtonsType = 1
47 // a Close button
48 ButtonsCloseValue ButtonsType = 2
49 // a Cancel button
50 ButtonsCancelValue ButtonsType = 3
51 // Yes and No buttons
52 ButtonsYesNoValue ButtonsType = 4
53 // OK and Cancel buttons
54 ButtonsOkCancelValue ButtonsType = 5
55)
56
57// `GtkMessageDialog` presents a dialog with some message text.
58//
59// <picture>
60//
61// <source srcset="messagedialog-dark.png" media="(prefers-color-scheme: dark)">
62// <img alt="An example GtkMessageDialog" src="messagedialog.png">
63//
64// </picture>
65//
66// It’s simply a convenience widget; you could construct the equivalent of
67// `GtkMessageDialog` from `GtkDialog` without too much effort, but
68// `GtkMessageDialog` saves typing.
69//
70// The easiest way to do a modal message dialog is to use the %GTK_DIALOG_MODAL
71// flag, which will call [method@Gtk.Window.set_modal] internally. The dialog will
72// prevent interaction with the parent window until it's hidden or destroyed.
73// You can use the [signal@Gtk.Dialog::response] signal to know when the user
74// dismissed the dialog.
75//
76// An example for using a modal dialog:
77// ```c
78// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL;
79// dialog = gtk_message_dialog_new (parent_window,
80//
81// flags,
82// GTK_MESSAGE_ERROR,
83// GTK_BUTTONS_CLOSE,
84// "Error reading “%s”: %s",
85// filename,
86// g_strerror (errno));
87//
88// // Destroy the dialog when the user responds to it
89// // (e.g. clicks a button)
90//
91// g_signal_connect (dialog, "response",
92//
93// G_CALLBACK (gtk_window_destroy),
94// NULL);
95//
96// ```
97//
98// You might do a non-modal `GtkMessageDialog` simply by omitting the
99// %GTK_DIALOG_MODAL flag:
100//
101// ```c
102// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
103// dialog = gtk_message_dialog_new (parent_window,
104//
105// flags,
106// GTK_MESSAGE_ERROR,
107// GTK_BUTTONS_CLOSE,
108// "Error reading “%s”: %s",
109// filename,
110// g_strerror (errno));
111//
112// // Destroy the dialog when the user responds to it
113// // (e.g. clicks a button)
114// g_signal_connect (dialog, "response",
115//
116// G_CALLBACK (gtk_window_destroy),
117// NULL);
118//
119// ```
120//
121// # GtkMessageDialog as GtkBuildable
122//
123// The `GtkMessageDialog` implementation of the `GtkBuildable` interface exposes
124// the message area as an internal child with the name “message_area”.
125type MessageDialog struct {
126 Dialog
127}
128
129var xMessageDialogGLibType func() types.GType
130
131func MessageDialogGLibType() types.GType {
132 return xMessageDialogGLibType()
133}
134
135func MessageDialogNewFromInternalPtr(ptr uintptr) *MessageDialog {
136 cls := &MessageDialog{}
137 cls.Ptr = ptr
138 return cls
139}
140
141var xNewMessageDialog func(uintptr, DialogFlags, MessageType, ButtonsType, uintptr, ...interface{}) uintptr
142
143// Creates a new message dialog.
144//
145// This is a simple dialog with some text the user may want to see.
146// When the user clicks a button a “response” signal is emitted with
147// response IDs from [enum@Gtk.ResponseType]. See [class@Gtk.Dialog]
148// for more details.
149func NewMessageDialog(ParentVar *Window, FlagsVar DialogFlags, TypeVar MessageType, ButtonsVar ButtonsType, MessageFormatVar *string, varArgs ...interface{}) *MessageDialog {
150 var cls *MessageDialog
151
152 MessageFormatVarPtr := core.GStrdupNullable(MessageFormatVar)
153 defer core.GFreeNullable(MessageFormatVarPtr)
154
155 cret := xNewMessageDialog(ParentVar.GoPointer(), FlagsVar, TypeVar, ButtonsVar, MessageFormatVarPtr, varArgs...)
156
157 if cret == 0 {
158 return nil
159 }
160 gobject.IncreaseRef(cret)
161 cls = &MessageDialog{}
162 cls.Ptr = cret
163 return cls
164}
165
166var xNewMessageDialogWithMarkup func(uintptr, DialogFlags, MessageType, ButtonsType, uintptr, ...interface{}) uintptr
167
168// Creates a new message dialog.
169//
170// This is a simple dialog with some text that is marked up with
171// Pango markup. When the user clicks a button a “response” signal
172// is emitted with response IDs from [enum@Gtk.ResponseType]. See
173// [class@Gtk.Dialog] for more details.
174//
175// Special XML characters in the printf() arguments passed to this
176// function will automatically be escaped as necessary.
177// (See g_markup_printf_escaped() for how this is implemented.)
178// Usually this is what you want, but if you have an existing
179// Pango markup string that you want to use literally as the
180// label, then you need to use [method@Gtk.MessageDialog.set_markup]
181// instead, since you can’t pass the markup string either
182// as the format (it might contain “%” characters) or as a string
183// argument.
184//
185// ```c
186// GtkWidget *dialog;
187// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
188// dialog = gtk_message_dialog_new (parent_window,
189//
190// flags,
191// GTK_MESSAGE_ERROR,
192// GTK_BUTTONS_CLOSE,
193// NULL);
194//
195// gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
196//
197// markup);
198//
199// ```
200func NewMessageDialogWithMarkup(ParentVar *Window, FlagsVar DialogFlags, TypeVar MessageType, ButtonsVar ButtonsType, MessageFormatVar *string, varArgs ...interface{}) *MessageDialog {
201 var cls *MessageDialog
202
203 MessageFormatVarPtr := core.GStrdupNullable(MessageFormatVar)
204 defer core.GFreeNullable(MessageFormatVarPtr)
205
206 cret := xNewMessageDialogWithMarkup(ParentVar.GoPointer(), FlagsVar, TypeVar, ButtonsVar, MessageFormatVarPtr, varArgs...)
207
208 if cret == 0 {
209 return nil
210 }
211 gobject.IncreaseRef(cret)
212 cls = &MessageDialog{}
213 cls.Ptr = cret
214 return cls
215}
216
217var xMessageDialogFormatSecondaryMarkup func(uintptr, string, ...interface{})
218
219// Sets the secondary text of the message dialog.
220//
221// The @message_format is assumed to contain Pango markup.
222//
223// Due to an oversight, this function does not escape special
224// XML characters like [ctor@Gtk.MessageDialog.new_with_markup]
225// does. Thus, if the arguments may contain special XML characters,
226// you should use g_markup_printf_escaped() to escape it.
227//
228// ```c
229// char *msg;
230//
231// msg = g_markup_printf_escaped (message_format, ...);
232// gtk_message_dialog_format_secondary_markup (message_dialog,
233//
234// "%s", msg);
235//
236// g_free (msg);
237// ```
238func (x *MessageDialog) FormatSecondaryMarkup(MessageFormatVar string, varArgs ...interface{}) {
239
240 xMessageDialogFormatSecondaryMarkup(x.GoPointer(), MessageFormatVar, varArgs...)
241
242}
243
244var xMessageDialogFormatSecondaryText func(uintptr, uintptr, ...interface{})
245
246// Sets the secondary text of the message dialog.
247func (x *MessageDialog) FormatSecondaryText(MessageFormatVar *string, varArgs ...interface{}) {
248
249 MessageFormatVarPtr := core.GStrdupNullable(MessageFormatVar)
250 defer core.GFreeNullable(MessageFormatVarPtr)
251
252 xMessageDialogFormatSecondaryText(x.GoPointer(), MessageFormatVarPtr, varArgs...)
253
254}
255
256var xMessageDialogGetMessageArea func(uintptr) uintptr
257
258// Returns the message area of the dialog.
259//
260// This is the box where the dialog’s primary and secondary labels
261// are packed. You can add your own extra content to that box and it
262// will appear below those labels. See [method@Gtk.Dialog.get_content_area]
263// for the corresponding function in the parent [class@Gtk.Dialog].
264func (x *MessageDialog) GetMessageArea() *Widget {
265 var cls *Widget
266
267 cret := xMessageDialogGetMessageArea(x.GoPointer())
268
269 if cret == 0 {
270 return nil
271 }
272 gobject.IncreaseRef(cret)
273 cls = &Widget{}
274 cls.Ptr = cret
275 return cls
276}
277
278var xMessageDialogSetMarkup func(uintptr, string)
279
280// Sets the text of the message dialog.
281func (x *MessageDialog) SetMarkup(StrVar string) {
282
283 xMessageDialogSetMarkup(x.GoPointer(), StrVar)
284
285}
286
287func (c *MessageDialog) GoPointer() uintptr {
288 if c == nil {
289 return 0
290 }
291 return c.Ptr
292}
293
294func (c *MessageDialog) SetGoPointer(ptr uintptr) {
295 c.Ptr = ptr
296}
297
298// SetPropertySecondaryText sets the "secondary-text" property.
299// The secondary text of the message dialog.
300func (x *MessageDialog) SetPropertySecondaryText(value string) {
301 var v gobject.Value
302 v.Init(gobject.TypeStringVal)
303 v.SetString(&value)
304 x.SetProperty("secondary-text", &v)
305}
306
307// GetPropertySecondaryText gets the "secondary-text" property.
308// The secondary text of the message dialog.
309func (x *MessageDialog) GetPropertySecondaryText() string {
310 var v gobject.Value
311 x.GetProperty("secondary-text", &v)
312 return v.GetString()
313}
314
315// SetPropertySecondaryUseMarkup sets the "secondary-use-markup" property.
316// %TRUE if the secondary text of the dialog includes Pango markup.
317//
318// See [func@Pango.parse_markup].
319func (x *MessageDialog) SetPropertySecondaryUseMarkup(value bool) {
320 var v gobject.Value
321 v.Init(gobject.TypeBooleanVal)
322 v.SetBoolean(value)
323 x.SetProperty("secondary-use-markup", &v)
324}
325
326// GetPropertySecondaryUseMarkup gets the "secondary-use-markup" property.
327// %TRUE if the secondary text of the dialog includes Pango markup.
328//
329// See [func@Pango.parse_markup].
330func (x *MessageDialog) GetPropertySecondaryUseMarkup() bool {
331 var v gobject.Value
332 x.GetProperty("secondary-use-markup", &v)
333 return v.GetBoolean()
334}
335
336// SetPropertyText sets the "text" property.
337// The primary text of the message dialog.
338//
339// If the dialog has a secondary text, this will appear as the title.
340func (x *MessageDialog) SetPropertyText(value string) {
341 var v gobject.Value
342 v.Init(gobject.TypeStringVal)
343 v.SetString(&value)
344 x.SetProperty("text", &v)
345}
346
347// GetPropertyText gets the "text" property.
348// The primary text of the message dialog.
349//
350// If the dialog has a secondary text, this will appear as the title.
351func (x *MessageDialog) GetPropertyText() string {
352 var v gobject.Value
353 x.GetProperty("text", &v)
354 return v.GetString()
355}
356
357// SetPropertyUseMarkup sets the "use-markup" property.
358// %TRUE if the primary text of the dialog includes Pango markup.
359//
360// See [func@Pango.parse_markup].
361func (x *MessageDialog) SetPropertyUseMarkup(value bool) {
362 var v gobject.Value
363 v.Init(gobject.TypeBooleanVal)
364 v.SetBoolean(value)
365 x.SetProperty("use-markup", &v)
366}
367
368// GetPropertyUseMarkup gets the "use-markup" property.
369// %TRUE if the primary text of the dialog includes Pango markup.
370//
371// See [func@Pango.parse_markup].
372func (x *MessageDialog) GetPropertyUseMarkup() bool {
373 var v gobject.Value
374 x.GetProperty("use-markup", &v)
375 return v.GetBoolean()
376}
377
378// Requests the user's screen reader to announce the given message.
379//
380// This kind of notification is useful for messages that
381// either have only a visual representation or that are not
382// exposed visually at all, e.g. a notification about a
383// successful operation.
384//
385// Also, by using this API, you can ensure that the message
386// does not interrupts the user's current screen reader output.
387func (x *MessageDialog) Announce(MessageVar string, PriorityVar AccessibleAnnouncementPriority) {
388
389 XGtkAccessibleAnnounce(x.GoPointer(), MessageVar, PriorityVar)
390
391}
392
393// Retrieves the accessible parent for an accessible object.
394//
395// This function returns `NULL` for top level widgets.
396func (x *MessageDialog) GetAccessibleParent() *AccessibleBase {
397 var cls *AccessibleBase
398
399 cret := XGtkAccessibleGetAccessibleParent(x.GoPointer())
400
401 if cret == 0 {
402 return nil
403 }
404 cls = &AccessibleBase{}
405 cls.Ptr = cret
406 return cls
407}
408
409// Retrieves the accessible role of an accessible object.
410func (x *MessageDialog) GetAccessibleRole() AccessibleRole {
411
412 cret := XGtkAccessibleGetAccessibleRole(x.GoPointer())
413 return cret
414}
415
416// Retrieves the implementation for the given accessible object.
417func (x *MessageDialog) GetAtContext() *ATContext {
418 var cls *ATContext
419
420 cret := XGtkAccessibleGetAtContext(x.GoPointer())
421
422 if cret == 0 {
423 return nil
424 }
425 cls = &ATContext{}
426 cls.Ptr = cret
427 return cls
428}
429
430// Queries the coordinates and dimensions of this accessible
431//
432// This functionality can be overridden by `GtkAccessible`
433// implementations, e.g. to get the bounds from an ignored
434// child widget.
435func (x *MessageDialog) GetBounds(XVar *int, YVar *int, WidthVar *int, HeightVar *int) bool {
436
437 cret := XGtkAccessibleGetBounds(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
438 return cret
439}
440
441// Retrieves the first accessible child of an accessible object.
442func (x *MessageDialog) GetFirstAccessibleChild() *AccessibleBase {
443 var cls *AccessibleBase
444
445 cret := XGtkAccessibleGetFirstAccessibleChild(x.GoPointer())
446
447 if cret == 0 {
448 return nil
449 }
450 cls = &AccessibleBase{}
451 cls.Ptr = cret
452 return cls
453}
454
455// Retrieves the next accessible sibling of an accessible object
456func (x *MessageDialog) GetNextAccessibleSibling() *AccessibleBase {
457 var cls *AccessibleBase
458
459 cret := XGtkAccessibleGetNextAccessibleSibling(x.GoPointer())
460
461 if cret == 0 {
462 return nil
463 }
464 cls = &AccessibleBase{}
465 cls.Ptr = cret
466 return cls
467}
468
469// Queries a platform state, such as focus.
470//
471// This functionality can be overridden by `GtkAccessible`
472// implementations, e.g. to get platform state from an ignored
473// child widget, as is the case for `GtkText` wrappers.
474func (x *MessageDialog) GetPlatformState(StateVar AccessiblePlatformState) bool {
475
476 cret := XGtkAccessibleGetPlatformState(x.GoPointer(), StateVar)
477 return cret
478}
479
480// Resets the accessible property to its default value.
481func (x *MessageDialog) ResetProperty(PropertyVar AccessibleProperty) {
482
483 XGtkAccessibleResetProperty(x.GoPointer(), PropertyVar)
484
485}
486
487// Resets the accessible relation to its default value.
488func (x *MessageDialog) ResetRelation(RelationVar AccessibleRelation) {
489
490 XGtkAccessibleResetRelation(x.GoPointer(), RelationVar)
491
492}
493
494// Resets the accessible state to its default value.
495func (x *MessageDialog) ResetState(StateVar AccessibleState) {
496
497 XGtkAccessibleResetState(x.GoPointer(), StateVar)
498
499}
500
501// Sets the parent and sibling of an accessible object.
502//
503// This function is meant to be used by accessible implementations that are
504// not part of the widget hierarchy, and but act as a logical bridge between
505// widgets. For instance, if a widget creates an object that holds metadata
506// for each child, and you want that object to implement the `GtkAccessible`
507// interface, you will use this function to ensure that the parent of each
508// child widget is the metadata object, and the parent of each metadata
509// object is the container widget.
510func (x *MessageDialog) SetAccessibleParent(ParentVar Accessible, NextSiblingVar Accessible) {
511
512 XGtkAccessibleSetAccessibleParent(x.GoPointer(), ParentVar.GoPointer(), NextSiblingVar.GoPointer())
513
514}
515
516// Updates the next accessible sibling.
517//
518// That might be useful when a new child of a custom accessible
519// is created, and it needs to be linked to a previous child.
520func (x *MessageDialog) UpdateNextAccessibleSibling(NewSiblingVar Accessible) {
521
522 XGtkAccessibleUpdateNextAccessibleSibling(x.GoPointer(), NewSiblingVar.GoPointer())
523
524}
525
526// Informs ATs that the platform state has changed.
527//
528// This function should be used by `GtkAccessible` implementations that
529// have a platform state but are not widgets. Widgets handle platform
530// states automatically.
531func (x *MessageDialog) UpdatePlatformState(StateVar AccessiblePlatformState) {
532
533 XGtkAccessibleUpdatePlatformState(x.GoPointer(), StateVar)
534
535}
536
537// Updates a list of accessible properties.
538//
539// See the [enum@Gtk.AccessibleProperty] documentation for the
540// value types of accessible properties.
541//
542// This function should be called by `GtkWidget` types whenever
543// an accessible property change must be communicated to assistive
544// technologies.
545//
546// Example:
547// ```c
548// value = gtk_adjustment_get_value (adjustment);
549// gtk_accessible_update_property (GTK_ACCESSIBLE (spin_button),
550//
551// GTK_ACCESSIBLE_PROPERTY_VALUE_NOW, value,
552// -1);
553//
554// ```
555func (x *MessageDialog) UpdateProperty(FirstPropertyVar AccessibleProperty, varArgs ...interface{}) {
556
557 XGtkAccessibleUpdateProperty(x.GoPointer(), FirstPropertyVar, varArgs...)
558
559}
560
561// Updates an array of accessible properties.
562//
563// This function should be called by `GtkWidget` types whenever an accessible
564// property change must be communicated to assistive technologies.
565//
566// This function is meant to be used by language bindings.
567func (x *MessageDialog) UpdatePropertyValue(NPropertiesVar int, PropertiesVar []AccessibleProperty, ValuesVar []gobject.Value) {
568
569 XGtkAccessibleUpdatePropertyValue(x.GoPointer(), NPropertiesVar, PropertiesVar, ValuesVar)
570
571}
572
573// Updates a list of accessible relations.
574//
575// This function should be called by `GtkWidget` types whenever an accessible
576// relation change must be communicated to assistive technologies.
577//
578// If the [enum@Gtk.AccessibleRelation] requires a list of references,
579// you should pass each reference individually, followed by `NULL`, e.g.
580//
581// ```c
582// gtk_accessible_update_relation (accessible,
583//
584// GTK_ACCESSIBLE_RELATION_CONTROLS,
585// ref1, NULL,
586// GTK_ACCESSIBLE_RELATION_LABELLED_BY,
587// ref1, ref2, ref3, NULL,
588// -1);
589//
590// ```
591func (x *MessageDialog) UpdateRelation(FirstRelationVar AccessibleRelation, varArgs ...interface{}) {
592
593 XGtkAccessibleUpdateRelation(x.GoPointer(), FirstRelationVar, varArgs...)
594
595}
596
597// Updates an array of accessible relations.
598//
599// This function should be called by `GtkWidget` types whenever an accessible
600// relation change must be communicated to assistive technologies.
601//
602// This function is meant to be used by language bindings.
603func (x *MessageDialog) UpdateRelationValue(NRelationsVar int, RelationsVar []AccessibleRelation, ValuesVar []gobject.Value) {
604
605 XGtkAccessibleUpdateRelationValue(x.GoPointer(), NRelationsVar, RelationsVar, ValuesVar)
606
607}
608
609// Updates a list of accessible states.
610//
611// See the [enum@Gtk.AccessibleState] documentation for the
612// value types of accessible states.
613//
614// This function should be called by `GtkWidget` types whenever
615// an accessible state change must be communicated to assistive
616// technologies.
617//
618// Example:
619//
620// ```c
621// value = GTK_ACCESSIBLE_TRISTATE_MIXED;
622// gtk_accessible_update_state (GTK_ACCESSIBLE (check_button),
623//
624// GTK_ACCESSIBLE_STATE_CHECKED, value,
625// -1);
626//
627// ```
628func (x *MessageDialog) UpdateState(FirstStateVar AccessibleState, varArgs ...interface{}) {
629
630 XGtkAccessibleUpdateState(x.GoPointer(), FirstStateVar, varArgs...)
631
632}
633
634// Updates an array of accessible states.
635//
636// This function should be called by `GtkWidget` types whenever an accessible
637// state change must be communicated to assistive technologies.
638//
639// This function is meant to be used by language bindings.
640func (x *MessageDialog) UpdateStateValue(NStatesVar int, StatesVar []AccessibleState, ValuesVar []gobject.Value) {
641
642 XGtkAccessibleUpdateStateValue(x.GoPointer(), NStatesVar, StatesVar, ValuesVar)
643
644}
645
646// Gets the ID of the @buildable object.
647//
648// `GtkBuilder` sets the name based on the ID attribute
649// of the `<object>` tag used to construct the @buildable.
650func (x *MessageDialog) GetBuildableId() string {
651
652 cret := XGtkBuildableGetBuildableId(x.GoPointer())
653 return cret
654}
655
656// Returns the renderer that is used for this `GtkNative`.
657func (x *MessageDialog) GetRenderer() *gsk.Renderer {
658 var cls *gsk.Renderer
659
660 cret := XGtkNativeGetRenderer(x.GoPointer())
661
662 if cret == 0 {
663 return nil
664 }
665 gobject.IncreaseRef(cret)
666 cls = &gsk.Renderer{}
667 cls.Ptr = cret
668 return cls
669}
670
671// Returns the surface of this `GtkNative`.
672func (x *MessageDialog) GetSurface() *gdk.Surface {
673 var cls *gdk.Surface
674
675 cret := XGtkNativeGetSurface(x.GoPointer())
676
677 if cret == 0 {
678 return nil
679 }
680 gobject.IncreaseRef(cret)
681 cls = &gdk.Surface{}
682 cls.Ptr = cret
683 return cls
684}
685
686// Retrieves the surface transform of @self.
687//
688// This is the translation from @self's surface coordinates into
689// @self's widget coordinates.
690func (x *MessageDialog) GetSurfaceTransform(XVar *float64, YVar *float64) {
691
692 XGtkNativeGetSurfaceTransform(x.GoPointer(), XVar, YVar)
693
694}
695
696// Realizes a `GtkNative`.
697//
698// This should only be used by subclasses.
699func (x *MessageDialog) Realize() {
700
701 XGtkNativeRealize(x.GoPointer())
702
703}
704
705// Unrealizes a `GtkNative`.
706//
707// This should only be used by subclasses.
708func (x *MessageDialog) Unrealize() {
709
710 XGtkNativeUnrealize(x.GoPointer())
711
712}
713
714// Returns the display that this `GtkRoot` is on.
715func (x *MessageDialog) GetDisplay() *gdk.Display {
716 var cls *gdk.Display
717
718 cret := XGtkRootGetDisplay(x.GoPointer())
719
720 if cret == 0 {
721 return nil
722 }
723 gobject.IncreaseRef(cret)
724 cls = &gdk.Display{}
725 cls.Ptr = cret
726 return cls
727}
728
729// Retrieves the current focused widget within the root.
730//
731// Note that this is the widget that would have the focus
732// if the root is active; if the root is not focused then
733// `gtk_widget_has_focus (widget)` will be %FALSE for the
734// widget.
735func (x *MessageDialog) GetFocus() *Widget {
736 var cls *Widget
737
738 cret := XGtkRootGetFocus(x.GoPointer())
739
740 if cret == 0 {
741 return nil
742 }
743 gobject.IncreaseRef(cret)
744 cls = &Widget{}
745 cls.Ptr = cret
746 return cls
747}
748
749// If @focus is not the current focus widget, and is focusable, sets
750// it as the focus widget for the root.
751//
752// If @focus is %NULL, unsets the focus widget for the root.
753//
754// To set the focus to a particular widget in the root, it is usually
755// more convenient to use [method@Gtk.Widget.grab_focus] instead of
756// this function.
757func (x *MessageDialog) SetFocus(FocusVar *Widget) {
758
759 XGtkRootSetFocus(x.GoPointer(), FocusVar.GoPointer())
760
761}
762
763func init() {
764 core.SetPackageName("GTK", "gtk4")
765 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
766 var libs []uintptr
767 for _, libPath := range core.GetPaths("GTK") {
768 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
769 if err != nil {
770 panic(err)
771 }
772 libs = append(libs, lib)
773 }
774
775 core.PuregoSafeRegister(&xButtonsTypeGLibType, libs, "gtk_buttons_type_get_type")
776
777 core.PuregoSafeRegister(&xMessageDialogGLibType, libs, "gtk_message_dialog_get_type")
778
779 core.PuregoSafeRegister(&xNewMessageDialog, libs, "gtk_message_dialog_new")
780 core.PuregoSafeRegister(&xNewMessageDialogWithMarkup, libs, "gtk_message_dialog_new_with_markup")
781
782 core.PuregoSafeRegister(&xMessageDialogFormatSecondaryMarkup, libs, "gtk_message_dialog_format_secondary_markup")
783 core.PuregoSafeRegister(&xMessageDialogFormatSecondaryText, libs, "gtk_message_dialog_format_secondary_text")
784 core.PuregoSafeRegister(&xMessageDialogGetMessageArea, libs, "gtk_message_dialog_get_message_area")
785 core.PuregoSafeRegister(&xMessageDialogSetMarkup, libs, "gtk_message_dialog_set_markup")
786
787}