private void _SetAndDraw(PlaceHolderType placeHolder, TreeNode nodeOver, TreeNode parentDragDrop = null)
 {
     this._placeHolder    = placeHolder;
     this._nodeOver       = nodeOver;
     this._parentDragDrop = parentDragDrop;
     this._Draw();
 }
예제 #2
0
        public void PlaceHolder(ComboBox textBox, Label label, PlaceHolderType type, string placeHolder)
        {
            switch (type)
            {
            case PlaceHolderType.Leave:
                if (textBox.Text == "")
                {
                    textBox.Text      = placeHolder;
                    textBox.ForeColor = Color.LightGray;
                }
                break;

            case PlaceHolderType.Enter:
                if (textBox.Text == placeHolder)
                {
                    textBox.Text      = string.Empty;
                    textBox.ForeColor = Color.Black;
                }
                break;

            default:
                break;
            }
            ShowLabelName(textBox, label);
        }
예제 #3
0
        public void PlaceHolder(TextBox textBox, Label label, PlaceHolderType type, string placeHolder, bool isPassword)
        {
            switch (type)
            {
            case PlaceHolderType.Leave:
                if (textBox.Text == "")
                {
                    textBox.Text      = placeHolder;
                    textBox.ForeColor = Color.LightGray;
                    if (isPassword)
                    {
                        textBox.UseSystemPasswordChar = false;
                    }
                }
                break;

            case PlaceHolderType.Enter:
                if (textBox.Text == placeHolder)
                {
                    textBox.Text      = string.Empty;
                    textBox.ForeColor = Color.Black;
                    if (isPassword)
                    {
                        textBox.UseSystemPasswordChar = true;
                    }
                }
                break;

            default:
                break;
            }
            ShowLabelName(textBox, label);
        }
예제 #4
0
 public dtoPlaceHolder(String css, String text, PlaceHolderType type)
     : this()
 {
     Type     = type;
     CssClass = css;
     Text     = text;
 }
예제 #5
0
 public PseudoScope(PlaceHolderType placeHolder)
     : base(placeHolder.GetModule())
 {
     this.placeHolder = placeHolder;
     this.members = null;
     this.parentScope = null;
     this.chainNamespace = null;
 }
예제 #6
0
 public PseudoScope(Scope parent)
     : base(parent.GetModule())
 {
     this.placeHolder = null;
     this.parentScope = parent;
     this.members = new Dictionary<string, ScopeMember> ();
     this.chainNamespace = null;
 }
예제 #7
0
        public void PlaceHolder(TextBox textBox, PlaceHolderType type, string placeHolder)
        {
            switch (type)
            {
            case PlaceHolderType.Leave:
                if (textBox.Text == "")
                {
                    textBox.Text      = placeHolder;
                    textBox.ForeColor = Color.LightGray;
                }
                break;

            case PlaceHolderType.Enter:
                if (textBox.Text == placeHolder)
                {
                    textBox.Text      = "";
                    textBox.ForeColor = Color.Black;
                }
                break;

            default:
                break;
            }
        }
예제 #8
0
        protected bool CheckGenericPlaceArgument(AstNode where, PlaceHolderType prototype, PlaceHolderType argument)
        {
            // Check for value type.
            if(prototype.IsValueType() && !argument.IsValueType())
                TryError(where, "expected value type argument.");

            // Get the argument top base.
            Structure topBase = currentModule.GetObjectClass();
            if(argument.IsValueType())
                topBase = currentModule.GetValueTypeClass();

            // Check for the bases.
            for(int i = 0; i < prototype.GetBaseCount(); ++i)
            {
                // Get the prototype base.
                Structure protoBase = prototype.GetBase(i);

                // Check for the top base.
                if(protoBase.IsClass() && (protoBase == topBase ||
                    topBase.IsDerivedFrom(protoBase)))
                    continue;
                else if(protoBase.IsInterface() && topBase.Implements(protoBase))
                    continue;

                // Check the argument bases until hit.
                bool found = false;
                for(int j = 0; j < argument.GetBaseCount(); ++j)
                {
                    // Get the argument base.
                    Structure argBase = argument.GetBase(j);

                    // Check the constraint.
                    if(protoBase == argBase ||
                       (protoBase.IsClass() && argBase.IsDerivedFrom(protoBase)) ||
                       (protoBase.IsInterface() && argBase.Implements(protoBase)))
                    {
                        found = true;
                        break;
                    }
                }

                // Raise the error.
                if(!found)
                    return TryError(where, "argument type {0} doesn't satisfy constraint {1}",
                        argument.GetFullName(), protoBase.GetFullName());
            }

            return true;
        }
예제 #9
0
 public override AstNode Visit(GenericParameter node)
 {
     // Create the place holder type.
     PlaceHolderType holder = new PlaceHolderType(currentModule, node.GetName(), node.IsValueType(), node.GetBases());
     node.SetNodeType(holder);
     return node;
 }
 private void _ResetDraw()
 {
     this._placeHolder    = PlaceHolderType.None;
     this._nodeOver       = null;
     this._parentDragDrop = null;
 }
