static void OverrideSendStringEvent(GLib.GType gtype, SendStringEventNativeDelegate callback) { unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("send_string")); *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback); } }
private void InternalSendStringEvent(string data) { SendStringEventNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("send_string")); unmanaged = (SendStringEventNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SendStringEventNativeDelegate)); } if (unmanaged == null) { return; } IntPtr native_data = GLib.Marshaller.StringToPtrGStrdup(data); unmanaged(this.Handle, native_data); GLib.Marshaller.Free(native_data); }
static void OverrideSendStringEvent(GLib.GType gtype, SendStringEventNativeDelegate callback) { OverrideVirtualMethod(gtype, "send-string", callback); }