// 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 Menu : GLib.MenuModel {

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

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_append(IntPtr raw, IntPtr label, IntPtr detailed_action);
		static d_g_menu_append g_menu_append = FuncLoader.LoadFunction<d_g_menu_append>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_append"));

		public void Append(string label, string detailed_action) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			IntPtr native_detailed_action = GLib.Marshaller.StringToPtrGStrdup (detailed_action);
			g_menu_append(Handle, native_label, native_detailed_action);
			GLib.Marshaller.Free (native_label);
			GLib.Marshaller.Free (native_detailed_action);
		}

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

		public void AppendItem(GLib.MenuItem item) {
			g_menu_append_item(Handle, item == null ? IntPtr.Zero : item.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_append_section(IntPtr raw, IntPtr label, IntPtr section);
		static d_g_menu_append_section g_menu_append_section = FuncLoader.LoadFunction<d_g_menu_append_section>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_append_section"));

		public void AppendSection(string label, GLib.MenuModel section) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			g_menu_append_section(Handle, native_label, section == null ? IntPtr.Zero : section.Handle);
			GLib.Marshaller.Free (native_label);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_append_submenu(IntPtr raw, IntPtr label, IntPtr submenu);
		static d_g_menu_append_submenu g_menu_append_submenu = FuncLoader.LoadFunction<d_g_menu_append_submenu>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_append_submenu"));

		public void AppendSubmenu(string label, GLib.MenuModel submenu) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			g_menu_append_submenu(Handle, native_label, submenu == null ? IntPtr.Zero : submenu.Handle);
			GLib.Marshaller.Free (native_label);
		}

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

		public void Freeze() {
			g_menu_freeze(Handle);
		}

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

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_insert(IntPtr raw, int position, IntPtr label, IntPtr detailed_action);
		static d_g_menu_insert g_menu_insert = FuncLoader.LoadFunction<d_g_menu_insert>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_insert"));

		public void Insert(int position, string label, string detailed_action) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			IntPtr native_detailed_action = GLib.Marshaller.StringToPtrGStrdup (detailed_action);
			g_menu_insert(Handle, position, native_label, native_detailed_action);
			GLib.Marshaller.Free (native_label);
			GLib.Marshaller.Free (native_detailed_action);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_insert_item(IntPtr raw, int position, IntPtr item);
		static d_g_menu_insert_item g_menu_insert_item = FuncLoader.LoadFunction<d_g_menu_insert_item>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_insert_item"));

		public void InsertItem(int position, GLib.MenuItem item) {
			g_menu_insert_item(Handle, position, item == null ? IntPtr.Zero : item.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_insert_section(IntPtr raw, int position, IntPtr label, IntPtr section);
		static d_g_menu_insert_section g_menu_insert_section = FuncLoader.LoadFunction<d_g_menu_insert_section>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_insert_section"));

		public void InsertSection(int position, string label, GLib.MenuModel section) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			g_menu_insert_section(Handle, position, native_label, section == null ? IntPtr.Zero : section.Handle);
			GLib.Marshaller.Free (native_label);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_insert_submenu(IntPtr raw, int position, IntPtr label, IntPtr submenu);
		static d_g_menu_insert_submenu g_menu_insert_submenu = FuncLoader.LoadFunction<d_g_menu_insert_submenu>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_insert_submenu"));

		public void InsertSubmenu(int position, string label, GLib.MenuModel submenu) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			g_menu_insert_submenu(Handle, position, native_label, submenu == null ? IntPtr.Zero : submenu.Handle);
			GLib.Marshaller.Free (native_label);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_prepend(IntPtr raw, IntPtr label, IntPtr detailed_action);
		static d_g_menu_prepend g_menu_prepend = FuncLoader.LoadFunction<d_g_menu_prepend>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_prepend"));

		public void Prepend(string label, string detailed_action) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			IntPtr native_detailed_action = GLib.Marshaller.StringToPtrGStrdup (detailed_action);
			g_menu_prepend(Handle, native_label, native_detailed_action);
			GLib.Marshaller.Free (native_label);
			GLib.Marshaller.Free (native_detailed_action);
		}

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

		public void PrependItem(GLib.MenuItem item) {
			g_menu_prepend_item(Handle, item == null ? IntPtr.Zero : item.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_prepend_section(IntPtr raw, IntPtr label, IntPtr section);
		static d_g_menu_prepend_section g_menu_prepend_section = FuncLoader.LoadFunction<d_g_menu_prepend_section>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_prepend_section"));

		public void PrependSection(string label, GLib.MenuModel section) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			g_menu_prepend_section(Handle, native_label, section == null ? IntPtr.Zero : section.Handle);
			GLib.Marshaller.Free (native_label);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_prepend_submenu(IntPtr raw, IntPtr label, IntPtr submenu);
		static d_g_menu_prepend_submenu g_menu_prepend_submenu = FuncLoader.LoadFunction<d_g_menu_prepend_submenu>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_prepend_submenu"));

		public void PrependSubmenu(string label, GLib.MenuModel submenu) {
			IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
			g_menu_prepend_submenu(Handle, native_label, submenu == null ? IntPtr.Zero : submenu.Handle);
			GLib.Marshaller.Free (native_label);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_menu_remove(IntPtr raw, int position);
		static d_g_menu_remove g_menu_remove = FuncLoader.LoadFunction<d_g_menu_remove>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_menu_remove"));

		public void Remove(int position) {
			g_menu_remove(Handle, position);
		}

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

		public void RemoveAll() {
			g_menu_remove_all(Handle);
		}

#endregion
	}
}
