// Code generated by girgen. DO NOT EDIT.

package adw

import (
	"context"
	"runtime"
	"unsafe"

	"github.com/diamondburned/gotk4/pkg/core/gbox"
	"github.com/diamondburned/gotk4/pkg/core/gcancel"
	"github.com/diamondburned/gotk4/pkg/core/gextras"
	coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
	"github.com/diamondburned/gotk4/pkg/gio/v2"
	"github.com/diamondburned/gotk4/pkg/gtk/v4"
)

// #include <stdlib.h>
// #include <adwaita.h>
// #include <glib-object.h>
// extern void _gotk4_gio2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer);
// extern void _gotk4_adw1_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer);
// extern void _gotk4_adw1_AlertDialog_ConnectResponse(gpointer, gchar*, guintptr);
// extern void _gotk4_adw1_AlertDialogClass_response(AdwAlertDialog*, char*);
// void _gotk4_adw1_AlertDialog_virtual_response(void* fnptr, AdwAlertDialog* arg0, char* arg1) {
//   ((void (*)(AdwAlertDialog*, char*))(fnptr))(arg0, arg1);
// };
import "C"

// GType values.
var (
	GTypeAlertDialog = coreglib.Type(C.adw_alert_dialog_get_type())
)

func init() {
	coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
		coreglib.TypeMarshaler{T: GTypeAlertDialog, F: marshalAlertDialog},
	})
}

// AlertDialogOverrides contains methods that are overridable.
type AlertDialogOverrides struct {
	Response func(response string)
}

func defaultAlertDialogOverrides(v *AlertDialog) AlertDialogOverrides {
	return AlertDialogOverrides{
		Response: v.response,
	}
}

// AlertDialog: dialog presenting a message or a question.
//
// <picture> <source srcset="alert-dialog-dark.png"
// media="(prefers-color-scheme: dark)"> <img src="alert-dialog.png"
// alt="alert-dialog"> </picture>
//
// Alert dialogs have a heading, a body, an optional child widget, and one or
// multiple responses, each presented as a button.
//
// Each response has a unique string ID, and a button label. Additionally, each
// response can be enabled or disabled, and can have a suggested or destructive
// appearance.
//
// When one of the responses is activated, or the dialog is closed,
// the alertdialog::response signal will be emitted. This signal is detailed,
// and the detail, as well as the response parameter will be set to the ID of
// the activated response, or to the value of the alertdialog:close-response
// property if the dialog had been closed without activating any of the
// responses.
//
// Response buttons can be presented horizontally or vertically depending on
// available space.
//
// When a response is activated, AdwAlertDialog is closed automatically.
//
// An example of using an alert dialog:
//
//	AdwDialog *dialog;
//
//	dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
//
//	adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
//	                              _("A file named “s” already exists. Do you want to replace it?"),
//	                              filename);
//
//	adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
//	                                "cancel",  _("_Cancel"),
//	                                "replace", _("_Replace"),
//	                                NULL);
//
//	adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
//	                                          "replace",
//	                                          ADW_RESPONSE_DESTRUCTIVE);
//
//	adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
//	adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
//
//	g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
//
//	adw_dialog_present (dialog, parent);
//
// # Async API
//
// AdwAlertDialog can also be used via the alertdialog.Choose method. This API
// follows the GIO async pattern, for example:
//
//	static void
//	dialog_cb (AdwAlertDialog *dialog,
//	           GAsyncResult   *result,
//	           MyWindow       *self)
//	{
//	  const char *response = adw_alert_dialog_choose_finish (dialog, result);
//
//	  // ...
//	}
//
//	static void
//	show_dialog (MyWindow *self)
//	{
//	  AdwDialog *dialog;
//
//	  dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
//
//	  adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
//	                                _("A file named “s” already exists. Do you want to replace it?"),
//	                                filename);
//
//	  adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
//	                                  "cancel",  _("_Cancel"),
//	                                  "replace", _("_Replace"),
//	                                  NULL);
//
//	  adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
//	                                            "replace",
//	                                            ADW_RESPONSE_DESTRUCTIVE);
//
//	  adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
//	  adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
//
//	  adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self),
//	                           NULL, (GAsyncReadyCallback) dialog_cb, self);
//	}
//
// # AdwAlertDialog as GtkBuildable
//
// AdwAlertDialog supports adding responses in UI definitions by via the
// <responses> element that may contain multiple <response> elements, each
// representing a response.
//
// Each of the <response> elements must have the id attribute specifying the
// response ID. The contents of the element are used as the response label.
//
// Response labels can be translated with the usual translatable, context and
// comments attributes.
//
// The <response> elements can also have enabled and/or appearance attributes.
// See alertdialog.SetResponseEnabled and alertdialog.SetResponseAppearance for
// details.
//
// Example of an AdwAlertDialog UI definition:
//
//	<object class="AdwAlertDialog" id="dialog">
//	  <property name="heading" translatable="yes">Save Changes?</property>
//	  <property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
//	  <property name="default-response">save</property>
//	  <property name="close-response">cancel</property>
//	  <signal name="response" handler="response_cb"/>
//	  <responses>
//	    <response id="cancel" translatable="yes">_Cancel</response>
//	    <response id="discard" translatable="yes" appearance="destructive">_Discard</response>
//	    <response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
//	  </responses>
//	</object>.
type AlertDialog struct {
	_ [0]func() // equal guard
	Dialog
}