예제 #11
0
 public PlaceHolderInfo(PlaceHolderType type, Regex splitter)
 {
     Type     = type;
     Splitter = splitter;
 }
예제 #12
0
        public IChelaType GetAnonType(uint anonId)
        {
            // Get the candidate from the type table.
            object candidate = anonymousTypes[(int)anonId];

            // Try to cast into an actual type.
            IChelaType actualType = candidate as IChelaType;
            if(actualType != null)
                return actualType;

            // Load the anonymous type.
            AnonTypeHeader anonType = (AnonTypeHeader)candidate;

            // Prevent circular references.
            if(anonType.loading)
                throw new ModuleException("circular derived types.");

            // Load the anonymous type.
            TypeKind kind = (TypeKind)anonType.typeKind;
            switch(kind)
            {
            case TypeKind.Reference:
                actualType = ReferenceType.Create(GetType(anonType.FetchUInt()), (ReferenceFlow)anonType.FetchByte(), anonType.FetchByte() != 0);
                break;
            case TypeKind.Pointer:
                actualType = PointerType.Create(GetType(anonType.FetchUInt()));
                break;
            case TypeKind.Constant:
                actualType = ConstantType.Create(GetType(anonType.FetchUInt()));
                break;
            case TypeKind.Array:
                actualType = ArrayType.Create(GetType(anonType.FetchUInt()), anonType.FetchByte(), anonType.FetchByte() != 0);
                break;
            case TypeKind.Vector:
                actualType = VectorType.Create(GetType(anonType.FetchUInt()), anonType.FetchByte());
                break;
            case TypeKind.Matrix:
                actualType = MatrixType.Create(GetType(anonType.FetchUInt()), anonType.FetchByte(), anonType.FetchByte());
                break;
            case TypeKind.Function:
                {
                    // Read the flags data.
                    uint flags = anonType.FetchUInt();
                    bool vararg = (flags & 1)  != 0;

                    // Read the variable arguments and the return type.
                    IChelaType retType = GetType(anonType.FetchUInt());

                    // Read the arguments.
                    int numargs = ((int)anonType.recordSize - 8)/4;
                    IChelaType[] args = new IChelaType[numargs];
                    for(int i = 0; i < numargs; ++i)
                        args[i] = GetType(anonType.FetchUInt());

                    // Create the function type.
                    actualType = FunctionType.Create(retType, args, vararg, (MemberFlags)flags);
                }
                break;
            case TypeKind.PlaceHolder:
                {
                    // Read the name.
                    string name = GetString(anonType.FetchUInt());

                    // Read the id.
                    int id = (int)anonType.FetchUInt();

                    // Read the value type flag.
                    bool valueType = anonType.FetchByte() != 0;

                    // Read the number of bases.
                    int numbases = anonType.FetchByte();

                    // Read the bases.
                    Structure[] bases = new Structure[numbases];
                    for(int i = 0; i < numbases; ++i)
                        bases[i] = (Structure)GetMember(anonType.FetchUInt());

                    // Create the place holder.
                    actualType = new PlaceHolderType(this, id, name, valueType, bases);
                }
                break;
            default:
                throw new System.NotSupportedException("unsupported anonymous type.");
            }

            // Remove the previous anonymous type.
            anonymousTypes[(int)anonId] = actualType;
            anonymousTypeMap[actualType] = anonId;

            // Return the loaded type.
            return actualType;
        }
예제 #13
0
 public PlaceHolderPart(PlaceHolderType type)
 {
     Type = type;
 }
예제 #14
0
 public PlaceHolderAttribute(string name, PlaceHolderType type)
 {
     Name = name;
     Type = type;
 }
예제 #15
0
        public GenericPrototype GetFullGenericPrototype()
        {
            // Return the cached generic prototype.
            if(fullGenericPrototype != null)
                return fullGenericPrototype;

            // Get the parent full generic prototype.
            GenericPrototype parentFull = null;
            Scope parent = GetParentScope();
            if(parent != null)
                parentFull = parent.GetFullGenericPrototype();

            // Get my generic prototype.
            GenericPrototype myPrototype = GetGenericPrototype();
            if(myPrototype == null || myPrototype.GetPlaceHolderCount() == 0)
            {
                fullGenericPrototype = parentFull;
            }
            else if(parentFull == null || parentFull.GetPlaceHolderCount() == 0)
            {
                fullGenericPrototype = myPrototype;
            }
            else
            {
                // Merge both prototypes
                int parentSize = parentFull.GetPlaceHolderCount();
                int mySize = myPrototype.GetPlaceHolderCount();
                PlaceHolderType[] newProto = new PlaceHolderType[parentSize + mySize];

                // Add the parent prototype components.
                for(int i = 0; i < parentSize; ++i)
                    newProto[i] = parentFull.GetPlaceHolder(i);

                // Add my prototype components.
                for(int i = 0; i < mySize; ++i)
                    newProto[i + parentSize] = myPrototype.GetPlaceHolder(i);

                // Store the new complete generic prototype.
                fullGenericPrototype = new GenericPrototype(newProto);
            }

            return fullGenericPrototype;
        }