internal ClassInitializer(Type type) { ClassInitManagedDelegate = this.ClassInit; Type = type; gtype = GType.RegisterGObjectType(this); is_first_subclass = gtype.GetBaseType() == gtype.GetThresholdType(); }
protected internal static GType RegisterGType(System.Type t) { GType gtype = GType.RegisterGObjectType(t); bool is_first_subclass = gtype.GetBaseType() == gtype.GetThresholdType(); if (is_first_subclass) { IntPtr class_ptr = gtype.GetClassPtr(); GObjectClass gobject_class = (GObjectClass)Marshal.PtrToStructure(class_ptr, typeof(GObjectClass)); gobject_class.constructor_cb = ConstructorHandler; gobject_class.get_prop_cb = GetPropertyHandler; gobject_class.set_prop_cb = SetPropertyHandler; Marshal.StructureToPtr(gobject_class, class_ptr, false); } AddProperties(gtype, t, is_first_subclass); ConnectDefaultHandlers(gtype, t); InvokeTypeInitializers(gtype, t); AddInterfaces(gtype, t); return(gtype); }
public static N BaseOverride <N>(this AbiStruct class_abi, GType gtype, string fieldname) where N : Delegate { N unmanaged = null; unsafe { IntPtr raw_ptr = IntPtr.Zero; while (raw_ptr == IntPtr.Zero && GType.IsManaged(gtype)) { gtype = gtype.GetThresholdType(); var abi_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset(fieldname)); raw_ptr = *abi_ptr; } if (raw_ptr != IntPtr.Zero) { unmanaged = Marshal.GetDelegateForFunctionPointer <N>(raw_ptr); } } return(unmanaged); }
internal ClassInitializer(Type type) { ClassInitManagedDelegate = this.ClassInit; Type = type; gtype = GType.RegisterGObjectType (this); is_first_subclass = gtype.GetBaseType () == gtype.GetThresholdType (); }