var (
	_ gtk.Widgetter     = (*AlertDialog)(nil)
	_ coreglib.Objector = (*AlertDialog)(nil)
)

func init() {
	coreglib.RegisterClassInfo[*AlertDialog, *AlertDialogClass, AlertDialogOverrides](
		GTypeAlertDialog,
		initAlertDialogClass,
		wrapAlertDialog,
		defaultAlertDialogOverrides,
	)
}

func initAlertDialogClass(gclass unsafe.Pointer, overrides AlertDialogOverrides, classInitFunc func(*AlertDialogClass)) {
	pclass := (*C.AdwAlertDialogClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeAlertDialog))))

	if overrides.Response != nil {
		pclass.response = (*[0]byte)(C._gotk4_adw1_AlertDialogClass_response)
	}

	if classInitFunc != nil {
		class := (*AlertDialogClass)(gextras.NewStructNative(gclass))
		classInitFunc(class)
	}
}

func wrapAlertDialog(obj *coreglib.Object) *AlertDialog {
	return &AlertDialog{
		Dialog: Dialog{
			Widget: gtk.Widget{
				InitiallyUnowned: coreglib.InitiallyUnowned{
					Object: obj,
				},
				Object: obj,
				Accessible: gtk.Accessible{
					Object: obj,
				},
				Buildable: gtk.Buildable{
					Object: obj,
				},
				ConstraintTarget: gtk.ConstraintTarget{
					Object: obj,
				},
			},
			Object: obj,
			ShortcutManager: gtk.ShortcutManager{
				Object: obj,
			},
		},
	}
}

