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

namespace GtkSource {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class ContextClass : GLib.Opaque {

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_source_context_class_new(IntPtr name, bool enabled);
		static d_gtk_source_context_class_new gtk_source_context_class_new = FuncLoader.LoadFunction<d_gtk_source_context_class_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_context_class_new"));

		public ContextClass (string name, bool enabled) 
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			Raw = gtk_source_context_class_new(native_name, enabled);
			GLib.Marshaller.Free (native_name);
		}

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

		protected override void Free (IntPtr raw)
		{
			gtk_source_context_class_free (raw);
		}

		class FinalizerInfo {
			IntPtr handle;
			public uint timeoutHandlerId;

			public FinalizerInfo (IntPtr handle)
			{
				this.handle = handle;
			}

			public bool Handler ()
			{
				gtk_source_context_class_free (handle);
				GLib.Timeout.Remove(timeoutHandlerId);
				return false;
			}
		}

		~ContextClass ()
		{
			if (!Owned)
				return;
			FinalizerInfo info = new FinalizerInfo (Handle);
			info.timeoutHandlerId = GLib.Timeout.Add (50, new GLib.TimeoutHandler (info.Handler));
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (new List<GLib.AbiField>{ 
					});

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
