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

namespace WebKit {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	[StructLayout(LayoutKind.Sequential)]
	public partial struct ScriptDialog : IEquatable<ScriptDialog> {


		public static WebKit.ScriptDialog Zero = new WebKit.ScriptDialog ();

		public static WebKit.ScriptDialog New(IntPtr raw) {
			if (raw == IntPtr.Zero)
				return WebKit.ScriptDialog.Zero;
			return (WebKit.ScriptDialog) Marshal.PtrToStructure (raw, typeof (WebKit.ScriptDialog));
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_script_dialog_get_type();
		static d_webkit_script_dialog_get_type webkit_script_dialog_get_type = FuncLoader.LoadFunction<d_webkit_script_dialog_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_script_dialog_get_type"));

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_script_dialog_close(IntPtr raw);
		static d_webkit_script_dialog_close webkit_script_dialog_close = FuncLoader.LoadFunction<d_webkit_script_dialog_close>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_script_dialog_close"));

		public void Close() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			webkit_script_dialog_close(this_as_native);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_script_dialog_confirm_set_confirmed(IntPtr raw, bool confirmed);
		static d_webkit_script_dialog_confirm_set_confirmed webkit_script_dialog_confirm_set_confirmed = FuncLoader.LoadFunction<d_webkit_script_dialog_confirm_set_confirmed>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_script_dialog_confirm_set_confirmed"));

		public void ConfirmSetConfirmed(bool confirmed) {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			webkit_script_dialog_confirm_set_confirmed(this_as_native, confirmed);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

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

		public WebKit.ScriptDialogType DialogType { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				int raw_ret = webkit_script_dialog_get_dialog_type(this_as_native);
				WebKit.ScriptDialogType ret = (WebKit.ScriptDialogType) raw_ret;
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

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

		public string Message { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				IntPtr raw_ret = webkit_script_dialog_get_message(this_as_native);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

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

		public string PromptGetDefaultText() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr raw_ret = webkit_script_dialog_prompt_get_default_text(this_as_native);
			string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_script_dialog_prompt_set_text(IntPtr raw, IntPtr text);
		static d_webkit_script_dialog_prompt_set_text webkit_script_dialog_prompt_set_text = FuncLoader.LoadFunction<d_webkit_script_dialog_prompt_set_text>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_script_dialog_prompt_set_text"));

		public void PromptSetText(string text) {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
			webkit_script_dialog_prompt_set_text(this_as_native, native_text);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			GLib.Marshaller.Free (native_text);
		}

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

		public WebKit.ScriptDialog Ref() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr raw_ret = webkit_script_dialog_ref(this_as_native);
			WebKit.ScriptDialog ret = WebKit.ScriptDialog.New (raw_ret);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_script_dialog_unref(IntPtr raw);
		static d_webkit_script_dialog_unref webkit_script_dialog_unref = FuncLoader.LoadFunction<d_webkit_script_dialog_unref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_script_dialog_unref"));

		public void Unref() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.ScriptDialog>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			webkit_script_dialog_unref(this_as_native);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

		static void ReadNative (IntPtr native, ref WebKit.ScriptDialog target)
		{
			target = New (native);
		}

		public bool Equals (ScriptDialog other)
		{
			return true;
		}

		public override bool Equals (object other)
		{
			return other is ScriptDialog && Equals ((ScriptDialog) other);
		}

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode ();
		}

		public static explicit operator GLib.Value (WebKit.ScriptDialog boxed)
		{
			GLib.Value val = GLib.Value.Empty;
			val.Init (WebKit.ScriptDialog.GType);
			val.Val = boxed;
			return val;
		}

		public static explicit operator WebKit.ScriptDialog (GLib.Value val)
		{
			return (WebKit.ScriptDialog) val.Val;
		}
#endregion
	}
}