func marshalAlertDialog(p uintptr) (interface{}, error) {
	return wrapAlertDialog(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}

// ConnectResponse: this signal is emitted when the dialog is closed.
//
// response will be set to the response ID of the button that had been
// activated.
//
// if the dialog was closed by pressing <kbd>Escape</kbd> or with a system
// action, response will be set to the value of alertdialog:close-response.
func (self *AlertDialog) ConnectResponse(f func(response string)) coreglib.SignalHandle {
	return coreglib.ConnectGeneratedClosure(self, "response", false, unsafe.Pointer(C._gotk4_adw1_AlertDialog_ConnectResponse), f)
}

// NewAlertDialog creates a new AdwAlertDialog.
//
// heading and body can be set to NULL. This can be useful if they need
// to be formatted or use markup. In that case, set them to NULL and call
// alertdialog.FormatBody or similar methods afterwards:
//
//	AdwDialog *dialog;
//
//	dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
//	adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
//	                              _("A file named “s” already exists.  Do you want to replace it?"),
//	                              filename);.
//
// The function takes the following parameters:
//
//   - heading (optional): heading.
//   - body (optional) text.
//
// The function returns the following values:
//
//   - alertDialog: newly created AdwAlertDialog.
func NewAlertDialog(heading, body string) *AlertDialog {
	var _arg1 *C.char      // out
	var _arg2 *C.char      // out
	var _cret *C.AdwDialog // in

	if heading != "" {
		_arg1 = (*C.char)(unsafe.Pointer(C.CString(heading)))
		defer C.free(unsafe.Pointer(_arg1))
	}
	if body != "" {
		_arg2 = (*C.char)(unsafe.Pointer(C.CString(body)))
		defer C.free(unsafe.Pointer(_arg2))
	}

	_cret = C.adw_alert_dialog_new(_arg1, _arg2)
	runtime.KeepAlive(heading)
	runtime.KeepAlive(body)

	var _alertDialog *AlertDialog // out

	_alertDialog = wrapAlertDialog(coreglib.Take(unsafe.Pointer(_cret)))

	return _alertDialog
}

// AddResponse adds a response with id and label to self.
//
// Responses are represented as buttons in the dialog.
//
// Response ID must be unique. It will be used in alertdialog::response to
// tell which response had been activated, as well as to inspect and modify the
// response later.
//
// An embedded underline in label indicates a mnemonic.
//
// alertdialog.SetResponseLabel can be used to change the response label after
// it had been added.
//
// alertdialog.SetResponseEnabled and alertdialog.SetResponseAppearance can be
// used to customize the responses further.
//
// The function takes the following parameters:
//
//   - id: response ID.
//   - label: response label.
func (self *AlertDialog) AddResponse(id, label string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out
	var _arg2 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(id)))
	defer C.free(unsafe.Pointer(_arg1))
	_arg2 = (*C.char)(unsafe.Pointer(C.CString(label)))
	defer C.free(unsafe.Pointer(_arg2))

	C.adw_alert_dialog_add_response(_arg0, _arg1, _arg2)
	runtime.KeepAlive(self)
	runtime.KeepAlive(id)
	runtime.KeepAlive(label)
}

// Choose: this function shows self to the user.
//
// If the window is an window or applicationwindow, the dialog will be shown
// within it. Otherwise, it will be a separate window.
//
// The function takes the following parameters:
//
//   - ctx (optional): GCancellable to cancel the operation.
//   - parent (optional) widget.
//   - callback (optional) to call when the operation is complete.
func (self *AlertDialog) Choose(ctx context.Context, parent gtk.Widgetter, callback gio.AsyncReadyCallback) {
	var _arg0 *C.AdwAlertDialog     // out
	var _arg2 *C.GCancellable       // out
	var _arg1 *C.GtkWidget          // out
	var _arg3 C.GAsyncReadyCallback // out
	var _arg4 C.gpointer

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	{
		cancellable := gcancel.GCancellableFromContext(ctx)
		defer runtime.KeepAlive(cancellable)
		_arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native()))
	}
	if parent != nil {
		_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(parent).Native()))
	}
	if callback != nil {
		_arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback)
		_arg4 = C.gpointer(gbox.AssignOnce(callback))
	}

	C.adw_alert_dialog_choose(_arg0, _arg1, _arg2, _arg3, _arg4)
	runtime.KeepAlive(self)
	runtime.KeepAlive(ctx)
	runtime.KeepAlive(parent)
	runtime.KeepAlive(callback)
}

// ChooseFinish finishes the alertdialog.Choose call and returns the response
// ID.
//
// The function takes the following parameters:
//
//   - result: GAsyncResult.
//
// The function returns the following values:
//
//   - utf8: ID of the response that was selected, or alertdialog:close-response
//     if the call was cancelled.
func (self *AlertDialog) ChooseFinish(result gio.AsyncResulter) string {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.GAsyncResult   // out
	var _cret *C.char           // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native()))

	_cret = C.adw_alert_dialog_choose_finish(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(result)

	var _utf8 string // out

	_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))

	return _utf8
}

// Body gets the body text of self.
//
// The function returns the following values:
//
//   - utf8: body of self.
func (self *AlertDialog) Body() string {
	var _arg0 *C.AdwAlertDialog // out
	var _cret *C.char           // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_body(_arg0)
	runtime.KeepAlive(self)

	var _utf8 string // out

	_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))

	return _utf8
}

