// 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;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class GesturePan : Gtk.GestureDrag {

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

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gtk_gesture_pan_new(IntPtr widget, int orientation);
		static d_gtk_gesture_pan_new gtk_gesture_pan_new = FuncLoader.LoadFunction<d_gtk_gesture_pan_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_gesture_pan_new"));

		public GesturePan (Gtk.Widget widget, Gtk.Orientation orientation) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (GesturePan)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (widget != null) {
					names.Add ("widget");
					vals.Add (new GLib.Value (widget));
				}
				names.Add ("orientation");
				vals.Add (new GLib.Value (orientation));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = gtk_gesture_pan_new(widget == null ? IntPtr.Zero : widget.Handle, (int) orientation);
		}

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

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

		[GLib.Property ("orientation")]
		public Gtk.Orientation Orientation {
			get  {
				int raw_ret = gtk_gesture_pan_get_orientation(Handle);
				Gtk.Orientation ret = (Gtk.Orientation) raw_ret;
				return ret;
			}
			set  {
				gtk_gesture_pan_set_orientation(Handle, (int) value);
			}
		}

		[GLib.Signal("pan")]
		public event Gtk.PanHandler Pan {
			add {
				this.AddSignalHandler ("pan", value, typeof (Gtk.PanArgs));
			}
			remove {
				this.RemoveSignalHandler ("pan", value);
			}
		}

		static PanNativeDelegate Pan_cb_delegate;
		static PanNativeDelegate PanVMCallback {
			get {
				if (Pan_cb_delegate == null)
					Pan_cb_delegate = new PanNativeDelegate (Pan_cb);
				return Pan_cb_delegate;
			}
		}

		static void OverridePan (GLib.GType gtype)
		{
			OverridePan (gtype, PanVMCallback);
		}

		static void OverridePan (GLib.GType gtype, PanNativeDelegate callback)
		{
			unsafe {
				IntPtr* raw_ptr = (IntPtr*)(((long) gtype.GetClassPtr()) + (long) class_abi.GetFieldOffset("pan"));
				*raw_ptr = Marshal.GetFunctionPointerForDelegate(callback);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void PanNativeDelegate (IntPtr inst, int direction, double offset);

		static void Pan_cb (IntPtr inst, int direction, double offset)
		{
			try {
				GesturePan __obj = GLib.Object.GetObject (inst, false) as GesturePan;
				__obj.OnPan ((Gtk.PanDirection) direction, offset);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[GLib.DefaultSignalHandler(Type=typeof(Gtk.GesturePan), ConnectionMethod="OverridePan")]
		protected virtual void OnPan (Gtk.PanDirection direction, double offset)
		{
			InternalPan (direction, offset);
		}

		private void InternalPan (Gtk.PanDirection direction, double offset)
		{
			PanNativeDelegate unmanaged = class_abi.BaseOverride<PanNativeDelegate>(this.LookupGType(), "pan");
			if (unmanaged == null) return;

			unmanaged (this.Handle, (int) direction, offset);
		}

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

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

#endregion
	}
}
