private ManagedType RegisterType (Type type, ManagedType parent, ManagedType[] interfaces)
{
ManagedType info;
lock (sync_object) {
info = new ManagedType ();
info.type = type;
info.gc_handle = GCHandle.Alloc (type);
info.parent = parent;
Kind[] interface_kinds = new Kind[interfaces.Length];
for (int i = 0; i < interfaces.Length; i ++)
interface_kinds[i] = interfaces[i].native_handle;
if (type == typeof (System.Windows.Media.Matrix))
info.native_handle = Kind.UNMANAGEDMATRIX;
else if (type == typeof (System.Windows.Media.Media3D.Matrix3D))
info.native_handle = Kind.UNMANAGEDMATRIX3D;
else {
string cp = GetContentPropertyName (type);
info.native_handle = NativeMethods.types_register_type (native, type.FullName, cp,
GCHandle.ToIntPtr (info.gc_handle),
(parent != null ? parent.native_handle : Kind.INVALID),
type.IsInterface,
type.IsEnum || type.GetConstructor (Type.EmptyTypes) != null,
interface_kinds, interface_kinds.Length);
}
types.Add (type, info);
}
return info;
}