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

namespace GtkSource {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class CompletionProposalAdapter : GLib.GInterfaceAdapter, GtkSource.ICompletionProposal {

		[StructLayout (LayoutKind.Sequential)]
		struct GtkSourceCompletionProposalIface {
			public GetLabelNativeDelegate GetLabel;
			public GetMarkupNativeDelegate GetMarkup;
			public GetTextNativeDelegate GetText;
			public GetIconNativeDelegate GetIcon;
			public GetIconNameNativeDelegate GetIconName;
			public GetGiconNativeDelegate GetGicon;
			public GetInfoNativeDelegate GetInfo;
			public HashNativeDelegate Hash;
			public EqualNativeDelegate Equal;
			IntPtr EmitChanged;
		}

		static GtkSourceCompletionProposalIface iface;

		static CompletionProposalAdapter ()
		{
			GLib.GType.Register (_gtype, typeof (CompletionProposalAdapter));
			iface.GetLabel = new GetLabelNativeDelegate (GetLabel_cb);
			iface.GetMarkup = new GetMarkupNativeDelegate (GetMarkup_cb);
			iface.GetText = new GetTextNativeDelegate (GetText_cb);
			iface.GetIcon = new GetIconNativeDelegate (GetIcon_cb);
			iface.GetIconName = new GetIconNameNativeDelegate (GetIconName_cb);
			iface.GetGicon = new GetGiconNativeDelegate (GetGicon_cb);
			iface.GetInfo = new GetInfoNativeDelegate (GetInfo_cb);
			iface.Hash = new HashNativeDelegate (Hash_cb);
			iface.Equal = new EqualNativeDelegate (Equal_cb);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetLabelNativeDelegate (IntPtr inst);

		static IntPtr GetLabel_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				string __result;
				__result = __obj.Label;
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetMarkupNativeDelegate (IntPtr inst);

		static IntPtr GetMarkup_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				string __result;
				__result = __obj.Markup;
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetTextNativeDelegate (IntPtr inst);

		static IntPtr GetText_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				string __result;
				__result = __obj.Text;
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetIconNativeDelegate (IntPtr inst);

		static IntPtr GetIcon_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				Gdk.Pixbuf __result;
				__result = __obj.Icon;
				return __result == null ? IntPtr.Zero : __result.Handle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetIconNameNativeDelegate (IntPtr inst);

		static IntPtr GetIconName_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				string __result;
				__result = __obj.IconName;
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetGiconNativeDelegate (IntPtr inst);

		static IntPtr GetGicon_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				GLib.IIcon __result;
				__result = __obj.Gicon;
				return __result == null ? IntPtr.Zero : ((__result is GLib.Object) ? (__result as GLib.Object).Handle : (__result as GLib.IconAdapter).Handle);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr GetInfoNativeDelegate (IntPtr inst);

		static IntPtr GetInfo_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				string __result;
				__result = __obj.Info;
				return GLib.Marshaller.StringToPtrGStrdup(__result);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate uint HashNativeDelegate (IntPtr inst);

		static uint Hash_cb (IntPtr inst)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				uint __result;
				__result = __obj.Hash ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool EqualNativeDelegate (IntPtr inst, IntPtr other);

		static bool Equal_cb (IntPtr inst, IntPtr other)
		{
			try {
				ICompletionProposalImplementor __obj = GLib.Object.GetObject (inst, false) as ICompletionProposalImplementor;
				bool __result;
				__result = __obj.Equal (GtkSource.CompletionProposalAdapter.GetObject (other, false));
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw;
			}
		}

		static int class_offset = 2 * IntPtr.Size;

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			GtkSourceCompletionProposalIface native_iface = (GtkSourceCompletionProposalIface) Marshal.PtrToStructure (ifaceptr, typeof (GtkSourceCompletionProposalIface));
			native_iface.GetLabel = iface.GetLabel;
			native_iface.GetMarkup = iface.GetMarkup;
			native_iface.GetText = iface.GetText;
			native_iface.GetIcon = iface.GetIcon;
			native_iface.GetIconName = iface.GetIconName;
			native_iface.GetGicon = iface.GetGicon;
			native_iface.GetInfo = iface.GetInfo;
			native_iface.Hash = iface.Hash;
			native_iface.Equal = iface.Equal;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}

