// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gtk {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class Dialog : Gtk.Window {

		public Dialog (IntPtr raw) : base(raw) {}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_new();
		static d_gtk_dialog_new gtk_dialog_new = FuncLoader.LoadFunction<d_gtk_dialog_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_new"));

		public Dialog () : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Dialog)) {
				CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
				return;
			}
			Raw = gtk_dialog_new();
		}

		public int ContentAreaBorder {
			get {
				var val = (int)StyleGetProperty("content-area-border");
				return val;
			}
		}

		public int ContentAreaSpacing {
			get {
				var val = (int)StyleGetProperty("content-area-spacing");
				return val;
			}
		}

		public int ButtonSpacing {
			get {
				var val = (int)StyleGetProperty("button-spacing");
				return val;
			}
		}

		public int ActionAreaBorder {
			get {
				var val = (int)StyleGetProperty("action-area-border");
				return val;
			}
		}

		[GLib.Property ("use-header-bar")]
		public int UseHeaderBar {
			get {
				GLib.Value val = GetProperty ("use-header-bar");
				int ret = (int) val;
				val.Dispose ();
				return ret;
			}
		}

		[GLib.Signal("close")]
		public event System.EventHandler Close {
			add {
				this.AddSignalHandler ("close", value);
			}
			remove {
				this.RemoveSignalHandler ("close", value);
			}
		}

		[GLib.Signal("response")]
		public event Gtk.ResponseHandler Response {
			add {
				this.AddSignalHandler ("response", value, typeof (Gtk.ResponseArgs));
			}
			remove {
				this.RemoveSignalHandler ("response", value);
			}
		}

		static ResponseNativeDelegate Response_cb_delegate;
		static ResponseNativeDelegate ResponseVMCallback {
			get {
				if (Response_cb_delegate == null)
					Response_cb_delegate = new ResponseNativeDelegate (Response_cb);
				return Response_cb_delegate;
			}
		}

		static void OverrideResponse (GLib.GType gtype)
		{
			OverrideResponse (gtype, ResponseVMCallback);
		}

		static void OverrideResponse (GLib.GType gtype, ResponseNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("response"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void ResponseNativeDelegate (IntPtr inst, int response_id);

		static void Response_cb (IntPtr inst, int response_id)
		{
			try {
				Dialog __obj = GLib.Object.GetObject (inst, false) as Dialog;
				__obj.OnResponse ((Gtk.ResponseType) response_id);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Dialog), ConnectionMethod="OverrideResponse")]
		protected virtual void OnResponse (Gtk.ResponseType response_id)
		{
			InternalResponse (response_id);
		}

		private void InternalResponse (Gtk.ResponseType response_id)
		{
			ResponseNativeDelegate unmanaged = class_abi.BaseOverride<ResponseNativeDelegate>(this.LookupGType(), "response");
			if (unmanaged == null) return;

			unmanaged (this.Handle, (int) response_id);
		}

		static CloseNativeDelegate Close_cb_delegate;
		static CloseNativeDelegate CloseVMCallback {
			get {
				if (Close_cb_delegate == null)
					Close_cb_delegate = new CloseNativeDelegate (Close_cb);
				return Close_cb_delegate;
			}
		}

		static void OverrideClose (GLib.GType gtype)
		{
			OverrideClose (gtype, CloseVMCallback);
		}

		static void OverrideClose (GLib.GType gtype, CloseNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("close"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void CloseNativeDelegate (IntPtr inst);

		static void Close_cb (IntPtr inst)
		{
			try {
				Dialog __obj = GLib.Object.GetObject (inst, false) as Dialog;
				__obj.OnClose ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Dialog), ConnectionMethod="OverrideClose")]
		protected virtual void OnClose ()
		{
			InternalClose ();
		}

		private void InternalClose ()
		{
			CloseNativeDelegate unmanaged = class_abi.BaseOverride<CloseNativeDelegate>(this.LookupGType(), "close");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("response"
							, Gtk.Window.class_abi.Fields
							, (uint) sizeof( IntPtr ) // response
							, null
							, "close"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("close"
							, -1
							, (uint) sizeof( IntPtr ) // close
							, "response"
							, "_gtk_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved1
							, "close"
							, "_gtk_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved2
							, "_gtk_reserved1"
							, "_gtk_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved3
							, "_gtk_reserved2"
							, "_gtk_reserved4"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved4"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved4
							, "_gtk_reserved3"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_dialog_add_action_widget(IntPtr raw, IntPtr child, int response_id);
		static d_gtk_dialog_add_action_widget gtk_dialog_add_action_widget = FuncLoader.LoadFunction<d_gtk_dialog_add_action_widget>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_add_action_widget"));

		public void AddActionWidget(Gtk.Widget child, int response_id) {
			gtk_dialog_add_action_widget(Handle, child == null ? IntPtr.Zero : child.Handle, response_id);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_add_button(IntPtr raw, IntPtr button_text, int response_id);
		static d_gtk_dialog_add_button gtk_dialog_add_button = FuncLoader.LoadFunction<d_gtk_dialog_add_button>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_add_button"));

		public Gtk.Widget AddButton(string button_text, int response_id) {
			IntPtr native_button_text = GLib.Marshaller.StringToPtrGStrdup (button_text);
			IntPtr raw_ret = gtk_dialog_add_button(Handle, native_button_text, response_id);
			Gtk.Widget ret = GLib.Object.GetObject(raw_ret) as Gtk.Widget;
			GLib.Marshaller.Free (native_button_text);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_get_action_area(IntPtr raw);
		static d_gtk_dialog_get_action_area gtk_dialog_get_action_area = FuncLoader.LoadFunction<d_gtk_dialog_get_action_area>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_get_action_area"));

		[Obsolete]
		public Gtk.ButtonBox ActionArea { 
			get {
				IntPtr raw_ret = gtk_dialog_get_action_area(Handle);
				Gtk.ButtonBox ret = GLib.Object.GetObject(raw_ret) as Gtk.ButtonBox;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_get_content_area(IntPtr raw);
		static d_gtk_dialog_get_content_area gtk_dialog_get_content_area = FuncLoader.LoadFunction<d_gtk_dialog_get_content_area>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_get_content_area"));

		public Gtk.Box ContentArea { 
			get {
				IntPtr raw_ret = gtk_dialog_get_content_area(Handle);
				Gtk.Box ret = GLib.Object.GetObject(raw_ret) as Gtk.Box;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_get_header_bar(IntPtr raw);
		static d_gtk_dialog_get_header_bar gtk_dialog_get_header_bar = FuncLoader.LoadFunction<d_gtk_dialog_get_header_bar>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_get_header_bar"));

		public Gtk.Widget HeaderBar { 
			get {
				IntPtr raw_ret = gtk_dialog_get_header_bar(Handle);
				Gtk.Widget ret = GLib.Object.GetObject(raw_ret) as Gtk.Widget;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_gtk_dialog_get_response_for_widget(IntPtr raw, IntPtr widget);
		static d_gtk_dialog_get_response_for_widget gtk_dialog_get_response_for_widget = FuncLoader.LoadFunction<d_gtk_dialog_get_response_for_widget>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_get_response_for_widget"));

		public int GetResponseForWidget(Gtk.Widget widget) {
			int raw_ret = gtk_dialog_get_response_for_widget(Handle, widget == null ? IntPtr.Zero : widget.Handle);
			int ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_get_type();
		static d_gtk_dialog_get_type gtk_dialog_get_type = FuncLoader.LoadFunction<d_gtk_dialog_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_get_type"));

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = gtk_dialog_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_dialog_get_widget_for_response(IntPtr raw, int response_id);
		static d_gtk_dialog_get_widget_for_response gtk_dialog_get_widget_for_response = FuncLoader.LoadFunction<d_gtk_dialog_get_widget_for_response>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_get_widget_for_response"));

		public Gtk.Widget GetWidgetForResponse(int response_id) {
			IntPtr raw_ret = gtk_dialog_get_widget_for_response(Handle, response_id);
			Gtk.Widget ret = GLib.Object.GetObject(raw_ret) as Gtk.Widget;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_dialog_response(IntPtr raw, int response_id);
		static d_gtk_dialog_response gtk_dialog_response = FuncLoader.LoadFunction<d_gtk_dialog_response>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_response"));

		public void Respond(int response_id) {
			gtk_dialog_response(Handle, response_id);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_gtk_dialog_run(IntPtr raw);
		static d_gtk_dialog_run gtk_dialog_run = FuncLoader.LoadFunction<d_gtk_dialog_run>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_run"));

		public int Run() {
			int raw_ret = gtk_dialog_run(Handle);
			int ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_dialog_set_alternative_button_order_from_array(IntPtr raw, int n_params, int[] new_order);
		static d_gtk_dialog_set_alternative_button_order_from_array gtk_dialog_set_alternative_button_order_from_array = FuncLoader.LoadFunction<d_gtk_dialog_set_alternative_button_order_from_array>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_set_alternative_button_order_from_array"));

		[Obsolete]
		public int[] AlternativeButtonOrder { 
			set {
				gtk_dialog_set_alternative_button_order_from_array(Handle, (value == null ? 0 : value.Length), value);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_dialog_set_default_response(IntPtr raw, int response_id);
		static d_gtk_dialog_set_default_response gtk_dialog_set_default_response = FuncLoader.LoadFunction<d_gtk_dialog_set_default_response>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_set_default_response"));

		public Gtk.ResponseType DefaultResponse { 
			set {
				gtk_dialog_set_default_response(Handle, (int) value);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_dialog_set_response_sensitive(IntPtr raw, int response_id, bool setting);
		static d_gtk_dialog_set_response_sensitive gtk_dialog_set_response_sensitive = FuncLoader.LoadFunction<d_gtk_dialog_set_response_sensitive>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_dialog_set_response_sensitive"));

		public void SetResponseSensitive(Gtk.ResponseType response_id, bool setting) {
			gtk_dialog_set_response_sensitive(Handle, (int) response_id, setting);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
						new GLib.AbiField("priv"
							, Gtk.Window.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
