// 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 SelectionData : GLib.Opaque {

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

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

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

		public Gdk.Atom DataType { 
			get {
				IntPtr raw_ret = gtk_selection_data_get_data_type(Handle);
				Gdk.Atom ret = raw_ret == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (raw_ret, typeof (Gdk.Atom), false);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate byte d_gtk_selection_data_get_data_with_length(IntPtr raw, out int length);
		static d_gtk_selection_data_get_data_with_length gtk_selection_data_get_data_with_length = FuncLoader.LoadFunction<d_gtk_selection_data_get_data_with_length>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_get_data_with_length"));

		public byte GetDataWithLength(out int length) {
			byte raw_ret = gtk_selection_data_get_data_with_length(Handle, out length);
			byte ret = raw_ret;
			return ret;
		}

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

		public Gdk.Display Display { 
			get {
				IntPtr raw_ret = gtk_selection_data_get_display(Handle);
				Gdk.Display ret = GLib.Object.GetObject(raw_ret) as Gdk.Display;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_gtk_selection_data_get_format(IntPtr raw);
		static d_gtk_selection_data_get_format gtk_selection_data_get_format = FuncLoader.LoadFunction<d_gtk_selection_data_get_format>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_get_format"));

		public int Format { 
			get {
				int raw_ret = gtk_selection_data_get_format(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_gtk_selection_data_get_length(IntPtr raw);
		static d_gtk_selection_data_get_length gtk_selection_data_get_length = FuncLoader.LoadFunction<d_gtk_selection_data_get_length>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_get_length"));

		public int Length { 
			get {
				int raw_ret = gtk_selection_data_get_length(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

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

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

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

		public Gdk.Atom Selection { 
			get {
				IntPtr raw_ret = gtk_selection_data_get_selection(Handle);
				Gdk.Atom ret = raw_ret == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (raw_ret, typeof (Gdk.Atom), false);
				return ret;
			}
		}

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

		public Gdk.Atom Target { 
			get {
				IntPtr raw_ret = gtk_selection_data_get_target(Handle);
				Gdk.Atom ret = raw_ret == IntPtr.Zero ? null : (Gdk.Atom) GLib.Opaque.GetOpaque (raw_ret, typeof (Gdk.Atom), false);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_selection_data_get_type();
		static d_gtk_selection_data_get_type gtk_selection_data_get_type = FuncLoader.LoadFunction<d_gtk_selection_data_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_get_type"));

		public static GLib.GType GType { 
			get {
				IntPtr raw_ret = gtk_selection_data_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

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

		public string[] Uris { 
			get {
				IntPtr raw_ret = gtk_selection_data_get_uris(Handle);
				string[] ret = GLib.Marshaller.NullTermPtrToStringArray (raw_ret, false);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gtk_selection_data_set(IntPtr raw, IntPtr type, int format, byte[] data, int length);
		static d_gtk_selection_data_set gtk_selection_data_set = FuncLoader.LoadFunction<d_gtk_selection_data_set>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_set"));

		public void Set(Gdk.Atom type, int format, byte[] data, int length) {
			gtk_selection_data_set(Handle, type == null ? IntPtr.Zero : type.Handle, format, data, length);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_selection_data_set_pixbuf(IntPtr raw, IntPtr pixbuf);
		static d_gtk_selection_data_set_pixbuf gtk_selection_data_set_pixbuf = FuncLoader.LoadFunction<d_gtk_selection_data_set_pixbuf>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_set_pixbuf"));

		public bool SetPixbuf(Gdk.Pixbuf pixbuf) {
			bool raw_ret = gtk_selection_data_set_pixbuf(Handle, pixbuf == null ? IntPtr.Zero : pixbuf.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_selection_data_set_uris(IntPtr raw, IntPtr[] uris);
		static d_gtk_selection_data_set_uris gtk_selection_data_set_uris = FuncLoader.LoadFunction<d_gtk_selection_data_set_uris>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_set_uris"));

		public bool SetUris(string[] uris) {
			int cnt_uris = uris == null ? 0 : uris.Length;
			IntPtr[] native_uris = new IntPtr [cnt_uris + 1];
			for (int i = 0; i < cnt_uris; i++)
				native_uris [i] = GLib.Marshaller.StringToPtrGStrdup(uris[i]);
			native_uris [cnt_uris] = IntPtr.Zero;
			bool raw_ret = gtk_selection_data_set_uris(Handle, native_uris);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_selection_data_targets_include_image(IntPtr raw, bool writable);
		static d_gtk_selection_data_targets_include_image gtk_selection_data_targets_include_image = FuncLoader.LoadFunction<d_gtk_selection_data_targets_include_image>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_targets_include_image"));

		public bool TargetsIncludeImage(bool writable) {
			bool raw_ret = gtk_selection_data_targets_include_image(Handle, writable);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_selection_data_targets_include_rich_text(IntPtr raw, IntPtr buffer);
		static d_gtk_selection_data_targets_include_rich_text gtk_selection_data_targets_include_rich_text = FuncLoader.LoadFunction<d_gtk_selection_data_targets_include_rich_text>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_targets_include_rich_text"));

		public bool TargetsIncludeRichText(Gtk.TextBuffer buffer) {
			bool raw_ret = gtk_selection_data_targets_include_rich_text(Handle, buffer == null ? IntPtr.Zero : buffer.Handle);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_selection_data_targets_include_text(IntPtr raw);
		static d_gtk_selection_data_targets_include_text gtk_selection_data_targets_include_text = FuncLoader.LoadFunction<d_gtk_selection_data_targets_include_text>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_targets_include_text"));

		public bool TargetsIncludeText() {
			bool raw_ret = gtk_selection_data_targets_include_text(Handle);
			bool ret = raw_ret;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gtk_selection_data_targets_include_uri(IntPtr raw);
		static d_gtk_selection_data_targets_include_uri gtk_selection_data_targets_include_uri = FuncLoader.LoadFunction<d_gtk_selection_data_targets_include_uri>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_selection_data_targets_include_uri"));

		public bool TargetsIncludeUri() {
			bool raw_ret = gtk_selection_data_targets_include_uri(Handle);
			bool ret = raw_ret;
			return ret;
		}

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

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

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

		[Obsolete("Gtk.SelectionData is now freed automatically")]
		public void Free () {}

		class FinalizerInfo {
			IntPtr handle;
			public uint timeoutHandlerId;

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

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

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