// BodyUseMarkup gets whether the body text of self includes Pango markup.
//
// The function returns the following values:
//
//   - ok: whether self uses markup for body text.
func (self *AlertDialog) BodyUseMarkup() bool {
	var _arg0 *C.AdwAlertDialog // out
	var _cret C.gboolean        // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_body_use_markup(_arg0)
	runtime.KeepAlive(self)

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// CloseResponse gets the ID of the close response of self.
//
// The function returns the following values:
//
//   - utf8: close response ID.
func (self *AlertDialog) CloseResponse() string {
	var _arg0 *C.AdwAlertDialog // out
	var _cret *C.char           // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_close_response(_arg0)
	runtime.KeepAlive(self)

	var _utf8 string // out

	_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))

	return _utf8
}

// DefaultResponse gets the ID of the default response of self.
//
// The function returns the following values:
//
//   - utf8 (optional): default response ID.
func (self *AlertDialog) DefaultResponse() string {
	var _arg0 *C.AdwAlertDialog // out
	var _cret *C.char           // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_default_response(_arg0)
	runtime.KeepAlive(self)

	var _utf8 string // out

	if _cret != nil {
		_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))
	}

	return _utf8
}

// ExtraChild gets the child widget of self.
//
// The function returns the following values:
//
//   - widget (optional): child widget of self.
func (self *AlertDialog) ExtraChild() gtk.Widgetter {
	var _arg0 *C.AdwAlertDialog // out
	var _cret *C.GtkWidget      // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_extra_child(_arg0)
	runtime.KeepAlive(self)

	var _widget gtk.Widgetter // out

	if _cret != nil {
		{
			objptr := unsafe.Pointer(_cret)

			object := coreglib.Take(objptr)
			casted := object.WalkCast(func(obj coreglib.Objector) bool {
				_, ok := obj.(gtk.Widgetter)
				return ok
			})
			rv, ok := casted.(gtk.Widgetter)
			if !ok {
				panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter")
			}
			_widget = rv
		}
	}

	return _widget
}

// Heading gets the heading of self.
//
// The function returns the following values:
//
//   - utf8 (optional): heading of self.
func (self *AlertDialog) Heading() string {
	var _arg0 *C.AdwAlertDialog // out
	var _cret *C.char           // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_heading(_arg0)
	runtime.KeepAlive(self)

	var _utf8 string // out

	if _cret != nil {
		_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))
	}

	return _utf8
}

// HeadingUseMarkup gets whether the heading of self includes Pango markup.
//
// The function returns the following values:
//
//   - ok: whether self uses markup for heading.
func (self *AlertDialog) HeadingUseMarkup() bool {
	var _arg0 *C.AdwAlertDialog // out
	var _cret C.gboolean        // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_heading_use_markup(_arg0)
	runtime.KeepAlive(self)

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// PreferWideLayout gets whether self prefers wide layout.
//
// The function returns the following values:
//
//   - ok: whether to prefer wide layout.
func (self *AlertDialog) PreferWideLayout() bool {
	var _arg0 *C.AdwAlertDialog // out
	var _cret C.gboolean        // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))

	_cret = C.adw_alert_dialog_get_prefer_wide_layout(_arg0)
	runtime.KeepAlive(self)

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// ResponseAppearance gets the appearance of response.
//
// See alertdialog.SetResponseAppearance.
//
// The function takes the following parameters:
//
//   - response ID.
//
// The function returns the following values:
//
//   - responseAppearance: appearance of response.
func (self *AlertDialog) ResponseAppearance(response string) ResponseAppearance {
	var _arg0 *C.AdwAlertDialog       // out
	var _arg1 *C.char                 // out
	var _cret C.AdwResponseAppearance // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))

	_cret = C.adw_alert_dialog_get_response_appearance(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)

	var _responseAppearance ResponseAppearance // out

	_responseAppearance = ResponseAppearance(_cret)

	return _responseAppearance
}

// ResponseEnabled gets whether response is enabled.
//
// See alertdialog.SetResponseEnabled.
//
// The function takes the following parameters:
//
//   - response ID.
//
// The function returns the following values:
//
//   - ok: whether response is enabled.
func (self *AlertDialog) ResponseEnabled(response string) bool {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out
	var _cret C.gboolean        // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))

	_cret = C.adw_alert_dialog_get_response_enabled(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// ResponseLabel gets the label of response.
//
// See alertdialog.SetResponseLabel.
//
// The function takes the following parameters:
//
//   - response ID.
//
// The function returns the following values:
//
//   - utf8: label of response.
func (self *AlertDialog) ResponseLabel(response string) string {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out
	var _cret *C.char           // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))

	_cret = C.adw_alert_dialog_get_response_label(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)

	var _utf8 string // out

	_utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret)))

	return _utf8
}

// HasResponse gets whether self has a response with the ID response.
//
// The function takes the following parameters:
//
//   - response ID.
//
// The function returns the following values:
//
//   - ok: whether self has a response with the ID response.
func (self *AlertDialog) HasResponse(response string) bool {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out
	var _cret C.gboolean        // in

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))

	_cret = C.adw_alert_dialog_has_response(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)

	var _ok bool // out

	if _cret != 0 {
		_ok = true
	}

	return _ok
}

