Back to development
[platform/upstream/gstreamer.git] / subprojects / gstreamer-sharp / sources / generated / Gst / ChildProxyAdapter.cs
1 // This file was generated by the Gtk# code generator.
2 // Any changes made will be lost if regenerated.
3
4 namespace Gst {
5
6         using System;
7         using System.Runtime.InteropServices;
8
9 #region Autogenerated code
10         public partial class ChildProxyAdapter : GLib.GInterfaceAdapter, Gst.IChildProxy {
11
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;
21                 }
22
23                 static GstChildProxyInterface iface;
24
25                 static ChildProxyAdapter ()
26                 {
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);
31                 }
32
33                 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
34                 delegate IntPtr GetChildByNameNativeDelegate (IntPtr inst, IntPtr name);
35
36                 static IntPtr GetChildByName_cb (IntPtr inst, IntPtr name)
37                 {
38                         try {
39                                 IChildProxyImplementor __obj = GLib.Object.GetObject (inst, false) as IChildProxyImplementor;
40                                 GLib.Object __result;
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.
46                                 throw e;
47                         }
48                 }
49
50                 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
51                 delegate IntPtr GetChildByIndexNativeDelegate (IntPtr inst, uint index);
52
53                 static IntPtr GetChildByIndex_cb (IntPtr inst, uint index)
54                 {
55                         try {
56                                 IChildProxyImplementor __obj = GLib.Object.GetObject (inst, false) as IChildProxyImplementor;
57                                 GLib.Object __result;
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.
63                                 throw e;
64                         }
65                 }
66
67                 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
68                 delegate uint GetChildrenCountNativeDelegate (IntPtr inst);
69
70                 static uint GetChildrenCount_cb (IntPtr inst)
71                 {
72                         try {
73                                 IChildProxyImplementor __obj = GLib.Object.GetObject (inst, false) as IChildProxyImplementor;
74                                 uint __result;
75                                 __result = __obj.ChildrenCount;
76                                 return __result;
77                         } catch (Exception e) {
78                                 GLib.ExceptionManager.RaiseUnhandledException (e, true);
79                                 // NOTREACHED: above call does not return.
80                                 throw e;
81                         }
82                 }
83
84                 static int class_offset = 2 * IntPtr.Size;
85
86                 static void Initialize (IntPtr ptr, IntPtr data)
87                 {
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);
94                 }
95
96                 GLib.Object implementor;
97
98                 public ChildProxyAdapter ()
99                 {
100                         InitHandler = new GLib.GInterfaceInitHandler (Initialize);
101                 }
102
103                 public ChildProxyAdapter (IChildProxyImplementor implementor)
104                 {
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;
110                 }
111
112                 public ChildProxyAdapter (IntPtr handle)
113                 {
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);
117                 }
118
119                 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
120                 static extern IntPtr gst_child_proxy_get_type();
121
122                 private static GLib.GType _gtype = new GLib.GType (gst_child_proxy_get_type ());
123
124                 public static GLib.GType GType {
125                         get {
126                                 return _gtype;
127                         }
128                 }
129
130                 public override GLib.GType GInterfaceGType {
131                         get {
132                                 return _gtype;
133                         }
134                 }
135
136                 public override IntPtr Handle {
137                         get {
138                                 return implementor.Handle;
139                         }
140                 }
141
142                 public IntPtr OwnedHandle {
143                         get {
144                                 return implementor.OwnedHandle;
145                         }
146                 }
147
148                 public static IChildProxy GetObject (IntPtr handle, bool owned)
149                 {
150                         GLib.Object obj = GLib.Object.GetObject (handle, owned);
151                         return GetObject (obj);
152                 }
153
154                 public static IChildProxy GetObject (GLib.Object obj)
155                 {
156                         if (obj == null)
157                                 return null;
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);
162                         else
163                                 return obj as IChildProxy;
164                 }
165
166                 public IChildProxyImplementor Implementor {
167                         get {
168                                 return implementor as IChildProxyImplementor;
169                         }
170                 }
171
172                 [GLib.Signal("child-removed")]
173                 public event Gst.ChildRemovedEventHandler ChildRemovedEvent {
174                         add {
175                                 GLib.Object.GetObject (Handle).AddSignalHandler ("child-removed", value, typeof (Gst.ChildRemovedEventArgs));
176                         }
177                         remove {
178                                 GLib.Object.GetObject (Handle).RemoveSignalHandler ("child-removed", value);
179                         }
180                 }
181
182                 [GLib.Signal("child-added")]
183                 public event Gst.ChildAddedEventHandler ChildAddedEvent {
184                         add {
185                                 GLib.Object.GetObject (Handle).AddSignalHandler ("child-added", value, typeof (Gst.ChildAddedEventArgs));
186                         }
187                         remove {
188                                 GLib.Object.GetObject (Handle).RemoveSignalHandler ("child-added", value);
189                         }
190                 }
191
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);
194
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);
199                 }
200
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);
203
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);
208                 }
209
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);
212
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);
216                         return ret;
217                 }
218
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);
221
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);
227                         return ret;
228                 }
229
230                 [DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
231                 static extern uint gst_child_proxy_get_children_count(IntPtr raw);
232
233                 public uint ChildrenCount { 
234                         get {
235                                 uint raw_ret = gst_child_proxy_get_children_count(Handle);
236                                 uint ret = raw_ret;
237                                 return ret;
238                         }
239                 }
240
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);
243
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);
248                         bool ret = raw_ret;
249                         GLib.Marshaller.Free (native_name);
250                         target = GLib.Object.GetObject (native_target);
251                         return ret;
252                 }
253
254 #endregion
255         }
256 }