Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > b023782c10b0959fe8e660475b5ade45 > files > 115

gtk-sharp2-doc-2.12.0-1mdv2008.1.x86_64.rpm

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

namespace GtksharpSharp {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	[GLib.CDeclCallback]
	internal delegate void GCFuncNative();

	internal class GCFuncInvoker {

		GCFuncNative native_cb;

		internal GCFuncInvoker (GCFuncNative native_cb)
		{
			this.native_cb = native_cb;
		}

		internal Gtksharp.GCFunc Handler {
			get {
				return new Gtksharp.GCFunc(InvokeNative);
			}
		}

		void InvokeNative ()
		{
			native_cb ();
		}
	}

	internal class GCFuncWrapper {

		public void NativeCallback ()
		{
			try {
				managed ();
				if (release_on_call)
					gch.Free ();
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		bool release_on_call = false;
		GCHandle gch;

		public void PersistUntilCalled ()
		{
			release_on_call = true;
			gch = GCHandle.Alloc (this);
		}

		internal GCFuncNative NativeDelegate;
		Gtksharp.GCFunc managed;

		public GCFuncWrapper (Gtksharp.GCFunc managed)
		{
			this.managed = managed;
			if (managed != null)
				NativeDelegate = new GCFuncNative (NativeCallback);
		}

		public static Gtksharp.GCFunc GetManagedDelegate (GCFuncNative native)
		{
			if (native == null)
				return null;
			GCFuncWrapper wrapper = (GCFuncWrapper) native.Target;
			if (wrapper == null)
				return null;
			return wrapper.managed;
		}
	}
#endregion
}