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

namespace WebKit {

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

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

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

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

		[GLib.Signal("close")]
		public event System.EventHandler CloseEvent {
			add {
				this.AddSignalHandler ("close", value);
			}
			remove {
				this.RemoveSignalHandler ("close", value);
			}
		}

		static CloseEventNativeDelegate CloseEvent_cb_delegate;
		static CloseEventNativeDelegate CloseEventVMCallback {
			get {
				if (CloseEvent_cb_delegate == null)
					CloseEvent_cb_delegate = new CloseEventNativeDelegate (CloseEvent_cb);
				return CloseEvent_cb_delegate;
			}
		}

		static void OverrideCloseEvent (GLib.GType gtype)
		{
			OverrideCloseEvent (gtype, CloseEventVMCallback);
		}

		static void OverrideCloseEvent (GLib.GType gtype, CloseEventNativeDelegate callback)
		{
			OverrideVirtualMethod (gtype, "close", callback);
		}
		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void CloseEventNativeDelegate (IntPtr inst);

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

		[GLib.DefaultSignalHandler(Type=typeof(WebKit.OptionMenu), ConnectionMethod="OverrideCloseEvent")]
		protected virtual void OnCloseEvent ()
		{
			InternalCloseEvent ();
		}

		private void InternalCloseEvent ()
		{
			GLib.Value ret = GLib.Value.Empty;
			GLib.ValueArray inst_and_params = new GLib.ValueArray (1);
			GLib.Value[] vals = new GLib.Value [1];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
		}


		// 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("_webkit_reserved0"
							, GLib.Object.class_abi.Fields
							, (uint) sizeof( IntPtr ) // _webkit_reserved0
							, null
							, "_webkit_reserved1"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved1"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved1
							, "_webkit_reserved0"
							, "_webkit_reserved2"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved2"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved2
							, "_webkit_reserved1"
							, "_webkit_reserved3"
							, (uint) sizeof(IntPtr)
							, 0
							),
						new GLib.AbiField("_webkit_reserved3"
							, -1
							, (uint) sizeof( IntPtr ) // _webkit_reserved3
							, "_webkit_reserved2"
							, null
							, (uint) sizeof(IntPtr)
							, 0
							),
					});

				return _class_abi;
			}
		}


		// End of the ABI representation.

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_option_menu_get_type();
		static d_webkit_option_menu_get_type webkit_option_menu_get_type = FuncLoader.LoadFunction<d_webkit_option_menu_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_option_menu_get_type"));

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_option_menu_activate_item(IntPtr raw, uint index);
		static d_webkit_option_menu_activate_item webkit_option_menu_activate_item = FuncLoader.LoadFunction<d_webkit_option_menu_activate_item>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_option_menu_activate_item"));

		public void ActivateItem(uint index) {
			webkit_option_menu_activate_item(Handle, index);
		}

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

		public void Close() {
			webkit_option_menu_close(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_option_menu_get_item(IntPtr raw, uint index);
		static d_webkit_option_menu_get_item webkit_option_menu_get_item = FuncLoader.LoadFunction<d_webkit_option_menu_get_item>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_option_menu_get_item"));

		public WebKit.OptionMenuItem GetItem(uint index) {
			IntPtr raw_ret = webkit_option_menu_get_item(Handle, index);
			WebKit.OptionMenuItem ret = WebKit.OptionMenuItem.New (raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate uint d_webkit_option_menu_get_n_items(IntPtr raw);
		static d_webkit_option_menu_get_n_items webkit_option_menu_get_n_items = FuncLoader.LoadFunction<d_webkit_option_menu_get_n_items>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_option_menu_get_n_items"));

		public uint NItems { 
			get {
				uint raw_ret = webkit_option_menu_get_n_items(Handle);
				uint ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_webkit_option_menu_select_item(IntPtr raw, uint index);
		static d_webkit_option_menu_select_item webkit_option_menu_select_item = FuncLoader.LoadFunction<d_webkit_option_menu_select_item>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_option_menu_select_item"));

		public void SelectItem(uint index) {
			webkit_option_menu_select_item(Handle, index);
		}


		static OptionMenu ()
		{
			GtkSharp.WebkitGtkSharp.ObjectManager.Initialize ();
		}

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