1 // This file was generated by the Gtk# code generator.
2 // Any changes made will be lost if regenerated.
7 using System.Runtime.InteropServices;
9 #region Autogenerated code
10 public partial class ChildProxyAdapter : GLib.GInterfaceAdapter, Gst.IChildProxy {
12 [StructLayout (LayoutKind.Sequential)]
13 struct GstChildProxyInterface {
14 public GetChildByNameNativeDelegate GetChildByName;
15 public GetChildByIndexNativeDelegate GetChildByIndex;
16 public GetChildrenCountNativeDelegate GetChildrenCount;
17 IntPtr ChildAddedEvent;
18 IntPtr ChildRemovedEvent;
19 [MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
20 private IntPtr[] _gstGstReserved;
23 static GstChildProxyInterface iface;
25 static ChildProxyAdapter ()
27 GLib.GType.Register (_gtype, typeof (ChildProxyAdapter));
28 iface.GetChildByName = new GetChildByNameNativeDelegate (GetChildByName_cb);
29 iface.GetChildByIndex = new GetChildByIndexNativeDelegate (GetChildByIndex_cb);
30 iface.GetChildrenCount = new GetChildrenCountNativeDelegate (GetChildrenCount_cb);
33 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
34 delegate IntPtr GetChildByNameNativeDelegate (IntPtr inst, IntPtr name);
36 static IntPtr GetChildByName_cb (IntPtr inst, IntPtr name)
39 IChildProxyImplementor __obj = GLib.Object.GetObject (inst, false) as IChildProxyImplementor;
41 __result = __obj.GetChildByName (GLib.Marshaller.Utf8PtrToString (name));
42 return __result == null ? IntPtr.Zero : __result.Handle;
43 } catch (Exception e) {
44 GLib.ExceptionManager.RaiseUnhandledException (e, true);
45 // NOTREACHED: above call does not return.
50 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
51 delegate IntPtr GetChildByIndexNativeDelegate (IntPtr inst, uint index);
53 static IntPtr GetChildByIndex_cb (IntPtr inst, uint index)
56 IChildProxyImplementor __obj = GLib.Object.GetObject (inst, false) as IChildProxyImplementor;
58 __result = __obj.GetChildByIndex (index);
59 return __result == null ? IntPtr.Zero : __result.Handle;
60 } catch (Exception e) {
61 GLib.ExceptionManager.RaiseUnhandledException (e, true);
62 // NOTREACHED: above call does not return.
67 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
68 delegate uint GetChildrenCountNativeDelegate (IntPtr inst);
70 static uint GetChildrenCount_cb (IntPtr inst)
73 IChildProxyImplementor __obj = GLib.Object.GetObject (inst, false) as IChildProxyImplementor;
75 __result = __obj.ChildrenCount;
77 } catch (Exception e) {
78 GLib.ExceptionManager.RaiseUnhandledException (e, true);
79 // NOTREACHED: above call does not return.
84 static int class_offset = 2 * IntPtr.Size;
86 static void Initialize (IntPtr ptr, IntPtr data)
88 IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
89 GstChildProxyInterface native_iface = (GstChildProxyInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstChildProxyInterface));
90 native_iface.GetChildByName = iface.GetChildByName;
91 native_iface.GetChildByIndex = iface.GetChildByIndex;
92 native_iface.GetChildrenCount = iface.GetChildrenCount;
93 Marshal.StructureToPtr (native_iface, ifaceptr, false);
96 GLib.Object implementor;
98 public ChildProxyAdapter ()
100 InitHandler = new GLib.GInterfaceInitHandler (Initialize);
103 public ChildProxyAdapter (IChildProxyImplementor implementor)
105 if (implementor == null)
106 throw new ArgumentNullException ("implementor");
107 else if (!(implementor is GLib.Object))
108 throw new ArgumentException ("implementor must be a subclass of GLib.Object");
109 this.implementor = implementor as GLib.Object;
112 public ChildProxyAdapter (IntPtr handle)
114 if (!_gtype.IsInstance (handle))
115 throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
116 implementor = GLib.Object.GetObject (handle);
119 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
120 static extern IntPtr gst_child_proxy_get_type();
122 private static GLib.GType _gtype = new GLib.GType (gst_child_proxy_get_type ());
124 public static GLib.GType GType {
130 public override GLib.GType GInterfaceGType {
136 public override IntPtr Handle {
138 return implementor.Handle;
142 public IntPtr OwnedHandle {
144 return implementor.OwnedHandle;
148 public static IChildProxy GetObject (IntPtr handle, bool owned)
150 GLib.Object obj = GLib.Object.GetObject (handle, owned);
151 return GetObject (obj);
154 public static IChildProxy GetObject (GLib.Object obj)
158 else if (obj is IChildProxyImplementor)
159 return new ChildProxyAdapter (obj as IChildProxyImplementor);
160 else if (obj as IChildProxy == null)
161 return new ChildProxyAdapter (obj.Handle);
163 return obj as IChildProxy;
166 public IChildProxyImplementor Implementor {
168 return implementor as IChildProxyImplementor;
172 [GLib.Signal("child-removed")]
173 public event Gst.ChildRemovedEventHandler ChildRemovedEvent {
175 GLib.Object.GetObject (Handle).AddSignalHandler ("child-removed", value, typeof (Gst.ChildRemovedEventArgs));
178 GLib.Object.GetObject (Handle).RemoveSignalHandler ("child-removed", value);
182 [GLib.Signal("child-added")]
183 public event Gst.ChildAddedEventHandler ChildAddedEvent {
185 GLib.Object.GetObject (Handle).AddSignalHandler ("child-added", value, typeof (Gst.ChildAddedEventArgs));
188 GLib.Object.GetObject (Handle).RemoveSignalHandler ("child-added", value);
192 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
193 static extern void gst_child_proxy_child_added(IntPtr raw, IntPtr child, IntPtr name);
195 public void ChildAdded(GLib.Object child, string name) {
196 IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
197 gst_child_proxy_child_added(Handle, child == null ? IntPtr.Zero : child.Handle, native_name);
198 GLib.Marshaller.Free (native_name);
201 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
202 static extern void gst_child_proxy_child_removed(IntPtr raw, IntPtr child, IntPtr name);
204 public void ChildRemoved(GLib.Object child, string name) {
205 IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
206 gst_child_proxy_child_removed(Handle, child == null ? IntPtr.Zero : child.Handle, native_name);
207 GLib.Marshaller.Free (native_name);
210 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
211 static extern IntPtr gst_child_proxy_get_child_by_index(IntPtr raw, uint index);
213 public GLib.Object GetChildByIndex(uint index) {
214 IntPtr raw_ret = gst_child_proxy_get_child_by_index(Handle, index);
215 GLib.Object ret = GLib.Object.GetObject (raw_ret);
219 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
220 static extern IntPtr gst_child_proxy_get_child_by_name(IntPtr raw, IntPtr name);
222 public GLib.Object GetChildByName(string name) {
223 IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
224 IntPtr raw_ret = gst_child_proxy_get_child_by_name(Handle, native_name);
225 GLib.Object ret = GLib.Object.GetObject (raw_ret);
226 GLib.Marshaller.Free (native_name);
230 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
231 static extern uint gst_child_proxy_get_children_count(IntPtr raw);
233 public uint ChildrenCount {
235 uint raw_ret = gst_child_proxy_get_children_count(Handle);
241 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
242 static extern bool gst_child_proxy_lookup(IntPtr raw, IntPtr name, out IntPtr target, out IntPtr pspec);
244 public bool Lookup(string name, out GLib.Object target, out IntPtr pspec) {
245 IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
246 IntPtr native_target;
247 bool raw_ret = gst_child_proxy_lookup(Handle, native_name, out native_target, out pspec);
249 GLib.Marshaller.Free (native_name);
250 target = GLib.Object.GetObject (native_target);