// RemoveResponse removes a response from self.
//
// The function takes the following parameters:
//
//   - id: response ID.
func (self *AlertDialog) RemoveResponse(id string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(id)))
	defer C.free(unsafe.Pointer(_arg1))

	C.adw_alert_dialog_remove_response(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(id)
}

// SetBody sets the body text of self.
//
// The function takes the following parameters:
//
//   - body of self.
func (self *AlertDialog) SetBody(body string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(body)))
	defer C.free(unsafe.Pointer(_arg1))

	C.adw_alert_dialog_set_body(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(body)
}

// SetBodyUseMarkup sets whether the body text of self includes Pango markup.
//
// See pango.ParseMarkup().
//
// The function takes the following parameters:
//
//   - useMarkup: whether to use markup for body text.
func (self *AlertDialog) SetBodyUseMarkup(useMarkup bool) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 C.gboolean        // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if useMarkup {
		_arg1 = C.TRUE
	}

	C.adw_alert_dialog_set_body_use_markup(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(useMarkup)
}

// SetCloseResponse sets the ID of the close response of self.
//
// It will be passed to alertdialog::response if the dialog is closed by
// pressing <kbd>Escape</kbd> or with a system action.
//
// It doesn't have to correspond to any of the responses in the dialog.
//
// The default close response is close.
//
// The function takes the following parameters:
//
//   - response: close response ID.
func (self *AlertDialog) SetCloseResponse(response string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))

	C.adw_alert_dialog_set_close_response(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)
}

// SetDefaultResponse sets the ID of the default response of self.
//
// If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
//
// If set to NULL or to a non-existent response ID, pressing <kbd>Enter</kbd>
// will do nothing.
//
// The function takes the following parameters:
//
//   - response (optional): default response ID.
func (self *AlertDialog) SetDefaultResponse(response string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if response != "" {
		_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
		defer C.free(unsafe.Pointer(_arg1))
	}

	C.adw_alert_dialog_set_default_response(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)
}

// SetExtraChild sets the child widget of self.
//
// The child widget is displayed below the heading and body.
//
// The function takes the following parameters:
//
//   - child (optional) widget.
func (self *AlertDialog) SetExtraChild(child gtk.Widgetter) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.GtkWidget      // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if child != nil {
		_arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native()))
	}

	C.adw_alert_dialog_set_extra_child(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(child)
}

// SetHeading sets the heading of self.
//
// The function takes the following parameters:
//
//   - heading (optional) of self.
func (self *AlertDialog) SetHeading(heading string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if heading != "" {
		_arg1 = (*C.char)(unsafe.Pointer(C.CString(heading)))
		defer C.free(unsafe.Pointer(_arg1))
	}

	C.adw_alert_dialog_set_heading(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(heading)
}

// SetHeadingUseMarkup sets whether the heading of self includes Pango markup.
//
// See pango.ParseMarkup().
//
// The function takes the following parameters:
//
//   - useMarkup: whether to use markup for heading.
func (self *AlertDialog) SetHeadingUseMarkup(useMarkup bool) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 C.gboolean        // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if useMarkup {
		_arg1 = C.TRUE
	}

	C.adw_alert_dialog_set_heading_use_markup(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(useMarkup)
}

