// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gtk import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gio" "github.com/bnema/puregotk/v4/glib" "github.com/bnema/puregotk/v4/gobject" "github.com/bnema/puregotk/v4/gobject/types" ) type AlertDialogClass struct { _ structs.HostLayout ParentClass gobject.ObjectClass } func (x *AlertDialogClass) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } // Collects the arguments that are needed to present a message to the user. // // The message is shown with the [method@Gtk.AlertDialog.choose] // function. // // If you don't need to wait for a button to be clicked, you can use // [method@Gtk.AlertDialog.show]. type AlertDialog struct { gobject.Object } var xAlertDialogGLibType func() types.GType func AlertDialogGLibType() types.GType { return xAlertDialogGLibType() } func AlertDialogNewFromInternalPtr(ptr uintptr) *AlertDialog { cls := &AlertDialog{} cls.Ptr = ptr return cls } var xNewAlertDialog func(string, ...interface{}) uintptr // Creates a new `GtkAlertDialog` object. // // The message will be set to the formatted string // resulting from the arguments. func NewAlertDialog(FormatVar string, varArgs ...interface{}) *AlertDialog { var cls *AlertDialog cret := xNewAlertDialog(FormatVar, varArgs...) if cret == 0 { return nil } cls = &AlertDialog{} cls.Ptr = cret return cls } var xAlertDialogChoose func(uintptr, uintptr, uintptr, uintptr, uintptr) // Shows the alert to the user. // // It is ok to pass `NULL` for the callback if the alert // does not have more than one button. A simpler API for // this case is [method@Gtk.AlertDialog.show]. func (x *AlertDialog) Choose(ParentVar *Window, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { var CallbackVarRef uintptr if CallbackVar != nil { CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar)) if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok { CallbackVarRef = cbRefPtr } else { fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) { cbFn := *CallbackVar cbFn(arg0, arg1, arg2) } CallbackVarRef = purego.NewCallback(fcb) glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar) } } xAlertDialogChoose(x.GoPointer(), ParentVar.GoPointer(), CancellableVar.GoPointer(), CallbackVarRef, UserDataVar) } var xAlertDialogChooseFinish func(uintptr, uintptr, **glib.Error) int // Finishes the [method@Gtk.AlertDialog.choose] call. func (x *AlertDialog) ChooseFinish(ResultVar gio.AsyncResult) (int, error) { var cerr *glib.Error cret := xAlertDialogChooseFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xAlertDialogGetButtons func(uintptr) []string // Returns the button labels for the alert. func (x *AlertDialog) GetButtons() []string { cret := xAlertDialogGetButtons(x.GoPointer()) return cret } var xAlertDialogGetCancelButton func(uintptr) int // Returns the index of the cancel button. func (x *AlertDialog) GetCancelButton() int { cret := xAlertDialogGetCancelButton(x.GoPointer()) return cret } var xAlertDialogGetDefaultButton func(uintptr) int // Returns the index of the default button. func (x *AlertDialog) GetDefaultButton() int { cret := xAlertDialogGetDefaultButton(x.GoPointer()) return cret } var xAlertDialogGetDetail func(uintptr) string // Returns the detail text that will be shown in the alert. func (x *AlertDialog) GetDetail() string { cret := xAlertDialogGetDetail(x.GoPointer()) return cret } var xAlertDialogGetMessage func(uintptr) string // Returns the message that will be shown in the alert. func (x *AlertDialog) GetMessage() string { cret := xAlertDialogGetMessage(x.GoPointer()) return cret } var xAlertDialogGetModal func(uintptr) bool // Returns whether the alert blocks interaction // with the parent window while it is presented. func (x *AlertDialog) GetModal() bool { cret := xAlertDialogGetModal(x.GoPointer()) return cret } var xAlertDialogSetButtons func(uintptr, []string) // Sets the button labels for the alert. func (x *AlertDialog) SetButtons(LabelsVar []string) { xAlertDialogSetButtons(x.GoPointer(), LabelsVar) } var xAlertDialogSetCancelButton func(uintptr, int) // Sets the index of the cancel button. // // See [property@Gtk.AlertDialog:cancel-button] for // details of how this value is used. func (x *AlertDialog) SetCancelButton(ButtonVar int) { xAlertDialogSetCancelButton(x.GoPointer(), ButtonVar) } var xAlertDialogSetDefaultButton func(uintptr, int) // Sets the index of the default button. // // See [property@Gtk.AlertDialog:default-button] for // details of how this value is used. func (x *AlertDialog) SetDefaultButton(ButtonVar int) { xAlertDialogSetDefaultButton(x.GoPointer(), ButtonVar) } var xAlertDialogSetDetail func(uintptr, string) // Sets the detail text that will be shown in the alert. func (x *AlertDialog) SetDetail(DetailVar string) { xAlertDialogSetDetail(x.GoPointer(), DetailVar) } var xAlertDialogSetMessage func(uintptr, string) // Sets the message that will be shown in the alert. func (x *AlertDialog) SetMessage(MessageVar string) { xAlertDialogSetMessage(x.GoPointer(), MessageVar) } var xAlertDialogSetModal func(uintptr, bool) // Sets whether the alert blocks interaction // with the parent window while it is presented. func (x *AlertDialog) SetModal(ModalVar bool) { xAlertDialogSetModal(x.GoPointer(), ModalVar) } var xAlertDialogShow func(uintptr, uintptr) // Shows the alert to the user. // // This function is a simpler version of [method@Gtk.AlertDialog.choose] // intended for dialogs with a single button. // // If you want to cancel the dialog or if the alert has more than one // button, you should use that function instead and provide it with a // [class@Gio.Cancellable] and callback respectively. func (x *AlertDialog) Show(ParentVar *Window) { xAlertDialogShow(x.GoPointer(), ParentVar.GoPointer()) } func (c *AlertDialog) GoPointer() uintptr { if c == nil { return 0 } return c.Ptr } func (c *AlertDialog) SetGoPointer(ptr uintptr) { c.Ptr = ptr } // SetPropertyButtons sets the "buttons" property. // Labels for buttons to show in the alert. // // The labels should be translated and may contain // a `_` character to indicate the mnemonic character. // // If this property is not set, then a 'Close' button is // automatically created. func (x *AlertDialog) SetPropertyButtons(value []string) { var v gobject.Value v.Init(glib.StrvGetType()) v.SetBoxed(uintptr(unsafe.Pointer(core.ByteSlice(value)))) x.SetProperty("buttons", &v) } // GetPropertyButtons gets the "buttons" property. // Labels for buttons to show in the alert. // // The labels should be translated and may contain // a `_` character to indicate the mnemonic character. // // If this property is not set, then a 'Close' button is // automatically created. func (x *AlertDialog) GetPropertyButtons() []string { var v gobject.Value x.GetProperty("buttons", &v) return core.GoStringSlice(v.GetBoxed()) } // SetPropertyCancelButton sets the "cancel-button" property. // Determines what happens when the <kbd>Escape</kbd> key is pressed // while the alert is shown. // // If this property holds the index of a button in [property@Gtk.AlertDialog:buttons], // then pressing Escape is treated as if that button was pressed. If it is -1 // or not a valid index for the `buttons` array, then an error is returned. // // If `buttons` is `NULL`, then the automatically created 'Close' button // is treated as both cancel and default button, so 0 is returned. func (x *AlertDialog) SetPropertyCancelButton(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("cancel-button", &v) } // GetPropertyCancelButton gets the "cancel-button" property. // Determines what happens when the <kbd>Escape</kbd> key is pressed // while the alert is shown. // // If this property holds the index of a button in [property@Gtk.AlertDialog:buttons], // then pressing Escape is treated as if that button was pressed. If it is -1 // or not a valid index for the `buttons` array, then an error is returned. // // If `buttons` is `NULL`, then the automatically created 'Close' button // is treated as both cancel and default button, so 0 is returned. func (x *AlertDialog) GetPropertyCancelButton() int { var v gobject.Value x.GetProperty("cancel-button", &v) return v.GetInt() } // SetPropertyDefaultButton sets the "default-button" property. // Determines what happens when the <kbd>Return</kbd> key is pressed // while the alert is shown. // // If this property holds the index of a button in [property@Gtk.AlertDialog:buttons], // then pressing Return is treated as if that button was pressed. If it is -1 // or not a valid index for the `buttons` array, then nothing happens. // // If `buttons` is `NULL`, then the automatically created 'Close' button // is treated as both cancel and default button, so 0 is returned. func (x *AlertDialog) SetPropertyDefaultButton(value int) { var v gobject.Value v.Init(gobject.TypeIntVal) v.SetInt(value) x.SetProperty("default-button", &v) } // GetPropertyDefaultButton gets the "default-button" property. // Determines what happens when the <kbd>Return</kbd> key is pressed // while the alert is shown. // // If this property holds the index of a button in [property@Gtk.AlertDialog:buttons], // then pressing Return is treated as if that button was pressed. If it is -1 // or not a valid index for the `buttons` array, then nothing happens. // // If `buttons` is `NULL`, then the automatically created 'Close' button // is treated as both cancel and default button, so 0 is returned. func (x *AlertDialog) GetPropertyDefaultButton() int { var v gobject.Value x.GetProperty("default-button", &v) return v.GetInt() } // SetPropertyDetail sets the "detail" property. // The detail text for the alert. func (x *AlertDialog) SetPropertyDetail(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("detail", &v) } // GetPropertyDetail gets the "detail" property. // The detail text for the alert. func (x *AlertDialog) GetPropertyDetail() string { var v gobject.Value x.GetProperty("detail", &v) return v.GetString() } // SetPropertyMessage sets the "message" property. // The message for the alert. func (x *AlertDialog) SetPropertyMessage(value string) { var v gobject.Value v.Init(gobject.TypeStringVal) v.SetString(&value) x.SetProperty("message", &v) } // GetPropertyMessage gets the "message" property. // The message for the alert. func (x *AlertDialog) GetPropertyMessage() string { var v gobject.Value x.GetProperty("message", &v) return v.GetString() } // SetPropertyModal sets the "modal" property. // Whether the alert is modal. func (x *AlertDialog) SetPropertyModal(value bool) { var v gobject.Value v.Init(gobject.TypeBooleanVal) v.SetBoolean(value) x.SetProperty("modal", &v) } // GetPropertyModal gets the "modal" property. // Whether the alert is modal. func (x *AlertDialog) GetPropertyModal() bool { var v gobject.Value x.GetProperty("modal", &v) return v.GetBoolean() } func init() { core.SetPackageName("GTK", "gtk4") core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"}) var libs []uintptr for _, libPath := range core.GetPaths("GTK") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xAlertDialogGLibType, libs, "gtk_alert_dialog_get_type") core.PuregoSafeRegister(&xNewAlertDialog, libs, "gtk_alert_dialog_new") core.PuregoSafeRegister(&xAlertDialogChoose, libs, "gtk_alert_dialog_choose") core.PuregoSafeRegister(&xAlertDialogChooseFinish, libs, "gtk_alert_dialog_choose_finish") core.PuregoSafeRegister(&xAlertDialogGetButtons, libs, "gtk_alert_dialog_get_buttons") core.PuregoSafeRegister(&xAlertDialogGetCancelButton, libs, "gtk_alert_dialog_get_cancel_button") core.PuregoSafeRegister(&xAlertDialogGetDefaultButton, libs, "gtk_alert_dialog_get_default_button") core.PuregoSafeRegister(&xAlertDialogGetDetail, libs, "gtk_alert_dialog_get_detail") core.PuregoSafeRegister(&xAlertDialogGetMessage, libs, "gtk_alert_dialog_get_message") core.PuregoSafeRegister(&xAlertDialogGetModal, libs, "gtk_alert_dialog_get_modal") core.PuregoSafeRegister(&xAlertDialogSetButtons, libs, "gtk_alert_dialog_set_buttons") core.PuregoSafeRegister(&xAlertDialogSetCancelButton, libs, "gtk_alert_dialog_set_cancel_button") core.PuregoSafeRegister(&xAlertDialogSetDefaultButton, libs, "gtk_alert_dialog_set_default_button") core.PuregoSafeRegister(&xAlertDialogSetDetail, libs, "gtk_alert_dialog_set_detail") core.PuregoSafeRegister(&xAlertDialogSetMessage, libs, "gtk_alert_dialog_set_message") core.PuregoSafeRegister(&xAlertDialogSetModal, libs, "gtk_alert_dialog_set_modal") core.PuregoSafeRegister(&xAlertDialogShow, libs, "gtk_alert_dialog_show") }