File: Atk_ComponentAdapter.cs

package info (click to toggle)
gnome-subtitles 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 103,144 kB
  • sloc: xml: 406,395; cs: 364,495; ansic: 3,104; perl: 1,477; sh: 769; python: 545; javascript: 500; makefile: 49
file content (521 lines) | stat: -rw-r--r-- 18,118 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Atk {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class ComponentAdapter : GLib.GInterfaceAdapter, Atk.IComponent {

		[StructLayout (LayoutKind.Sequential)]
		struct AtkComponentIface {
			public AddFocusHandlerNativeDelegate AddFocusHandler;
			public ContainsNativeDelegate Contains;
			public RefAccessibleAtPointNativeDelegate RefAccessibleAtPoint;
			public GetExtentsNativeDelegate GetExtents;
			public GetPositionNativeDelegate GetPosition;
			public GetSizeNativeDelegate GetSize;
			public GrabFocusNativeDelegate GrabFocus;
			public RemoveFocusHandlerNativeDelegate RemoveFocusHandler;
			public SetExtentsNativeDelegate SetExtents;
			public SetPositionNativeDelegate SetPosition;
			public SetSizeNativeDelegate SetSize;
			public GetLayerNativeDelegate GetLayer;
			public GetMdiZorderNativeDelegate GetMdiZorder;
			IntPtr BoundsChanged;
			public GetAlphaNativeDelegate GetAlpha;
		}

		static AtkComponentIface iface;

		static ComponentAdapter ()
		{
			GLib.GType.Register (_gtype, typeof (ComponentAdapter));
			iface.AddFocusHandler = new AddFocusHandlerNativeDelegate (AddFocusHandler_cb);
			iface.Contains = new ContainsNativeDelegate (Contains_cb);
			iface.RefAccessibleAtPoint = new RefAccessibleAtPointNativeDelegate (RefAccessibleAtPoint_cb);
			iface.GetExtents = new GetExtentsNativeDelegate (GetExtents_cb);
			iface.GetPosition = new GetPositionNativeDelegate (GetPosition_cb);
			iface.GetSize = new GetSizeNativeDelegate (GetSize_cb);
			iface.GrabFocus = new GrabFocusNativeDelegate (GrabFocus_cb);
			iface.RemoveFocusHandler = new RemoveFocusHandlerNativeDelegate (RemoveFocusHandler_cb);
			iface.SetExtents = new SetExtentsNativeDelegate (SetExtents_cb);
			iface.SetPosition = new SetPositionNativeDelegate (SetPosition_cb);
			iface.SetSize = new SetSizeNativeDelegate (SetSize_cb);
			iface.GetLayer = new GetLayerNativeDelegate (GetLayer_cb);
			iface.GetMdiZorder = new GetMdiZorderNativeDelegate (GetMdiZorder_cb);
			iface.GetAlpha = new GetAlphaNativeDelegate (GetAlpha_cb);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate uint AddFocusHandlerNativeDelegate (IntPtr inst, AtkSharp.FocusHandlerNative handler);

		static uint AddFocusHandler_cb (IntPtr inst, AtkSharp.FocusHandlerNative handler)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				uint __result;
				AtkSharp.FocusHandlerInvoker handler_invoker = new AtkSharp.FocusHandlerInvoker (handler);
				__result = __obj.AddFocusHandler (handler_invoker.Handler);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool ContainsNativeDelegate (IntPtr inst, int x, int y, int coord_type);

		static bool Contains_cb (IntPtr inst, int x, int y, int coord_type)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				bool __result;
				__result = __obj.Contains (x, y, (Atk.CoordType) coord_type);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr RefAccessibleAtPointNativeDelegate (IntPtr inst, int x, int y, int coord_type);

		static IntPtr RefAccessibleAtPoint_cb (IntPtr inst, int x, int y, int coord_type)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				Atk.Object __result;
				__result = __obj.RefAccessibleAtPoint (x, y, (Atk.CoordType) coord_type);
				return __result == null ? IntPtr.Zero : __result.OwnedHandle;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void GetExtentsNativeDelegate (IntPtr inst, out int x, out int y, out int width, out int height, int coord_type);

		static void GetExtents_cb (IntPtr inst, out int x, out int y, out int width, out int height, int coord_type)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				__obj.GetExtents (out x, out y, out width, out height, (Atk.CoordType) coord_type);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void GetPositionNativeDelegate (IntPtr inst, out int x, out int y, int coord_type);

		static void GetPosition_cb (IntPtr inst, out int x, out int y, int coord_type)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				__obj.GetPosition (out x, out y, (Atk.CoordType) coord_type);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void GetSizeNativeDelegate (IntPtr inst, out int width, out int height);

		static void GetSize_cb (IntPtr inst, out int width, out int height)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				__obj.GetSize (out width, out height);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool GrabFocusNativeDelegate (IntPtr inst);

		static bool GrabFocus_cb (IntPtr inst)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				bool __result;
				__result = __obj.GrabFocus ();
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void RemoveFocusHandlerNativeDelegate (IntPtr inst, uint handler_id);

		static void RemoveFocusHandler_cb (IntPtr inst, uint handler_id)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				__obj.RemoveFocusHandler (handler_id);
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, false);
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetExtentsNativeDelegate (IntPtr inst, int x, int y, int width, int height, int coord_type);

		static bool SetExtents_cb (IntPtr inst, int x, int y, int width, int height, int coord_type)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				bool __result;
				__result = __obj.SetExtents (x, y, width, height, (Atk.CoordType) coord_type);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetPositionNativeDelegate (IntPtr inst, int x, int y, int coord_type);

		static bool SetPosition_cb (IntPtr inst, int x, int y, int coord_type)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				bool __result;
				__result = __obj.SetPosition (x, y, (Atk.CoordType) coord_type);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool SetSizeNativeDelegate (IntPtr inst, int width, int height);

		static bool SetSize_cb (IntPtr inst, int width, int height)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				bool __result;
				__result = __obj.SetSize (width, height);
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetLayerNativeDelegate (IntPtr inst);

		static int GetLayer_cb (IntPtr inst)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				Atk.Layer __result;
				__result = __obj.Layer;
				return (int) __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int GetMdiZorderNativeDelegate (IntPtr inst);

		static int GetMdiZorder_cb (IntPtr inst)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				int __result;
				__result = __obj.MdiZorder;
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate double GetAlphaNativeDelegate (IntPtr inst);

		static double GetAlpha_cb (IntPtr inst)
		{
			try {
				IComponentImplementor __obj = GLib.Object.GetObject (inst, false) as IComponentImplementor;
				double __result;
				__result = __obj.Alpha;
				return __result;
			} catch (Exception e) {
				GLib.ExceptionManager.RaiseUnhandledException (e, true);
				// NOTREACHED: above call does not return.
				throw e;
			}
		}

		static int class_offset = 2 * IntPtr.Size;

		static void Initialize (IntPtr ptr, IntPtr data)
		{
			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
			AtkComponentIface native_iface = (AtkComponentIface) Marshal.PtrToStructure (ifaceptr, typeof (AtkComponentIface));
			native_iface.AddFocusHandler = iface.AddFocusHandler;
			native_iface.Contains = iface.Contains;
			native_iface.RefAccessibleAtPoint = iface.RefAccessibleAtPoint;
			native_iface.GetExtents = iface.GetExtents;
			native_iface.GetPosition = iface.GetPosition;
			native_iface.GetSize = iface.GetSize;
			native_iface.GrabFocus = iface.GrabFocus;
			native_iface.RemoveFocusHandler = iface.RemoveFocusHandler;
			native_iface.SetExtents = iface.SetExtents;
			native_iface.SetPosition = iface.SetPosition;
			native_iface.SetSize = iface.SetSize;
			native_iface.GetLayer = iface.GetLayer;
			native_iface.GetMdiZorder = iface.GetMdiZorder;
			native_iface.GetAlpha = iface.GetAlpha;
			Marshal.StructureToPtr (native_iface, ifaceptr, false);
		}

		GLib.Object implementor;

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

		public ComponentAdapter (IComponentImplementor 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 ComponentAdapter (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("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr atk_component_get_type();

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

		public static IComponent GetObject (GLib.Object obj)
		{
			if (obj == null)
				return null;
			else if (obj is IComponentImplementor)
				return new ComponentAdapter (obj as IComponentImplementor);
			else if (obj as IComponent == null)
				return new ComponentAdapter (obj.Handle);
			else
				return obj as IComponent;
		}

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

		[GLib.Signal("bounds_changed")]
		public event Atk.BoundsChangedHandler BoundsChanged {
			add {
				GLib.Object.GetObject (Handle).AddSignalHandler ("bounds_changed", value, typeof (Atk.BoundsChangedArgs));
			}
			remove {
				GLib.Object.GetObject (Handle).RemoveSignalHandler ("bounds_changed", value);
			}
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern uint atk_component_add_focus_handler(IntPtr raw, AtkSharp.FocusHandlerNative handler);

		[Obsolete]
		public uint AddFocusHandler(Atk.FocusHandler handler) {
			AtkSharp.FocusHandlerWrapper handler_wrapper = new AtkSharp.FocusHandlerWrapper (handler);
			uint raw_ret = atk_component_add_focus_handler(Handle, handler_wrapper.NativeDelegate);
			uint ret = raw_ret;
			return ret;
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool atk_component_contains(IntPtr raw, int x, int y, int coord_type);

		public bool Contains(int x, int y, Atk.CoordType coord_type) {
			bool raw_ret = atk_component_contains(Handle, x, y, (int) coord_type);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern double atk_component_get_alpha(IntPtr raw);

		public double Alpha { 
			get {
				double raw_ret = atk_component_get_alpha(Handle);
				double ret = raw_ret;
				return ret;
			}
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void atk_component_get_extents(IntPtr raw, out int x, out int y, out int width, out int height, int coord_type);

		public void GetExtents(out int x, out int y, out int width, out int height, Atk.CoordType coord_type) {
			atk_component_get_extents(Handle, out x, out y, out width, out height, (int) coord_type);
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int atk_component_get_layer(IntPtr raw);

		public Atk.Layer Layer { 
			get {
				int raw_ret = atk_component_get_layer(Handle);
				Atk.Layer ret = (Atk.Layer) raw_ret;
				return ret;
			}
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern int atk_component_get_mdi_zorder(IntPtr raw);

		public int MdiZorder { 
			get {
				int raw_ret = atk_component_get_mdi_zorder(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void atk_component_get_position(IntPtr raw, out int x, out int y, int coord_type);

		[Obsolete]
		public void GetPosition(out int x, out int y, Atk.CoordType coord_type) {
			atk_component_get_position(Handle, out x, out y, (int) coord_type);
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void atk_component_get_size(IntPtr raw, out int width, out int height);

		[Obsolete]
		public void GetSize(out int width, out int height) {
			atk_component_get_size(Handle, out width, out height);
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool atk_component_grab_focus(IntPtr raw);

		public bool GrabFocus() {
			bool raw_ret = atk_component_grab_focus(Handle);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern IntPtr atk_component_ref_accessible_at_point(IntPtr raw, int x, int y, int coord_type);

		public Atk.Object RefAccessibleAtPoint(int x, int y, Atk.CoordType coord_type) {
			IntPtr raw_ret = atk_component_ref_accessible_at_point(Handle, x, y, (int) coord_type);
			Atk.Object ret = GLib.Object.GetObject(raw_ret, true) as Atk.Object;
			return ret;
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern void atk_component_remove_focus_handler(IntPtr raw, uint handler_id);

		[Obsolete]
		public void RemoveFocusHandler(uint handler_id) {
			atk_component_remove_focus_handler(Handle, handler_id);
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool atk_component_set_extents(IntPtr raw, int x, int y, int width, int height, int coord_type);

		public bool SetExtents(int x, int y, int width, int height, Atk.CoordType coord_type) {
			bool raw_ret = atk_component_set_extents(Handle, x, y, width, height, (int) coord_type);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool atk_component_set_position(IntPtr raw, int x, int y, int coord_type);

		public bool SetPosition(int x, int y, Atk.CoordType coord_type) {
			bool raw_ret = atk_component_set_position(Handle, x, y, (int) coord_type);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("atk-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
		static extern bool atk_component_set_size(IntPtr raw, int width, int height);

		public bool SetSize(int width, int height) {
			bool raw_ret = atk_component_set_size(Handle, width, height);
			bool ret = raw_ret;
			return ret;
		}

#endregion
	}
}