// SetPreferWideLayout sets whether self prefers wide layout.
//
// Prefer horizontal button layout when possible, and wider dialog width
// otherwise.
//
// The function takes the following parameters:
//
//   - preferWideLayout: whether to prefer wide layout.
func (self *AlertDialog) SetPreferWideLayout(preferWideLayout bool) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 C.gboolean        // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	if preferWideLayout {
		_arg1 = C.TRUE
	}

	C.adw_alert_dialog_set_prefer_wide_layout(_arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(preferWideLayout)
}

// SetResponseAppearance sets the appearance for response.
//
// <picture> <source srcset="alert-dialog-appearance-dark.png"
// media="(prefers-color-scheme: dark)"> <img src="alert-dialog-appearance.png"
// alt="alert-dialog-appearance"> </picture>
//
// Use ADW_RESPONSE_SUGGESTED to mark important responses such as the
// affirmative action, like the Save button in the example.
//
// Use ADW_RESPONSE_DESTRUCTIVE to draw attention to the potentially damaging
// consequences of using response. This appearance acts as a warning to the
// user. The Discard button in the example is using this appearance.
//
// The default appearance is ADW_RESPONSE_DEFAULT.
//
// Negative responses like Cancel or Close should use the default appearance.
//
// The function takes the following parameters:
//
//   - response ID.
//   - appearance for response.
func (self *AlertDialog) SetResponseAppearance(response string, appearance ResponseAppearance) {
	var _arg0 *C.AdwAlertDialog       // out
	var _arg1 *C.char                 // out
	var _arg2 C.AdwResponseAppearance // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))
	_arg2 = C.AdwResponseAppearance(appearance)

	C.adw_alert_dialog_set_response_appearance(_arg0, _arg1, _arg2)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)
	runtime.KeepAlive(appearance)
}

// SetResponseEnabled sets whether response is enabled.
//
// If response is not enabled, the corresponding button will have
// gtk.Widget:sensitive set to FALSE and it can't be activated as a default
// response.
//
// response can still be used as alertdialog:close-response while it's not
// enabled.
//
// Responses are enabled by default.
//
// The function takes the following parameters:
//
//   - response ID.
//   - enabled: whether to enable response.
func (self *AlertDialog) SetResponseEnabled(response string, enabled bool) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out
	var _arg2 C.gboolean        // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))
	if enabled {
		_arg2 = C.TRUE
	}

	C.adw_alert_dialog_set_response_enabled(_arg0, _arg1, _arg2)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)
	runtime.KeepAlive(enabled)
}

// SetResponseLabel sets the label of response to label.
//
// Labels are displayed on the dialog buttons. An embedded underline in label
// indicates a mnemonic.
//
// The function takes the following parameters:
//
//   - response ID.
//   - label of response.
func (self *AlertDialog) SetResponseLabel(response, label string) {
	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out
	var _arg2 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))
	_arg2 = (*C.char)(unsafe.Pointer(C.CString(label)))
	defer C.free(unsafe.Pointer(_arg2))

	C.adw_alert_dialog_set_response_label(_arg0, _arg1, _arg2)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)
	runtime.KeepAlive(label)
}

func (self *AlertDialog) response(response string) {
	gclass := (*C.AdwAlertDialogClass)(coreglib.PeekParentClass(self))
	fnarg := gclass.response

	var _arg0 *C.AdwAlertDialog // out
	var _arg1 *C.char           // out

	_arg0 = (*C.AdwAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native()))
	_arg1 = (*C.char)(unsafe.Pointer(C.CString(response)))
	defer C.free(unsafe.Pointer(_arg1))

	C._gotk4_adw1_AlertDialog_virtual_response(unsafe.Pointer(fnarg), _arg0, _arg1)
	runtime.KeepAlive(self)
	runtime.KeepAlive(response)
}
