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

namespace Atk {

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

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

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

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

		static AddKeyEventListenerNativeDelegate AddKeyEventListener_cb_delegate;
		static AddKeyEventListenerNativeDelegate AddKeyEventListenerVMCallback {
			get {
				if (AddKeyEventListener_cb_delegate == null)
					AddKeyEventListener_cb_delegate = new AddKeyEventListenerNativeDelegate (AddKeyEventListener_cb);
				return AddKeyEventListener_cb_delegate;
			}
		}

		public delegate uint AddKeyEventListenerDelegate (Atk.KeySnoopFunc listener);
		static AddKeyEventListenerDelegate add_key_event_listener_handler;

		public static AddKeyEventListenerDelegate AddKeyEventListenerHandler {
			set {
				add_key_event_listener_handler = value;
				OverrideAddKeyEventListener ((GLib.GType) typeof (Util), value == null ? null : AddKeyEventListenerVMCallback);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate uint AddKeyEventListenerNativeDelegate (AtkSharp.KeySnoopFuncNative listener, IntPtr data);

		static uint AddKeyEventListener_cb (AtkSharp.KeySnoopFuncNative listener, IntPtr data)
		{
			try {
				uint __result;
				AtkSharp.KeySnoopFuncInvoker listener_invoker = new AtkSharp.KeySnoopFuncInvoker (listener, data);
				__result = add_key_event_listener_handler (listener_invoker.Handler);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		static GetRootNativeDelegate GetRoot_cb_delegate;
		static GetRootNativeDelegate GetRootVMCallback {
			get {
				if (GetRoot_cb_delegate == null)
					GetRoot_cb_delegate = new GetRootNativeDelegate (GetRoot_cb);
				return GetRoot_cb_delegate;
			}
		}

		public delegate Atk.Object GetRootDelegate ();
		static GetRootDelegate get_root_handler;

		public static GetRootDelegate GetRootHandler {
			set {
				get_root_handler = value;
				OverrideGetRoot ((GLib.GType) typeof (Util), value == null ? null : GetRootVMCallback);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetRootNativeDelegate ();

		static IntPtr GetRoot_cb ()
		{
			try {
				Atk.Object __result;
				__result = get_root_handler ();
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		static GetToolkitNameNativeDelegate GetToolkitName_cb_delegate;
		static GetToolkitNameNativeDelegate GetToolkitNameVMCallback {
			get {
				if (GetToolkitName_cb_delegate == null)
					GetToolkitName_cb_delegate = new GetToolkitNameNativeDelegate (GetToolkitName_cb);
				return GetToolkitName_cb_delegate;
			}
		}

		public delegate string GetToolkitNameDelegate ();
		static GetToolkitNameDelegate get_toolkit_name_handler;

		public static GetToolkitNameDelegate GetToolkitNameHandler {
			set {
				get_toolkit_name_handler = value;
				OverrideGetToolkitName ((GLib.GType) typeof (Util), value == null ? null : GetToolkitNameVMCallback);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetToolkitNameNativeDelegate ();

		static IntPtr GetToolkitName_cb ()
		{
			try {
				string __result;
				__result = get_toolkit_name_handler ();
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		static GetToolkitVersionNativeDelegate GetToolkitVersion_cb_delegate;
		static GetToolkitVersionNativeDelegate GetToolkitVersionVMCallback {
			get {
				if (GetToolkitVersion_cb_delegate == null)
					GetToolkitVersion_cb_delegate = new GetToolkitVersionNativeDelegate (GetToolkitVersion_cb);
				return GetToolkitVersion_cb_delegate;
			}
		}

		public delegate string GetToolkitVersionDelegate ();
		static GetToolkitVersionDelegate get_toolkit_version_handler;

		public static GetToolkitVersionDelegate GetToolkitVersionHandler {
			set {
				get_toolkit_version_handler = value;
				OverrideGetToolkitVersion ((GLib.GType) typeof (Util), value == null ? null : GetToolkitVersionVMCallback);
			}
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetToolkitVersionNativeDelegate ();

		static IntPtr GetToolkitVersion_cb ()
		{
			try {
				string __result;
				__result = get_toolkit_version_handler ();
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}


		// 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("add_global_event_listener"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // add_global_event_listener
							, null
							, "remove_global_event_listener"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("remove_global_event_listener"
							, -1
							, (uint) sizeof( IntPtr ) // remove_global_event_listener
							, "add_global_event_listener"
							, "add_key_event_listener"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("add_key_event_listener"
							, -1
							, (uint) sizeof( IntPtr ) // add_key_event_listener
							, "remove_global_event_listener"
							, "remove_key_event_listener"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("remove_key_event_listener"
							, -1
							, (uint) sizeof( IntPtr ) // remove_key_event_listener
							, "add_key_event_listener"
							, "get_root"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("get_root"
							, -1
							, (uint) sizeof( IntPtr ) // get_root
							, "remove_key_event_listener"
							, "get_toolkit_name"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("get_toolkit_name"
							, -1
							, (uint) sizeof( IntPtr ) // get_toolkit_name
							, "get_root"
							, "get_toolkit_version"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("get_toolkit_version"
							, -1
							, (uint) sizeof( IntPtr ) // get_toolkit_version
							, "get_toolkit_name"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_atk_util_get_type();
		static d_atk_util_get_type atk_util_get_type = FuncLoader.LoadFunction<d_atk_util_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_util_get_type"));

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


		// 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 (GLib.Object.abi_info.Fields);

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
