static void OverrideAllocate(GLib.GType gtype, AllocateNativeDelegate callback) { unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("allocate")); *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback); } }
private void InternalAllocate(int width, int height) { AllocateNativeDelegate unmanaged = class_abi.BaseOverride <AllocateNativeDelegate>(this.LookupGType(), "allocate"); if (unmanaged == null) { return; } unmanaged(this.Handle, width, height); }
private void InternalAllocate(int width, int height) { AllocateNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("allocate")); unmanaged = (AllocateNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AllocateNativeDelegate)); } if (unmanaged == null) { return; } unmanaged(this.Handle, width, height); }
static void OverrideAllocate (GLib.GType gtype, AllocateNativeDelegate callback) { GtkCellAreaContextClass class_iface = GetClassStruct (gtype, false); class_iface.Allocate = callback; OverrideClassStruct (gtype, class_iface); }