static void OverrideInsertedText(GLib.GType gtype, InsertedTextNativeDelegate callback) { unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("inserted_text")); *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback); } }
private void InternalInsertedText(uint position, string chars, uint n_chars) { InsertedTextNativeDelegate unmanaged = class_abi.BaseOverride <InsertedTextNativeDelegate>(this.LookupGType(), "inserted_text"); if (unmanaged == null) { return; } IntPtr native_chars = GLib.Marshaller.StringToPtrGStrdup(chars); unmanaged(this.Handle, position, native_chars, n_chars); GLib.Marshaller.Free(native_chars); }
private void InternalInsertedText(uint position, string chars, uint n_chars) { InsertedTextNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("inserted_text")); unmanaged = (InsertedTextNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(InsertedTextNativeDelegate)); } if (unmanaged == null) { return; } IntPtr native_chars = GLib.Marshaller.StringToPtrGStrdup(chars); unmanaged(this.Handle, position, native_chars, n_chars); GLib.Marshaller.Free(native_chars); }
static void OverrideInsertedText (GLib.GType gtype, InsertedTextNativeDelegate callback) { GtkEntryBufferClass class_iface = GetClassStruct (gtype, false); class_iface.InsertedText = callback; OverrideClassStruct (gtype, class_iface); }