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

namespace GLib {

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

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

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

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

		static GetNextNativeDelegate GetNext_cb_delegate;
		static GetNextNativeDelegate GetNextVMCallback {
			get {
				if (GetNext_cb_delegate == null)
					GetNext_cb_delegate = new GetNextNativeDelegate (GetNext_cb);
				return GetNext_cb_delegate;
			}
		}

		static void OverrideGetNext (GLib.GType gtype)
		{
			OverrideGetNext (gtype, GetNextVMCallback);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GetNextNativeDelegate (IntPtr inst, IntPtr out_name, IntPtr value);

		static bool GetNext_cb (IntPtr inst, IntPtr out_name, IntPtr value)
		{
			try {
				MenuAttributeIter __obj = GLib.Object.GetObject (inst, false) as MenuAttributeIter;
				bool __result;
				__result = __obj.OnGetNext (GLib.Marshaller.Utf8PtrToString (out_name), new GLib.Variant(value));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(GLib.MenuAttributeIter), ConnectionMethod="OverrideGetNext")]
		protected virtual bool OnGetNext (string out_name, GLib.Variant value)
		{
			return InternalGetNext (out_name, value);
		}

		private bool InternalGetNext (string out_name, GLib.Variant value)
		{
			GetNextNativeDelegate unmanaged = class_abi.BaseOverride<GetNextNativeDelegate>(this.LookupGType(), "get_next");
			if (unmanaged == null) return false;

			IntPtr native_out_name = GLib.Marshaller.StringToPtrGStrdup (out_name);
			bool __result = unmanaged (this.Handle, native_out_name, value == null ? IntPtr.Zero : value.Handle);
			GLib.Marshaller.Free (native_out_name);
			return __result;
		}


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

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_menu_attribute_iter_get_next(IntPtr raw, IntPtr out_name, IntPtr value);
		static d_g_menu_attribute_iter_get_next g_menu_attribute_iter_get_next = FuncLoader.LoadFunction<d_g_menu_attribute_iter_get_next>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_attribute_iter_get_next"));

		public bool GetNext(string out_name, GLib.Variant value) {
			IntPtr native_out_name = GLib.Marshaller.StringToPtrGStrdup (out_name);
			bool raw_ret = g_menu_attribute_iter_get_next(Handle, native_out_name, value == null ? IntPtr.Zero : value.Handle);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_out_name);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_menu_attribute_iter_get_type();
		static d_g_menu_attribute_iter_get_type g_menu_attribute_iter_get_type = FuncLoader.LoadFunction<d_g_menu_attribute_iter_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_attribute_iter_get_type"));

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

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

		public GLib.Variant Value { 
			get {
				IntPtr raw_ret = g_menu_attribute_iter_get_value(Handle);
				GLib.Variant ret = new GLib.Variant(raw_ret);
				return ret;
			}
		}

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

		public bool Next() {
			bool raw_ret = g_menu_attribute_iter_next(Handle);
			bool ret = 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 (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
	}
}
