context: // This file was generated by the Gtk# code generator.
  // Any changes made will be lost if regenerated.
  
  namespace Gtk {
  
  	using System;
  	using System.Collections;
  	using System.Collections.Generic;
  	using System.Runtime.InteropServices;
  
  #region Autogenerated code
  	public partial class Clipboard : GLib.Object {
  
  		public Clipboard (IntPtr raw) : base(raw) {}
  
  		protected Clipboard() : base(IntPtr.Zero)
  		{
  			CreateNativeObject (new string [0], new GLib.Value [0]);
  		}
  
  		[GLib.Signal("owner-change")]
  		public event Gtk.OwnerChangeHandler OwnerChange {
  			add {
  				this.AddSignalHandler ("owner-change", value, typeof (Gtk.OwnerChangeArgs));
  			}
  			remove {
  				this.RemoveSignalHandler ("owner-change", value);
  			}
  		}
  
  		static OwnerChangeNativeDelegate OwnerChange_cb_delegate;
  		static OwnerChangeNativeDelegate OwnerChangeVMCallback {
  			get {
  				if (OwnerChange_cb_delegate == null)
  					OwnerChange_cb_delegate = new OwnerChangeNativeDelegate (OwnerChange_cb);
  				return OwnerChange_cb_delegate;
  			}
  		}
  
  		static void OverrideOwnerChange (GLib.GType gtype)
  		{
  			OverrideOwnerChange (gtype, OwnerChangeVMCallback);
  		}
  
  		static void OverrideOwnerChange (GLib.GType gtype, OwnerChangeNativeDelegate callback)
  		{
  			GtkClipboardClass class_iface = GetClassStruct (gtype, false);
  			class_iface.OwnerChange = callback;
  			OverrideClassStruct (gtype, class_iface);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate void OwnerChangeNativeDelegate (IntPtr inst, IntPtr evnt);
  
  		static void OwnerChange_cb (IntPtr inst, IntPtr evnt)
  		{
  			try {
  				Clipboard __obj = GLib.Object.GetObject (inst, false) as Clipboard;
  				__obj.OnOwnerChange (new Gdk.EventOwnerChange(evnt));
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, false);
  			}
  		}
  
  		[GLib.DefaultSignalHandler(Type=typeof(Gtk.Clipboard), ConnectionMethod="OverrideOwnerChange")]
  		protected virtual void OnOwnerChange (Gdk.EventOwnerChange evnt)
  		{
  			InternalOwnerChange (evnt);
  		}
  
  		private void InternalOwnerChange (Gdk.EventOwnerChange evnt)
  		{
  			OwnerChangeNativeDelegate unmanaged = GetClassStruct (this.LookupGType ().GetThresholdType (), true).OwnerChange;
  			if (unmanaged == null) return;
  
  			unmanaged (this.Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
  		}
  
  		[StructLayout (LayoutKind.Sequential)]
  		struct GtkClipboardClass {
  			public OwnerChangeNativeDelegate OwnerChange;
  		}
  
  		static uint class_offset = ((GLib.GType) typeof (GLib.Object)).GetClassSize ();
  		static Dictionary<GLib.GType, GtkClipboardClass> class_structs;
  
  		static GtkClipboardClass GetClassStruct (GLib.GType gtype, bool use_cache)
  		{
  			if (class_structs == null)
  				class_structs = new Dictionary<GLib.GType, GtkClipboardClass> ();
  
  			if (use_cache && class_structs.ContainsKey (gtype))
  				return class_structs [gtype];
  			else {
  				IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);
  				GtkClipboardClass class_struct = (GtkClipboardClass) Marshal.PtrToStructure (class_ptr, typeof (GtkClipboardClass));
  				if (use_cache)
  					class_structs.Add (gtype, class_struct);
  				return class_struct;
  			}
  		}
  
  		static void OverrideClassStruct (GLib.GType gtype, GtkClipboardClass class_struct)
  		{
  			IntPtr class_ptr = new IntPtr (gtype.GetClassPtr ().ToInt64 () + class_offset);
  			Marshal.StructureToPtr (class_struct, class_ptr, false);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_clear(IntPtr raw);
  
  		public void Clear() {
  			gtk_clipboard_clear(Handle);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_get(IntPtr selection);
  
  		public static Gtk.Clipboard Get(Gdk.Atom selection) {
  			IntPtr raw_ret = gtk_clipboard_get(selection == null ? IntPtr.Zero : selection.Handle);
  			Gtk.Clipboard ret = GLib.Object.GetObject(raw_ret) as Gtk.Clipboard;
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_get_display(IntPtr raw);
  
  		public Gdk.Display Display { 
  			get {
  				IntPtr raw_ret = gtk_clipboard_get_display(Handle);
  				Gdk.Display ret = GLib.Object.GetObject(raw_ret) as Gdk.Display;
  				return ret;
  			}
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_get_for_display(IntPtr display, IntPtr selection);
  
  		public static Gtk.Clipboard GetForDisplay(Gdk.Display display, Gdk.Atom selection) {
  			IntPtr raw_ret = gtk_clipboard_get_for_display(display == null ? IntPtr.Zero : display.Handle, selection == null ? IntPtr.Zero : selection.Handle);
  			Gtk.Clipboard ret = GLib.Object.GetObject(raw_ret) as Gtk.Clipboard;
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_get_owner(IntPtr raw);
  
  		public GLib.Object Owner { 
  			get {
  				IntPtr raw_ret = gtk_clipboard_get_owner(Handle);
  				GLib.Object ret = GLib.Object.GetObject (raw_ret);
  				return ret;
  			}
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_get_type();
  
  		public static new GLib.GType GType { 
  			get {
  				IntPtr raw_ret = gtk_clipboard_get_type();
  				GLib.GType ret = new GLib.GType(raw_ret);
  				return ret;
  			}
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_request_contents(IntPtr raw, IntPtr target, GtkSharp.ClipboardReceivedFuncNative cb, IntPtr user_data);
  
  		public void RequestContents(Gdk.Atom target, Gtk.ClipboardReceivedFunc cb) {
  			GtkSharp.ClipboardReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardReceivedFuncWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			gtk_clipboard_request_contents(Handle, target == null ? IntPtr.Zero : target.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_request_image(IntPtr raw, GtkSharp.ClipboardImageReceivedFuncNative cb, IntPtr user_data);
  
  		public void RequestImage(Gtk.ClipboardImageReceivedFunc cb) {
  			GtkSharp.ClipboardImageReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardImageReceivedFuncWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			gtk_clipboard_request_image(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_request_targets(IntPtr raw, GtkSharp.ClipboardTargetsReceivedFuncNative cb, IntPtr user_data);
  
  		public void RequestTargets(Gtk.ClipboardTargetsReceivedFunc cb) {
  			GtkSharp.ClipboardTargetsReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardTargetsReceivedFuncWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			gtk_clipboard_request_targets(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_request_text(IntPtr raw, GtkSharp.ClipboardTextReceivedFuncNative cb, IntPtr user_data);
  
  		public void RequestText(Gtk.ClipboardTextReceivedFunc cb) {
  			GtkSharp.ClipboardTextReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardTextReceivedFuncWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			gtk_clipboard_request_text(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_request_uris(IntPtr raw, GtkSharp.ClipboardURIReceivedFuncNative cb, IntPtr user_data);
  
  		public void RequestUris(Gtk.ClipboardURIReceivedFunc cb) {
  			GtkSharp.ClipboardURIReceivedFuncWrapper cb_wrapper = new GtkSharp.ClipboardURIReceivedFuncWrapper (cb);
  			cb_wrapper.PersistUntilCalled ();
  			gtk_clipboard_request_uris(Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_set_can_store(IntPtr raw, IntPtr targets, int n_targets);
  
  		public void SetCanStore(Gtk.TargetEntry targets, int n_targets) {
  			IntPtr native_targets = GLib.Marshaller.StructureToPtrAlloc (targets);
  			gtk_clipboard_set_can_store(Handle, native_targets, n_targets);
  			targets = Gtk.TargetEntry.New (native_targets);
  			Marshal.FreeHGlobal (native_targets);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_set_image(IntPtr raw, IntPtr pixbuf);
  
  		public Gdk.Pixbuf Image { 
  			set {
  				gtk_clipboard_set_image(Handle, value == null ? IntPtr.Zero : value.Handle);
  			}
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_set_text(IntPtr raw, IntPtr text, int len);
  
  		public string Text { 
  			set {
  				IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
  				gtk_clipboard_set_text(Handle, native_value, System.Text.Encoding.UTF8.GetByteCount (value));
  				GLib.Marshaller.Free (native_value);
  			}
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern void gtk_clipboard_store(IntPtr raw);
  
  		public void Store() {
  			gtk_clipboard_store(Handle);
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_wait_for_contents(IntPtr raw, IntPtr target);
  
  		public Gtk.SelectionData WaitForContents(Gdk.Atom target) {
  			IntPtr raw_ret = gtk_clipboard_wait_for_contents(Handle, target == null ? IntPtr.Zero : target.Handle);
  			Gtk.SelectionData ret = raw_ret == IntPtr.Zero ? null : (Gtk.SelectionData) GLib.Opaque.GetOpaque (raw_ret, typeof (Gtk.SelectionData), true);
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_wait_for_image(IntPtr raw);
  
  		public Gdk.Pixbuf WaitForImage() {
  			IntPtr raw_ret = gtk_clipboard_wait_for_image(Handle);
  			Gdk.Pixbuf ret = GLib.Object.GetObject(raw_ret) as Gdk.Pixbuf;
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern bool gtk_clipboard_wait_for_targets(IntPtr raw, IntPtr targets, out int n_targets);
  
  		public bool WaitForTargets(Gdk.Atom targets, out int n_targets) {
  			bool raw_ret = gtk_clipboard_wait_for_targets(Handle, targets == null ? IntPtr.Zero : targets.Handle, out n_targets);
  			bool ret = raw_ret;
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_wait_for_text(IntPtr raw);
  
  		public string WaitForText() {
  			IntPtr raw_ret = gtk_clipboard_wait_for_text(Handle);
  			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern IntPtr gtk_clipboard_wait_for_uris(IntPtr raw);
  
  		public string WaitForUris() {
  			IntPtr raw_ret = gtk_clipboard_wait_for_uris(Handle);
  			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
  			return ret;
  		}
  
  		[DllImport("libgtk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
  		static extern bool gtk_clipboard_wait_is_image_available(IntPtr raw);
  
  		public bool WaitIsImageAvailable() {
  
gt: 			bool raw_ret = gtk_clipboard_wait_is_image_available(Handle);