gstreamer/gstreamer-sharp/override/NavigationAdapter.cs

162 lines
5.2 KiB
C#
Raw Normal View History

2009-05-14 14:50:16 +00:00
// This file was generated by the Gtk# code generator.
2009-09-11 08:08:06 +00:00
// Any changes made will be lost if regenerated.
2009-05-14 14:50:16 +00:00
namespace Gst.Interfaces {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
2009-09-11 08:08:06 +00:00
public partial class NavigationAdapter : Gst.GLib.GInterfaceAdapter, Gst.Interfaces.Navigation {
2009-05-14 14:50:16 +00:00
[StructLayout (LayoutKind.Sequential)]
struct GstNavigationInterface {
public SendEventNativeDelegate SendEvent;
[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
public IntPtr[] GstReserved;
}
static GstNavigationInterface iface;
static NavigationAdapter ()
{
2009-09-11 08:08:06 +00:00
Gst.GLib.GType.Register (_gtype, typeof(NavigationAdapter));
2009-05-14 14:50:16 +00:00
iface.SendEvent = new SendEventNativeDelegate (SendEvent_cb);
}
2009-09-11 08:08:06 +00:00
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
delegate void SendEventNativeDelegate (IntPtr inst, IntPtr structure);
static void SendEvent_cb (IntPtr inst, IntPtr structure)
{
try {
2009-09-11 08:08:06 +00:00
NavigationImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as NavigationImplementor;
__obj.SendEvent (structure == IntPtr.Zero ? null : (Gst.Structure) Gst.GLib.Opaque.GetOpaque (structure, typeof (Gst.Structure), true));
2009-05-14 14:50:16 +00:00
} catch (Exception e) {
2009-09-11 08:08:06 +00:00
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false);
2009-05-14 14:50:16 +00:00
}
}
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);
GCHandle gch = (GCHandle) data;
gch.Free ();
}
2009-09-11 08:08:06 +00:00
Gst.GLib.Object implementor;
2009-05-14 14:50:16 +00:00
public NavigationAdapter ()
{
2009-09-11 08:08:06 +00:00
InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize);
2009-05-14 14:50:16 +00:00
}
public NavigationAdapter (NavigationImplementor implementor)
{
if (implementor == null)
throw new ArgumentNullException ("implementor");
2009-09-11 08:08:06 +00:00
else if (!(implementor is Gst.GLib.Object))
throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object");
this.implementor = implementor as Gst.GLib.Object;
2009-05-14 14:50:16 +00:00
}
public NavigationAdapter (IntPtr handle)
{
if (!_gtype.IsInstance (handle))
throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
2009-09-11 08:08:06 +00:00
implementor = Gst.GLib.Object.GetObject (handle);
2009-05-14 14:50:16 +00:00
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
static extern IntPtr gst_navigation_get_type();
2009-09-11 08:08:06 +00:00
private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_navigation_get_type ());
2009-05-14 14:50:16 +00:00
2009-09-11 08:08:06 +00:00
public override Gst.GLib.GType GType {
2009-05-14 14:50:16 +00:00
get {
return _gtype;
}
}
public override IntPtr Handle {
get {
2009-09-11 08:08:06 +00:00
return implementor.Handle;
}
}
public IntPtr OwnedHandle {
get {
return implementor.OwnedHandle;
2009-05-14 14:50:16 +00:00
}
}
public static Navigation GetObject (IntPtr handle, bool owned)
{
2009-09-11 08:08:06 +00:00
Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned);
2009-05-14 14:50:16 +00:00
return GetObject (obj);
}
2009-09-11 08:08:06 +00:00
public static Navigation GetObject (Gst.GLib.Object obj)
2009-05-14 14:50:16 +00:00
{
if (obj == null)
return null;
else if (obj is NavigationImplementor)
return new NavigationAdapter (obj as NavigationImplementor);
else if (obj as Navigation == null)
return new NavigationAdapter (obj.Handle);
else
return obj as Navigation;
}
public NavigationImplementor Implementor {
get {
2009-09-11 08:08:06 +00:00
return implementor as NavigationImplementor;
2009-05-14 14:50:16 +00:00
}
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
static extern void gst_navigation_send_event(IntPtr raw, IntPtr structure);
2009-09-11 08:08:06 +00:00
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
static extern IntPtr gst_structure_copy (IntPtr raw);
public void SendEvent(Gst.Structure structure) {
gst_navigation_send_event(Handle, structure == null ? IntPtr.Zero : gst_structure_copy (structure.Handle));
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
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) {
2009-09-11 08:08:06 +00:00
IntPtr native_evnt = Gst.GLib.Marshaller.StringToPtrGStrdup (evnt);
2009-05-14 14:50:16 +00:00
gst_navigation_send_mouse_event(Handle, native_evnt, button, x, y);
2009-09-11 08:08:06 +00:00
Gst.GLib.Marshaller.Free (native_evnt);
2009-05-14 14:50:16 +00:00
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
static extern void gst_navigation_send_key_event(IntPtr raw, IntPtr evnt, IntPtr key);
public void SendKeyEvent(string evnt, string key) {
2009-09-11 08:08:06 +00:00
IntPtr native_evnt = Gst.GLib.Marshaller.StringToPtrGStrdup (evnt);
IntPtr native_key = Gst.GLib.Marshaller.StringToPtrGStrdup (key);
2009-05-14 14:50:16 +00:00
gst_navigation_send_key_event(Handle, native_evnt, native_key);
2009-09-11 08:08:06 +00:00
Gst.GLib.Marshaller.Free (native_evnt);
Gst.GLib.Marshaller.Free (native_key);
2009-05-14 14:50:16 +00:00
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
2009-05-14 14:50:16 +00:00
static extern void gst_navigation_send_command(IntPtr raw, int command);
public void SendCommand(Gst.Interfaces.NavigationCommand command) {
gst_navigation_send_command(Handle, (int) command);
}
#endregion
}
}