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

namespace Pango {

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

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

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

		public Pango.Coverage Copy() {
			IntPtr raw_ret = pango_coverage_copy(Handle);
			Pango.Coverage ret = raw_ret == IntPtr.Zero ? null : (Pango.Coverage) GLib.Opaque.GetOpaque (raw_ret, typeof (Pango.Coverage), true);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_coverage_from_bytes(out byte bytes, int n_bytes);
		static d_pango_coverage_from_bytes pango_coverage_from_bytes = FuncLoader.LoadFunction<d_pango_coverage_from_bytes>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_coverage_from_bytes"));

		public static Pango.Coverage FromBytes(out byte bytes, int n_bytes) {
			IntPtr raw_ret = pango_coverage_from_bytes(out bytes, n_bytes);
			Pango.Coverage ret = raw_ret == IntPtr.Zero ? null : (Pango.Coverage) GLib.Opaque.GetOpaque (raw_ret, typeof (Pango.Coverage), false);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_pango_coverage_get(IntPtr raw, int index_);
		static d_pango_coverage_get pango_coverage_get = FuncLoader.LoadFunction<d_pango_coverage_get>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_coverage_get"));

		public Pango.CoverageLevel Get(int index_) {
			int raw_ret = pango_coverage_get(Handle, index_);
			Pango.CoverageLevel ret = (Pango.CoverageLevel) raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_coverage_max(IntPtr raw, IntPtr other);
		static d_pango_coverage_max pango_coverage_max = FuncLoader.LoadFunction<d_pango_coverage_max>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_coverage_max"));

		public void Max(Pango.Coverage other) {
			pango_coverage_max(Handle, other == null ? IntPtr.Zero : other.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_pango_coverage_set(IntPtr raw, int index_, int level);
		static d_pango_coverage_set pango_coverage_set = FuncLoader.LoadFunction<d_pango_coverage_set>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_coverage_set"));

		public void Set(int index_, Pango.CoverageLevel level) {
			pango_coverage_set(Handle, index_, (int) level);
		}

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_pango_coverage_new();
		static d_pango_coverage_new pango_coverage_new = FuncLoader.LoadFunction<d_pango_coverage_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Pango), "pango_coverage_new"));

		public Coverage () 
		{
			Raw = pango_coverage_new();
		}

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

		protected override void Ref (IntPtr raw)
		{
			if (!Owned) {
				pango_coverage_ref (raw);
				Owned = true;
			}
		}

		[Obsolete("Pango.Coverage is now refcounted automatically")]
		public Coverage Ref () { return this; }

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

		protected override void Unref (IntPtr raw)
		{
			if (Owned) {
				pango_coverage_unref (raw);
				Owned = false;
			}
		}

		[Obsolete("Pango.Coverage is now refcounted automatically")]
		public void Unref () {}

		class FinalizerInfo {
			IntPtr handle;
			public uint timeoutHandlerId;

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

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

		~Coverage ()
		{
			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
	}
}
