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

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

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

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

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

		[GLib.Property ("is-locked")]
		public bool IsLocked {
			get  {
				bool raw_ret = gtk_accel_group_get_is_locked(Handle);
				bool ret = raw_ret;
				return ret;
			}
		}

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

		[GLib.Property ("modifier-mask")]
		public Gdk.ModifierType ModifierMask {
			get  {
				int raw_ret = gtk_accel_group_get_modifier_mask(Handle);
				Gdk.ModifierType ret = (Gdk.ModifierType) raw_ret;
				return ret;
			}
		}

		[GLib.Signal("accel-activate")]
		public event Gtk.AccelActivateHandler AccelActivate {
			add {
				this.AddSignalHandler ("accel-activate", value, typeof (Gtk.AccelActivateArgs));
			}
			remove {
				this.RemoveSignalHandler ("accel-activate", value);
			}
		}

		[GLib.Signal("accel-changed")]
		public event Gtk.AccelChangedHandler AccelChanged {
			add {
				this.AddSignalHandler ("accel-changed", value, typeof (Gtk.AccelChangedArgs));
			}
			remove {
				this.RemoveSignalHandler ("accel-changed", value);
			}
		}

		static AccelActivateNativeDelegate AccelActivate_cb_delegate;
		static AccelActivateNativeDelegate AccelActivateVMCallback {
			get {
				if (AccelActivate_cb_delegate == null)
					AccelActivate_cb_delegate = new AccelActivateNativeDelegate (AccelActivate_cb);
				return AccelActivate_cb_delegate;
			}
		}

		static void OverrideAccelActivate (GLib.GType gtype)
		{
			OverrideAccelActivate (gtype, AccelActivateVMCallback);
		}

		static void OverrideAccelActivate (GLib.GType gtype, AccelActivateNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "accel-activate", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool AccelActivateNativeDelegate (IntPtr inst, IntPtr acceleratable, uint keyval, int modifier);

		static bool AccelActivate_cb (IntPtr inst, IntPtr acceleratable, uint keyval, int modifier)
		{
			try {
				AccelGroup __obj = GLib.Object.GetObject (inst, false) as AccelGroup;
				bool __result;
				__result = __obj.OnAccelActivate (GLib.Object.GetObject (acceleratable), keyval, (Gdk.ModifierType) modifier);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.AccelGroup), ConnectionMethod="OverrideAccelActivate")]
		protected virtual bool OnAccelActivate (GLib.Object acceleratable, uint keyval, Gdk.ModifierType modifier)
		{
			return InternalAccelActivate (acceleratable, keyval, modifier);
		}

		private bool InternalAccelActivate (GLib.Object acceleratable, uint keyval, Gdk.ModifierType modifier)
		{
			GLib.Value ret = new GLib.Value (GLib.GType.Boolean);
			GLib.ValueArray inst_and_params = new GLib.ValueArray (4);
			GLib.Value[] vals = new GLib.Value [4];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (acceleratable);
			inst_and_params.Append (vals [1]);
			vals [2] = new GLib.Value (keyval);
			inst_and_params.Append (vals [2]);
			vals [3] = new GLib.Value (modifier);
			inst_and_params.Append (vals [3]);
			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 AccelChangedNativeDelegate AccelChanged_cb_delegate;
		static AccelChangedNativeDelegate AccelChangedVMCallback {
			get {
				if (AccelChanged_cb_delegate == null)
					AccelChanged_cb_delegate = new AccelChangedNativeDelegate (AccelChanged_cb);
				return AccelChanged_cb_delegate;
			}
		}

		static void OverrideAccelChanged (GLib.GType gtype)
		{
			OverrideAccelChanged (gtype, AccelChangedVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void AccelChangedNativeDelegate (IntPtr inst, uint keyval, int modifier, IntPtr accel_closure);

		static void AccelChanged_cb (IntPtr inst, uint keyval, int modifier, IntPtr accel_closure)
		{
			try {
				AccelGroup __obj = GLib.Object.GetObject (inst, false) as AccelGroup;
				__obj.OnAccelChanged (keyval, (Gdk.ModifierType) modifier, accel_closure);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.AccelGroup), ConnectionMethod="OverrideAccelChanged")]
		protected virtual void OnAccelChanged (uint keyval, Gdk.ModifierType modifier, IntPtr accel_closure)
		{
			InternalAccelChanged (keyval, modifier, accel_closure);
		}

		private void InternalAccelChanged (uint keyval, Gdk.ModifierType modifier, IntPtr accel_closure)
		{
			AccelChangedNativeDelegate unmanaged = class_abi.BaseOverride<AccelChangedNativeDelegate>(this.LookupGType(), "accel_changed");
			if (unmanaged == null) return;

			unmanaged (this.Handle, keyval, (int) modifier, accel_closure);
		}


		// 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("accel_changed"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // accel_changed
							, null
							, "_gtk_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved1
							, "accel_changed"
							, "_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 bool d_gtk_accel_group_activate(IntPtr raw, int accel_quark, IntPtr acceleratable, uint accel_key, int accel_mods);
		static d_gtk_accel_group_activate gtk_accel_group_activate = FuncLoader.LoadFunction<d_gtk_accel_group_activate>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_accel_group_activate"));

		public bool Activate(int accel_quark, GLib.Object acceleratable, uint accel_key, Gdk.ModifierType accel_mods) {
			bool raw_ret = gtk_accel_group_activate(Handle, accel_quark, acceleratable == null ? IntPtr.Zero : acceleratable.Handle, accel_key, (int) accel_mods);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_accel_group_connect(IntPtr raw, uint accel_key, int accel_mods, int accel_flags, IntPtr closure);
		static d_gtk_accel_group_connect gtk_accel_group_connect = FuncLoader.LoadFunction<d_gtk_accel_group_connect>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_accel_group_connect"));

		public void Connect(uint accel_key, Gdk.ModifierType accel_mods, Gtk.AccelFlags accel_flags, IntPtr closure) {
			gtk_accel_group_connect(Handle, accel_key, (int) accel_mods, (int) accel_flags, closure);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_accel_group_connect_by_path(IntPtr raw, IntPtr accel_path, IntPtr closure);
		static d_gtk_accel_group_connect_by_path gtk_accel_group_connect_by_path = FuncLoader.LoadFunction<d_gtk_accel_group_connect_by_path>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_accel_group_connect_by_path"));

		public void ConnectByPath(string accel_path, IntPtr closure) {
			IntPtr native_accel_path = GLib.Marshaller.StringToPtrGStrdup (accel_path);
			gtk_accel_group_connect_by_path(Handle, native_accel_path, closure);
			GLib.Marshaller.Free (native_accel_path);
		}

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

		public bool Disconnect(IntPtr closure) {
			bool raw_ret = gtk_accel_group_disconnect(Handle, closure);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_accel_group_disconnect_key(IntPtr raw, uint accel_key, int accel_mods);
		static d_gtk_accel_group_disconnect_key gtk_accel_group_disconnect_key = FuncLoader.LoadFunction<d_gtk_accel_group_disconnect_key>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_accel_group_disconnect_key"));

		public bool DisconnectKey(uint accel_key, Gdk.ModifierType accel_mods) {
			bool raw_ret = gtk_accel_group_disconnect_key(Handle, accel_key, (int) accel_mods);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_accel_group_find(IntPtr raw, GtkSharp.AccelGroupFindFuncNative find_func, IntPtr data);
		static d_gtk_accel_group_find gtk_accel_group_find = FuncLoader.LoadFunction<d_gtk_accel_group_find>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_accel_group_find"));

		public Gtk.AccelKey Find(Gtk.AccelGroupFindFunc find_func) {
			GtkSharp.AccelGroupFindFuncWrapper find_func_wrapper = new GtkSharp.AccelGroupFindFuncWrapper (find_func);
			IntPtr raw_ret = gtk_accel_group_find(Handle, find_func_wrapper.NativeDelegate, IntPtr.Zero);
			Gtk.AccelKey ret = Gtk.AccelKey.New (raw_ret);
			return ret;
		}

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

		public static Gtk.AccelGroup FromAccelClosure(IntPtr closure) {
			IntPtr raw_ret = gtk_accel_group_from_accel_closure(closure);
			Gtk.AccelGroup ret = GLib.Object.GetObject(raw_ret) as Gtk.AccelGroup;
			return ret;
		}

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

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

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

		public void Lock() {
			gtk_accel_group_lock(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_accel_group_query(IntPtr raw, uint accel_key, int accel_mods, out uint n_entries);
		static d_gtk_accel_group_query gtk_accel_group_query = FuncLoader.LoadFunction<d_gtk_accel_group_query>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_accel_group_query"));

		public Gtk.AccelGroupEntry Query(uint accel_key, Gdk.ModifierType accel_mods, out uint n_entries) {
			IntPtr raw_ret = gtk_accel_group_query(Handle, accel_key, (int) accel_mods, out n_entries);
			Gtk.AccelGroupEntry ret = Gtk.AccelGroupEntry.New (raw_ret);
			return ret;
		}

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

		public void Unlock() {
			gtk_accel_group_unlock(Handle);
		}


		// 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
	}
}
