// 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 RadioMenuItem : Gtk.CheckMenuItem {

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

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

		public RadioMenuItem (Gtk.RadioMenuItem group) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (RadioMenuItem)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = gtk_radio_menu_item_new_from_widget(group == null ? IntPtr.Zero : group.Handle);
		}

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

		public RadioMenuItem (Gtk.RadioMenuItem group, string label) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (RadioMenuItem)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (group != null) {
					names.Add ("label");
					vals.Add (new GLib.Value (label));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			Raw = gtk_radio_menu_item_new_with_mnemonic_from_widget(group == null ? IntPtr.Zero : group.Handle, native_label);
			GLib.Marshaller.Free (native_label);
		}

		[GLib.Signal("group-changed")]
		public event System.EventHandler GroupChanged {
			add {
				this.AddSignalHandler ("group-changed", value);
			}
			remove {
				this.RemoveSignalHandler ("group-changed", value);
			}
		}

		static GroupChangedNativeDelegate GroupChanged_cb_delegate;
		static GroupChangedNativeDelegate GroupChangedVMCallback {
			get {
				if (GroupChanged_cb_delegate == null)
					GroupChanged_cb_delegate = new GroupChangedNativeDelegate (GroupChanged_cb);
				return GroupChanged_cb_delegate;
			}
		}

		static void OverrideGroupChanged (GLib.GType gtype)
		{
			OverrideGroupChanged (gtype, GroupChangedVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void GroupChangedNativeDelegate (IntPtr inst);

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

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.RadioMenuItem), ConnectionMethod="OverrideGroupChanged")]
		protected virtual void OnGroupChanged ()
		{
			InternalGroupChanged ();
		}

		private void InternalGroupChanged ()
		{
			GroupChangedNativeDelegate unmanaged = class_abi.BaseOverride<GroupChangedNativeDelegate>(this.LookupGType(), "group_changed");
			if (unmanaged == null) return;

			unmanaged (this.Handle);
		}


		// 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("group_changed"
							, Gtk.CheckMenuItem.class_abi.Fields
							, (uint) sizeof( IntPtr ) // group_changed
							, null
							, "_gtk_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_gtk_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _gtk_reserved1
							, "group_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 IntPtr d_gtk_radio_menu_item_get_type();
		static d_gtk_radio_menu_item_get_type gtk_radio_menu_item_get_type = FuncLoader.LoadFunction<d_gtk_radio_menu_item_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_radio_menu_item_get_type"));

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

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

		public void JoinGroup(Gtk.RadioMenuItem group_source) {
			gtk_radio_menu_item_join_group(Handle, group_source == null ? IntPtr.Zero : group_source.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"
							, Gtk.CheckMenuItem.abi_info.Fields
							, (uint) sizeof( IntPtr ) // priv
							, null
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