		GLib.Object implementor;

		public CompletionProposalAdapter ()
		{
			InitHandler = new GLib.GInterfaceInitHandler (Initialize);
		}

		public CompletionProposalAdapter (ICompletionProposalImplementor implementor)
		{
			if (implementor == null)
				throw new ArgumentNullException ("implementor");
			else if (!(implementor is GLib.Object))
				throw new ArgumentException ("implementor must be a subclass of GLib.Object");
			this.implementor = implementor as GLib.Object;
		}

		public CompletionProposalAdapter (IntPtr handle)
		{
			if (!_gtype.IsInstance (handle))
				throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
			implementor = GLib.Object.GetObject (handle);
		}

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

		private static GLib.GType _gtype = new GLib.GType (gtk_source_completion_proposal_get_type ());

		public static GLib.GType GType {
			get {
				return _gtype;
			}
		}

		public override GLib.GType GInterfaceGType {
			get {
				return _gtype;
			}
		}

		public override IntPtr Handle {
			get {
				return implementor.Handle;
			}
		}

		public IntPtr OwnedHandle {
			get {
				return implementor.OwnedHandle;
			}
		}

		public static ICompletionProposal GetObject (IntPtr handle, bool owned)
		{
			GLib.Object obj = GLib.Object.GetObject (handle, owned);
			return GetObject (obj);
		}

		public static ICompletionProposal GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj is ICompletionProposalImplementor)
				return new CompletionProposalAdapter (obj as ICompletionProposalImplementor);
			else if (obj as ICompletionProposal == null)
				return new CompletionProposalAdapter (obj.Handle);
			else
				return obj as ICompletionProposal;
		}

		public ICompletionProposalImplementor Implementor {
			get {
				return implementor as ICompletionProposalImplementor;
			}
		}

		[GLib.Signal("changed")]
		public event System.EventHandler EmitChanged {
			add {
				GLib.Object.GetObject (Handle).AddSignalHandler ("changed", value);
			}
			remove {
				GLib.Object.GetObject (Handle).RemoveSignalHandler ("changed", value);
			}
		}

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

		public void Changed() {
			gtk_source_completion_proposal_changed(Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_source_completion_proposal_equal(IntPtr raw, IntPtr other);
		static d_gtk_source_completion_proposal_equal gtk_source_completion_proposal_equal = FuncLoader.LoadFunction<d_gtk_source_completion_proposal_equal>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GtkSource), "gtk_source_completion_proposal_equal"));

		public bool Equal(GtkSource.ICompletionProposal other) {
			bool raw_ret = gtk_source_completion_proposal_equal(Handle, other == null ? IntPtr.Zero : ((other is GLib.Object) ? (other as GLib.Object).Handle : (other as GtkSource.CompletionProposalAdapter).Handle));
			bool ret = raw_ret;
			return ret;
		}

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

		public GLib.IIcon Gicon { 
			get {
				IntPtr raw_ret = gtk_source_completion_proposal_get_gicon(Handle);
				GLib.IIcon ret = GLib.IconAdapter.GetObject (raw_ret, false);
				return ret;
			}
		}

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

		public Gdk.Pixbuf Icon { 
			get {
				IntPtr raw_ret = gtk_source_completion_proposal_get_icon(Handle);
				Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
				return ret;
			}
		}

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

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

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

		public string Info { 
			get {
				IntPtr raw_ret = gtk_source_completion_proposal_get_info(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

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

		public string Label { 
			get {
				IntPtr raw_ret = gtk_source_completion_proposal_get_label(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

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

		public string Markup { 
			get {
				IntPtr raw_ret = gtk_source_completion_proposal_get_markup(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

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

		public string Text { 
			get {
				IntPtr raw_ret = gtk_source_completion_proposal_get_text(Handle);
				string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
				return ret;
			}
		}

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

		public uint Hash() {
			uint raw_ret = gtk_source_completion_proposal_hash(Handle);
			uint ret = raw_ret;
			return ret;
		}

#endregion
	}
}
