// 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 EditableTextAdapter : GLib.GInterfaceAdapter, Atk.IEditableText { [StructLayout (LayoutKind.Sequential)] struct AtkEditableTextIface { public SetRunAttributesNativeDelegate SetRunAttributes; public SetTextContentsNativeDelegate SetTextContents; public InsertTextNativeDelegate InsertText; public CopyTextNativeDelegate CopyText; public CutTextNativeDelegate CutText; public DeleteTextNativeDelegate DeleteText; public PasteTextNativeDelegate PasteText; } static AtkEditableTextIface iface; static EditableTextAdapter () { GLib.GType.Register (_gtype, typeof (EditableTextAdapter)); iface.SetRunAttributes = new SetRunAttributesNativeDelegate (SetRunAttributes_cb); iface.SetTextContents = new SetTextContentsNativeDelegate (SetTextContents_cb); iface.InsertText = new InsertTextNativeDelegate (InsertText_cb); iface.CopyText = new CopyTextNativeDelegate (CopyText_cb); iface.CutText = new CutTextNativeDelegate (CutText_cb); iface.DeleteText = new DeleteTextNativeDelegate (DeleteText_cb); iface.PasteText = new PasteTextNativeDelegate (PasteText_cb); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate bool SetRunAttributesNativeDelegate (IntPtr inst, IntPtr attrib_set, int start_offset, int end_offset); static bool SetRunAttributes_cb (IntPtr inst, IntPtr attrib_set, int start_offset, int end_offset) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; bool __result; __result = __obj.SetRunAttributes (new GLib.SList(attrib_set), start_offset, end_offset); return __result; } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw; } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void SetTextContentsNativeDelegate (IntPtr inst, IntPtr str1ng); static void SetTextContents_cb (IntPtr inst, IntPtr str1ng) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; __obj.TextContents = GLib.Marshaller.Utf8PtrToString (str1ng); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, false); } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void InsertTextNativeDelegate (IntPtr inst, IntPtr str1ng, int length, ref int position); static void InsertText_cb (IntPtr inst, IntPtr str1ng, int length, ref int position) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; __obj.InsertText (GLib.Marshaller.Utf8PtrToString (str1ng), ref position); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, false); } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void CopyTextNativeDelegate (IntPtr inst, int start_pos, int end_pos); static void CopyText_cb (IntPtr inst, int start_pos, int end_pos) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; __obj.CopyText (start_pos, end_pos); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, false); } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void CutTextNativeDelegate (IntPtr inst, int start_pos, int end_pos); static void CutText_cb (IntPtr inst, int start_pos, int end_pos) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; __obj.CutText (start_pos, end_pos); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, false); } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void DeleteTextNativeDelegate (IntPtr inst, int start_pos, int end_pos); static void DeleteText_cb (IntPtr inst, int start_pos, int end_pos) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; __obj.DeleteText (start_pos, end_pos); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, false); } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void PasteTextNativeDelegate (IntPtr inst, int position); static void PasteText_cb (IntPtr inst, int position) { try { IEditableTextImplementor __obj = GLib.Object.GetObject (inst, false) as IEditableTextImplementor; __obj.PasteText (position); } 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); AtkEditableTextIface native_iface = (AtkEditableTextIface) Marshal.PtrToStructure (ifaceptr, typeof (AtkEditableTextIface)); native_iface.SetRunAttributes = iface.SetRunAttributes; native_iface.SetTextContents = iface.SetTextContents; native_iface.InsertText = iface.InsertText; native_iface.CopyText = iface.CopyText; native_iface.CutText = iface.CutText; native_iface.DeleteText = iface.DeleteText; native_iface.PasteText = iface.PasteText; Marshal.StructureToPtr (native_iface, ifaceptr, false); } GLib.Object implementor; public EditableTextAdapter () { InitHandler = new GLib.GInterfaceInitHandler (Initialize); } public EditableTextAdapter (IEditableTextImplementor 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 EditableTextAdapter (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); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr d_atk_editable_text_get_type(); static d_atk_editable_text_get_type atk_editable_text_get_type = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_get_type")); private static GLib.GType _gtype = new GLib.GType (atk_editable_text_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 IEditableText GetObject (IntPtr handle, bool owned) { GLib.Object obj = GLib.Object.GetObject (handle, owned); return GetObject (obj); } public static IEditableText GetObject (GLib.Object obj) { if (obj == null) return null; else if (obj is IEditableTextImplementor) return new EditableTextAdapter (obj as IEditableTextImplementor); else if (obj as IEditableText == null) return new EditableTextAdapter (obj.Handle); else return obj as IEditableText; } public IEditableTextImplementor Implementor { get { return implementor as IEditableTextImplementor; } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void d_atk_editable_text_copy_text(IntPtr raw, int start_pos, int end_pos); static d_atk_editable_text_copy_text atk_editable_text_copy_text = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_copy_text")); public void CopyText(int start_pos, int end_pos) { atk_editable_text_copy_text(Handle, start_pos, end_pos); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void d_atk_editable_text_cut_text(IntPtr raw, int start_pos, int end_pos); static d_atk_editable_text_cut_text atk_editable_text_cut_text = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_cut_text")); public void CutText(int start_pos, int end_pos) { atk_editable_text_cut_text(Handle, start_pos, end_pos); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void d_atk_editable_text_delete_text(IntPtr raw, int start_pos, int end_pos); static d_atk_editable_text_delete_text atk_editable_text_delete_text = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_delete_text")); public void DeleteText(int start_pos, int end_pos) { atk_editable_text_delete_text(Handle, start_pos, end_pos); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void d_atk_editable_text_insert_text(IntPtr raw, IntPtr str1ng, int length, ref int position); static d_atk_editable_text_insert_text atk_editable_text_insert_text = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_insert_text")); public void InsertText(string str1ng, ref int position) { IntPtr native_str1ng = GLib.Marshaller.StringToPtrGStrdup (str1ng); atk_editable_text_insert_text(Handle, native_str1ng, System.Text.Encoding.UTF8.GetByteCount (str1ng), ref position); GLib.Marshaller.Free (native_str1ng); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void d_atk_editable_text_paste_text(IntPtr raw, int position); static d_atk_editable_text_paste_text atk_editable_text_paste_text = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_paste_text")); public void PasteText(int position) { atk_editable_text_paste_text(Handle, position); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate bool d_atk_editable_text_set_run_attributes(IntPtr raw, IntPtr attrib_set, int start_offset, int end_offset); static d_atk_editable_text_set_run_attributes atk_editable_text_set_run_attributes = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_set_run_attributes")); public bool SetRunAttributes(GLib.SList attrib_set, int start_offset, int end_offset) { bool raw_ret = atk_editable_text_set_run_attributes(Handle, attrib_set == null ? IntPtr.Zero : attrib_set.Handle, start_offset, end_offset); bool ret = raw_ret; return ret; } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void d_atk_editable_text_set_text_contents(IntPtr raw, IntPtr str1ng); static d_atk_editable_text_set_text_contents atk_editable_text_set_text_contents = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Atk), "atk_editable_text_set_text_contents")); public string TextContents { set { IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value); atk_editable_text_set_text_contents(Handle, native_value); GLib.Marshaller.Free (native_value); } } #endregion } }