// 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 GeolocationManager : GLib.Object {

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

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

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

		[GLib.Property ("enable-high-accuracy")]
		public bool EnableHighAccuracy {
			get  {
				bool raw_ret = webkit_geolocation_manager_get_enable_high_accuracy(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

		[GLib.Signal("start")]
		public event WebKit.StartHandler Start {
			add {
				this.AddSignalHandler ("start", value, typeof (WebKit.StartArgs));
			}
			remove {
				this.RemoveSignalHandler ("start", value);
			}
		}

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

		static StartNativeDelegate Start_cb_delegate;
		static StartNativeDelegate StartVMCallback {
			get {
				if (Start_cb_delegate == null)
					Start_cb_delegate = new StartNativeDelegate (Start_cb);
				return Start_cb_delegate;
			}
		}

		static void OverrideStart (GLib.GType gtype)
		{
			OverrideStart (gtype, StartVMCallback);
		}

		static void OverrideStart (GLib.GType gtype, StartNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "start", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool StartNativeDelegate (IntPtr inst);

		static bool Start_cb (IntPtr inst)
		{
			try {
				GeolocationManager __obj = GLib.Object.GetObject (inst, false) as GeolocationManager;
				bool __result;
				__result = __obj.OnStart ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.GeolocationManager), ConnectionMethod="OverrideStart")]
		protected virtual bool OnStart ()
		{
			return InternalStart ();
		}

		private bool InternalStart ()
		{
			GLib.Value ret = new GLib.Value (GLib.GType.Boolean);
			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 ();
			bool result = (bool) ret;
			ret.Dispose ();
			return result;
		}

		static StopNativeDelegate Stop_cb_delegate;
		static StopNativeDelegate StopVMCallback {
			get {
				if (Stop_cb_delegate == null)
					Stop_cb_delegate = new StopNativeDelegate (Stop_cb);
				return Stop_cb_delegate;
			}
		}

		static void OverrideStop (GLib.GType gtype)
		{
			OverrideStop (gtype, StopVMCallback);
		}

		static void OverrideStop (GLib.GType gtype, StopNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "stop", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void StopNativeDelegate (IntPtr inst);

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

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.GeolocationManager), ConnectionMethod="OverrideStop")]
		protected virtual void OnStop ()
		{
			InternalStop ();
		}

		private void InternalStop ()
		{
			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 ();
		}


		// 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_geolocation_manager_get_type();
		static d_webkit_geolocation_manager_get_type webkit_geolocation_manager_get_type = FuncLoader.LoadFunction<d_webkit_geolocation_manager_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_geolocation_manager_get_type"));

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

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

		public void Failed(string error_message) {
			IntPtr native_error_message = GLib.Marshaller.StringToPtrGStrdup (error_message);
			webkit_geolocation_manager_failed(Handle, native_error_message);
			GLib.Marshaller.Free (native_error_message);
		}

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

		public void UpdatePosition(WebKit.GeolocationPosition position) {
			webkit_geolocation_manager_update_position(Handle, position == null ? IntPtr.Zero : position.Handle);
		}


		static GeolocationManager ()
		{
			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
	}
}
