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

namespace Gst.Video {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class NavigationAdapter : GLib.GInterfaceAdapter, Gst.Video.INavigation {

		[StructLayout (LayoutKind.Sequential)]
		struct GstNavigationInterface {
			public SendEventNativeDelegate SendEvent;
		}

		static GstNavigationInterface iface;

		static NavigationAdapter ()
		{
			GLib.GType.Register (_gtype, typeof (NavigationAdapter));
			iface.SendEvent = new SendEventNativeDelegate (SendEvent_cb);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void SendEventNativeDelegate (IntPtr inst, IntPtr structure);

		static void SendEvent_cb (IntPtr inst, IntPtr structure)
		{
			try {
				INavigationImplementor __obj = GLib.Object.GetObject (inst, false) as INavigationImplementor;
				__obj.SendEvent (structure == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (structure, typeof (Gst.Structure), false));
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		static int class_offset = 2 * IntPtr.Size;

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			GstNavigationInterface native_iface = (GstNavigationInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstNavigationInterface));
			native_iface.SendEvent = iface.SendEvent;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}

		GLib.Object implementor;

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

		public NavigationAdapter (INavigationImplementor 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 NavigationAdapter (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);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_get_type();

		private static GLib.GType _gtype = new GLib.GType (gst_navigation_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 INavigation GetObject (IntPtr handle, bool owned)
		{
			GLib.Object obj = GLib.Object.GetObject (handle, owned);
			return GetObject (obj);
		}

		public static INavigation GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj is INavigationImplementor)
				return new NavigationAdapter (obj as INavigationImplementor);
			else if (obj as INavigation == null)
				return new NavigationAdapter (obj.Handle);
			else
				return obj as INavigation;
		}

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

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_navigation_event_get_type(IntPtr evnt);

		public static Gst.Video.NavigationEventType EventGetType(Gst.Event evnt) {
			int raw_ret = gst_navigation_event_get_type(evnt == null ? IntPtr.Zero : evnt.Handle);
			Gst.Video.NavigationEventType ret = (Gst.Video.NavigationEventType) raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_event_parse_command(IntPtr evnt, out int command);

		public static bool EventParseCommand(Gst.Event evnt, out Gst.Video.NavigationCommand command) {
			int native_command;
			bool raw_ret = gst_navigation_event_parse_command(evnt == null ? IntPtr.Zero : evnt.Handle, out native_command);
			bool ret = raw_ret;
			command = (Gst.Video.NavigationCommand) native_command;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_event_parse_key_event(IntPtr evnt, out IntPtr key);

		public static bool EventParseKeyEvent(Gst.Event evnt, out string key) {
			IntPtr native_key;
			bool raw_ret = gst_navigation_event_parse_key_event(evnt == null ? IntPtr.Zero : evnt.Handle, out native_key);
			bool ret = raw_ret;
			key = GLib.Marshaller.Utf8PtrToString (native_key);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_event_parse_mouse_button_event(IntPtr evnt, out int button, out double x, out double y);

		public static bool EventParseMouseButtonEvent(Gst.Event evnt, out int button, out double x, out double y) {
			bool raw_ret = gst_navigation_event_parse_mouse_button_event(evnt == null ? IntPtr.Zero : evnt.Handle, out button, out x, out y);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_event_parse_mouse_move_event(IntPtr evnt, out double x, out double y);

		public static bool EventParseMouseMoveEvent(Gst.Event evnt, out double x, out double y) {
			bool raw_ret = gst_navigation_event_parse_mouse_move_event(evnt == null ? IntPtr.Zero : evnt.Handle, out x, out y);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_event_parse_mouse_scroll_event(IntPtr evnt, out double x, out double y, out double delta_x, out double delta_y);

		public static bool EventParseMouseScrollEvent(Gst.Event evnt, out double x, out double y, out double delta_x, out double delta_y) {
			bool raw_ret = gst_navigation_event_parse_mouse_scroll_event(evnt == null ? IntPtr.Zero : evnt.Handle, out x, out y, out delta_x, out delta_y);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_navigation_message_get_type(IntPtr message);

		public static Gst.Video.NavigationMessageType MessageGetType(Gst.Message message) {
			int raw_ret = gst_navigation_message_get_type(message == null ? IntPtr.Zero : message.Handle);
			Gst.Video.NavigationMessageType ret = (Gst.Video.NavigationMessageType) raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_message_new_angles_changed(IntPtr src, uint cur_angle, uint n_angles);

		public static Gst.Message MessageNewAnglesChanged(Gst.Object src, uint cur_angle, uint n_angles) {
			IntPtr raw_ret = gst_navigation_message_new_angles_changed(src == null ? IntPtr.Zero : src.Handle, cur_angle, n_angles);
			Gst.Message ret = raw_ret == IntPtr.Zero ? null : (Gst.Message) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Message), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_message_new_commands_changed(IntPtr src);

		public static Gst.Message MessageNewCommandsChanged(Gst.Object src) {
			IntPtr raw_ret = gst_navigation_message_new_commands_changed(src == null ? IntPtr.Zero : src.Handle);
			Gst.Message ret = raw_ret == IntPtr.Zero ? null : (Gst.Message) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Message), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_message_new_event(IntPtr src, IntPtr evnt);

		public static Gst.Message MessageNewEvent(Gst.Object src, Gst.Event evnt) {
			IntPtr raw_ret = gst_navigation_message_new_event(src == null ? IntPtr.Zero : src.Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
			Gst.Message ret = raw_ret == IntPtr.Zero ? null : (Gst.Message) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Message), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_message_new_mouse_over(IntPtr src, bool active);

		public static Gst.Message MessageNewMouseOver(Gst.Object src, bool active) {
			IntPtr raw_ret = gst_navigation_message_new_mouse_over(src == null ? IntPtr.Zero : src.Handle, active);
			Gst.Message ret = raw_ret == IntPtr.Zero ? null : (Gst.Message) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Message), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_message_parse_angles_changed(IntPtr message, out uint cur_angle, out uint n_angles);

		public static bool MessageParseAnglesChanged(Gst.Message message, out uint cur_angle, out uint n_angles) {
			bool raw_ret = gst_navigation_message_parse_angles_changed(message == null ? IntPtr.Zero : message.Handle, out cur_angle, out n_angles);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_message_parse_event(IntPtr message, out IntPtr evnt);

		public static bool MessageParseEvent(Gst.Message message, out Gst.Event evnt) {
			IntPtr native_evnt;
			bool raw_ret = gst_navigation_message_parse_event(message == null ? IntPtr.Zero : message.Handle, out native_evnt);
			bool ret = raw_ret;
			evnt = native_evnt == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque (native_evnt, typeof (Gst.Event), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_message_parse_mouse_over(IntPtr message, out bool active);

		public static bool MessageParseMouseOver(Gst.Message message, out bool active) {
			bool raw_ret = gst_navigation_message_parse_mouse_over(message == null ? IntPtr.Zero : message.Handle, out active);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int gst_navigation_query_get_type(IntPtr query);

		public static Gst.Video.NavigationQueryType QueryGetType(Gst.Query query) {
			int raw_ret = gst_navigation_query_get_type(query == null ? IntPtr.Zero : query.Handle);
			Gst.Video.NavigationQueryType ret = (Gst.Video.NavigationQueryType) raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_query_new_angles();

		public static Gst.Query QueryNewAngles() {
			IntPtr raw_ret = gst_navigation_query_new_angles();
			Gst.Query ret = raw_ret == IntPtr.Zero ? null : (Gst.Query) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Query), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr gst_navigation_query_new_commands();

		public static Gst.Query QueryNewCommands() {
			IntPtr raw_ret = gst_navigation_query_new_commands();
			Gst.Query ret = raw_ret == IntPtr.Zero ? null : (Gst.Query) GLib.Opaque.GetOpaque (raw_ret, typeof (Gst.Query), true);
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_query_parse_angles(IntPtr query, out uint cur_angle, out uint n_angles);

		public static bool QueryParseAngles(Gst.Query query, out uint cur_angle, out uint n_angles) {
			bool raw_ret = gst_navigation_query_parse_angles(query == null ? IntPtr.Zero : query.Handle, out cur_angle, out n_angles);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_query_parse_commands_length(IntPtr query, out uint n_cmds);

		public static bool QueryParseCommandsLength(Gst.Query query, out uint n_cmds) {
			bool raw_ret = gst_navigation_query_parse_commands_length(query == null ? IntPtr.Zero : query.Handle, out n_cmds);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool gst_navigation_query_parse_commands_nth(IntPtr query, uint nth, out int cmd);

		public static bool QueryParseCommandsNth(Gst.Query query, uint nth, out Gst.Video.NavigationCommand cmd) {
			int native_cmd;
			bool raw_ret = gst_navigation_query_parse_commands_nth(query == null ? IntPtr.Zero : query.Handle, nth, out native_cmd);
			bool ret = raw_ret;
			cmd = (Gst.Video.NavigationCommand) native_cmd;
			return ret;
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_query_set_angles(IntPtr query, uint cur_angle, uint n_angles);

		public static void QuerySetAngles(Gst.Query query, uint cur_angle, uint n_angles) {
			gst_navigation_query_set_angles(query == null ? IntPtr.Zero : query.Handle, cur_angle, n_angles);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_query_set_commandsv(IntPtr query, int n_cmds, int[] cmds);

		public static void QuerySetCommandsv(Gst.Query query, Gst.Video.NavigationCommand[] cmds) {
			int cnt_cmds = cmds == null ? 0 : cmds.Length;
			int[] native_cmds = new int [cnt_cmds];
			for (int i = 0; i < cnt_cmds; i++)
				native_cmds [i] = (int) cmds[i];
			gst_navigation_query_set_commandsv(query == null ? IntPtr.Zero : query.Handle, (cmds == null ? 0 : cmds.Length), native_cmds);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_send_command(IntPtr raw, int command);

		public void SendCommand(Gst.Video.NavigationCommand command) {
			gst_navigation_send_command(Handle, (int) command);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_send_event(IntPtr raw, IntPtr structure);

		public void SendEvent(Gst.Structure structure) {
			gst_navigation_send_event(Handle, structure == null ? IntPtr.Zero : structure.Handle);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_send_key_event(IntPtr raw, IntPtr evnt, IntPtr key);

		public void SendKeyEvent(string evnt, string key) {
			IntPtr native_evnt = GLib.Marshaller.StringToPtrGStrdup (evnt);
			IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
			gst_navigation_send_key_event(Handle, native_evnt, native_key);
			GLib.Marshaller.Free (native_evnt);
			GLib.Marshaller.Free (native_key);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_send_mouse_event(IntPtr raw, IntPtr evnt, int button, double x, double y);

		public void SendMouseEvent(string evnt, int button, double x, double y) {
			IntPtr native_evnt = GLib.Marshaller.StringToPtrGStrdup (evnt);
			gst_navigation_send_mouse_event(Handle, native_evnt, button, x, y);
			GLib.Marshaller.Free (native_evnt);
		}

		[DllImport("gstvideo-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void gst_navigation_send_mouse_scroll_event(IntPtr raw, double x, double y, double delta_x, double delta_y);

		public void SendMouseScrollEvent(double x, double y, double delta_x, double delta_y) {
			gst_navigation_send_mouse_scroll_event(Handle, x, y, delta_x, delta_y);
		}

#endregion
	}
}
