Exemplo n.º 1
0
		public CustomDependencyProperty (IntPtr handle, string name, ManagedType propertyType, ManagedType ownerType, object defaultValue)
			: base (handle, name, propertyType.type, ownerType.type)
		{
			this.defaultValue = defaultValue;
		}
Exemplo n.º 2
0
Arquivo: Types.cs Projeto: shana/moon
		public ManagedType Find (Type type)
		{
			ManagedType info;
			ManagedType parent;
			
			if (types.TryGetValue (type, out info))
				return info;
			
			Type typedef = type;
			if (typedef.IsGenericType) {
				typedef = typedef.GetGenericTypeDefinition();
				if (types.TryGetValue (typedef, out info))
					return info;
			}

			if (typedef.BaseType == null) {
				parent = null;
			} else if (typedef.BaseType == typeof (System.ValueType)) {
				parent = Find (typeof (System.Object));
			} else {
				parent = Find (typedef.BaseType);
			}
			
			Type[] interfaces = type.GetInterfaces ();

			ManagedType[] interface_types = new ManagedType[interfaces.Length];
			for (int i = 0; i < interfaces.Length; i ++)
				interface_types[i] = Find (interfaces[i]);

			return RegisterType (type, parent, interface_types);
		}
Exemplo n.º 3
0
		public CustomDependencyProperty (IntPtr handle, string name, ManagedType propertyType, ManagedType ownerType)
			: base (handle, name, propertyType.type, ownerType.type)
		{
			
		}
Exemplo n.º 4
0
Arquivo: Types.cs Projeto: shana/moon
		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;
		}
Exemplo n.º 5
0
        public Kind TypeToKind(Type type)
        {
            ManagedType mt = Find(type);

            return(mt == null ? Kind.INVALID : mt.native_handle);
        }