static void OverrideInsertText(GLib.GType gtype, InsertTextNativeDelegate callback) { unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("insert_text")); *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback); } }
private uint InternalInsertText(uint position, string chars, uint n_chars) { InsertTextNativeDelegate unmanaged = class_abi.BaseOverride <InsertTextNativeDelegate>(this.LookupGType(), "insert_text"); if (unmanaged == null) { return(0); } IntPtr native_chars = GLib.Marshaller.StringToPtrGStrdup(chars); uint __result = unmanaged(this.Handle, position, native_chars, n_chars); GLib.Marshaller.Free(native_chars); return(__result); }
private uint InternalInsertText(uint position, string chars, uint n_chars) { InsertTextNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("insert_text")); unmanaged = (InsertTextNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(InsertTextNativeDelegate)); } if (unmanaged == null) { return(0); } IntPtr native_chars = GLib.Marshaller.StringToPtrGStrdup(chars); uint __result = unmanaged(this.Handle, position, native_chars, n_chars); GLib.Marshaller.Free(native_chars); return(__result); }
static void OverrideInsertText (GLib.GType gtype, InsertTextNativeDelegate callback) { GtkTextBufferClass class_iface = GetClassStruct (gtype, false); class_iface.InsertText = callback; OverrideClassStruct (gtype, class_iface); }