// 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;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class FindController : GLib.Object {

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

		protected FindController() : base(IntPtr.Zero)
		{
			CreateNativeObject (Array.Empty<string> (), Array.Empty<GLib.Value> ());
		}

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

		[GLib.Property ("max-match-count")]
		public uint MaxMatchCount {
			get  {
				uint raw_ret = webkit_find_controller_get_max_match_count(Handle);
				uint ret = raw_ret;
				return ret;
			}
		}

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

		[GLib.Property ("options")]
		public uint Options {
			get  {
				uint raw_ret = webkit_find_controller_get_options(Handle);
				uint ret = raw_ret;
				return ret;
			}
		}

		[GLib.Property ("text")]
		public string Text {
			get {
				GLib.Value val = GetProperty ("text");
				string ret = (string) val;
				val.Dispose ();
				return ret;
			}
		}

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

		[GLib.Property ("web-view")]
		public WebKit.WebView WebView {
			get  {
				IntPtr raw_ret = webkit_find_controller_get_web_view(Handle);
				WebKit.WebView ret = GLib.Object.GetObject(raw_ret) as WebKit.WebView;
				return ret;
			}
		}

		[GLib.Signal("counted-matches")]
		public event WebKit.CountedMatchesHandler CountedMatches {
			add {
				this.AddSignalHandler ("counted-matches", value, typeof (WebKit.CountedMatchesArgs));
			}
			remove {
				this.RemoveSignalHandler ("counted-matches", value);
			}
		}

		[GLib.Signal("found-text")]
		public event WebKit.FoundTextHandler FoundText {
			add {
				this.AddSignalHandler ("found-text", value, typeof (WebKit.FoundTextArgs));
			}
			remove {
				this.RemoveSignalHandler ("found-text", value);
			}
		}

		[GLib.Signal("failed-to-find-text")]
		public event System.EventHandler FailedToFindText {
			add {
				this.AddSignalHandler ("failed-to-find-text", value);
			}
			remove {
				this.RemoveSignalHandler ("failed-to-find-text", value);
			}
		}

		static CountedMatchesNativeDelegate CountedMatches_cb_delegate;
		static CountedMatchesNativeDelegate CountedMatchesVMCallback {
			get {
				if (CountedMatches_cb_delegate == null)
					CountedMatches_cb_delegate = new CountedMatchesNativeDelegate (CountedMatches_cb);
				return CountedMatches_cb_delegate;
			}
		}

		static void OverrideCountedMatches (GLib.GType gtype)
		{
			OverrideCountedMatches (gtype, CountedMatchesVMCallback);
		}

		static void OverrideCountedMatches (GLib.GType gtype, CountedMatchesNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "counted-matches", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void CountedMatchesNativeDelegate (IntPtr inst, uint match_count);

		static void CountedMatches_cb (IntPtr inst, uint match_count)
		{
			try {
				FindController __obj = GLib.Object.GetObject (inst, false) as FindController;
				__obj.OnCountedMatches (match_count);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.FindController), ConnectionMethod="OverrideCountedMatches")]
		protected virtual void OnCountedMatches (uint match_count)
		{
			InternalCountedMatches (match_count);
		}

		private void InternalCountedMatches (uint match_count)
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (match_count);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static FailedToFindTextNativeDelegate FailedToFindText_cb_delegate;
		static FailedToFindTextNativeDelegate FailedToFindTextVMCallback {
			get {
				if (FailedToFindText_cb_delegate == null)
					FailedToFindText_cb_delegate = new FailedToFindTextNativeDelegate (FailedToFindText_cb);
				return FailedToFindText_cb_delegate;
			}
		}

		static void OverrideFailedToFindText (GLib.GType gtype)
		{
			OverrideFailedToFindText (gtype, FailedToFindTextVMCallback);
		}

		static void OverrideFailedToFindText (GLib.GType gtype, FailedToFindTextNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "failed-to-find-text", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void FailedToFindTextNativeDelegate (IntPtr inst);

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

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.FindController), ConnectionMethod="OverrideFailedToFindText")]
		protected virtual void OnFailedToFindText ()
		{
			InternalFailedToFindText ();
		}

		private void InternalFailedToFindText ()
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
			GLib.Value[] vals = new GLib.Value [1];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}

		static FoundTextNativeDelegate FoundText_cb_delegate;
		static FoundTextNativeDelegate FoundTextVMCallback {
			get {
				if (FoundText_cb_delegate == null)
					FoundText_cb_delegate = new FoundTextNativeDelegate (FoundText_cb);
				return FoundText_cb_delegate;
			}
		}

		static void OverrideFoundText (GLib.GType gtype)
		{
			OverrideFoundText (gtype, FoundTextVMCallback);
		}

		static void OverrideFoundText (GLib.GType gtype, FoundTextNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "found-text", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void FoundTextNativeDelegate (IntPtr inst, uint match_count);

		static void FoundText_cb (IntPtr inst, uint match_count)
		{
			try {
				FindController __obj = GLib.Object.GetObject (inst, false) as FindController;
				__obj.OnFoundText (match_count);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.FindController), ConnectionMethod="OverrideFoundText")]
		protected virtual void OnFoundText (uint match_count)
		{
			InternalFoundText (match_count);
		}

		private void InternalFoundText (uint match_count)
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (2);
			GLib.Value[] vals = new GLib.Value [2];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (match_count);
			inst_and_params.Append (vals [1]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}


		// 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("_webkit_reserved0"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // _webkit_reserved0
							, null
							, "_webkit_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved1
							, "_webkit_reserved0"
							, "_webkit_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved2
							, "_webkit_reserved1"
							, "_webkit_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved3
							, "_webkit_reserved2"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_find_controller_count_matches(IntPtr raw, IntPtr search_text, uint find_options, uint max_match_count);
		static d_webkit_find_controller_count_matches webkit_find_controller_count_matches = FuncLoader.LoadFunction<d_webkit_find_controller_count_matches>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_find_controller_count_matches"));

		public void CountMatches(string search_text, uint find_options, uint max_match_count) {
			IntPtr native_search_text = GLib.Marshaller.StringToPtrGStrdup (search_text);
			webkit_find_controller_count_matches(Handle, native_search_text, find_options, max_match_count);
			GLib.Marshaller.Free (native_search_text);
		}

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

		public string SearchText { 
			get {
				IntPtr raw_ret = webkit_find_controller_get_search_text(Handle);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_find_controller_search(IntPtr raw, IntPtr search_text, uint find_options, uint max_match_count);
		static d_webkit_find_controller_search webkit_find_controller_search = FuncLoader.LoadFunction<d_webkit_find_controller_search>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_find_controller_search"));

		public void Search(string search_text, uint find_options, uint max_match_count) {
			IntPtr native_search_text = GLib.Marshaller.StringToPtrGStrdup (search_text);
			webkit_find_controller_search(Handle, native_search_text, find_options, max_match_count);
			GLib.Marshaller.Free (native_search_text);
		}

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

		public void SearchFinish() {
			webkit_find_controller_search_finish(Handle);
		}

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

		public void SearchNext() {
			webkit_find_controller_search_next(Handle);
		}

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

		public void SearchPrevious() {
			webkit_find_controller_search_previous(Handle);
		}


		static FindController ()
		{
			GtkSharp.WebkitGtkSharp.ObjectManager.Initialize ();
		}

		// 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"
							, GLib.Object.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
