示例#1
0
        internal TypeTreeNode(Type type,
                              bool nestedType)
            : base(type)
        {
            _typeKindName = ObjectInfo.GetTypeKind(type);
            if (!nestedType)
            {
                SetPresInfo(_typeKindName);

                int inType = 0;

                if (type.IsEnum)
                {
                    inType = IntermediateNodeType.INTNODE_ENUM;
                }
                else if (type.IsClass)
                {
                    inType = IntermediateNodeType.INTNODE_CLASS;
                }
                else if (type.IsInterface)
                {
                    inType = IntermediateNodeType.INTNODE_INTERFACE;
                }
                else if (type.IsValueType)
                {
                    inType = IntermediateNodeType.INTNODE_STRUCT;
                }
                else if (type.IsPrimitive)
                {
                    inType = IntermediateNodeType.INTNODE_CLASS;
                }
                else if (type.Equals(typeof(Enum)))
                {
                    inType = IntermediateNodeType.INTNODE_CLASS;
                }

                IntermediateNodeTypes = new ArrayList();
                IntermediateNodeTypes.Add
                    (IntermediateNodeType.
                    GetNodeType(inType));
            }

            _type = type;

            // We allow classes to be dragged
            _isDragSource = true;

            _onDesignSurface = true;

            PostConstructor();
        }
示例#2
0
 // Allocates the correct type of node
 protected override BrowserTreeNode AllocateChildNode(Object obj)
 {
     // For inherited interfaces
     if (obj is ComInterfaceInfo)
     {
         BrowserTreeNode node = new ComTypeTreeNode((BasicInfo)obj);
         node.IntermediateNodeTypes = new ArrayList();
         node.IntermediateNodeTypes.Add
             (IntermediateNodeType.
             GetNodeType(IntermediateNodeType.INTNODE_COM_BASEINT));
         return(node);
     }
     return(new ComMemberTreeNode((BasicInfo)obj));
 }