Пример #1
0
 public IDProperty(MPIDCtl mpIDCtl, IDListBase listBase, Type ty)
     : base(mpIDCtl, listBase)
 {
     type = ty;
     //int index = ty.Name.LastIndexOf('.');
     //Text = index >= 0 ? ty.Name.Substring(index+1) : ty.Name;
 }
Пример #2
0
        /// <summary>
        /// Fill the combo box and select the first entry
        /// </summary>
        /// <param name="pathElement"></param>
        private void DropList(IDNodeBase selNode)
        {
            if (selNode == null)
            {
                return;
            }
            //_editing = true;
            IDListBase listBase = selNode.ListBase;

            cbChildrenList.Location = selNode.Location;
            cbChildrenList.Tag      = selNode;
            cbChildrenList.Items.Clear();

            // Add choice to de-select if target is path
            //if (listBase is IDPathList)
            //{
            //    cbChildrenList.Items.Add("");
            //}

            // Add component children
            selNode.AddComponents(cbChildrenList);

            selNode.AddMethodsOrProperties(cbChildrenList);

            _noSelect = true;
            int sel = cbChildrenList.FindString(selNode.Text);

            if (sel >= 0)
            {
                cbChildrenList.SelectedIndex = sel;
            }

            cbChildrenList.BringToFront();
            cbChildrenList.Show();
            cbChildrenList.Select();
            if (selNode.IsLiteral)
            {
                cbChildrenList.DropDownStyle   = ComboBoxStyle.DropDown;
                cbChildrenList.Text            = selNode.Text;
                cbChildrenList.SelectionStart  = 0;
                cbChildrenList.SelectionLength = selNode.Text.Length;
            }
            else
            {
                if (selNode.ListBase is IDPropertyList && selNode.IsFirst)
                {
                    cbChildrenList.DropDownStyle = ComboBoxStyle.DropDown;
                    cbChildrenList.Text          = "";
                    //cbChildrenList.Items.Insert(0, "");
                }
                else
                {
                    cbChildrenList.DropDownStyle = ComboBoxStyle.DropDownList;
                }
                cbChildrenList.DroppedDown = true;
            }

            _noSelect = false;
        }
Пример #3
0
 private void DisposeAllListsAndControls()
 {
     // Clear everything
     if (_primaryStatement != null)
     {
         _primaryStatement.Clear();
         _primaryStatement = null;
     }
     DisposeAllArgs();
     NextControlNo = 2;
 }
Пример #4
0
        private void BuildAllSections()
        {
            DisposeAllListsAndControls();

            if (_returnType.Equals(typeof(void)))
            {
                _primaryStatement = new IDMethodList(this);
            }
            else
            {
                _primaryStatement = new IDPropertyList(this, _returnType, -1);
            }

            if (string.IsNullOrEmpty(_id))
            {
                return;
            }

            string id = "";

            if (!_id.Contains("(Object)"))
            {
                id = SplitMethodOrProperty(_primaryStatement, _id);
                BuildMethodArgs(id);
            }
            else
            {
                id = _id.Replace("(Object)", "");
                _primaryStatement.InsertPathNode(id);
            }


            // Now we validate Methods and arguments
            if (_argStatements != null)
            {
                IDMethodList mList    = _primaryStatement as IDMethodList;
                string       methodID = BuildFullID(mList.BuildID());
                Type[]       args     = new Type[_argStatements.Count];
                for (int i = 0; i < _argStatements.Count; i++)
                {
                    args[i] = _argStatements[i].PropNode.type;
                }
                if (!mList.ConfirmArgTypes(args))
                {
                    U.LogPopup("Unable to find matching method for '{0}'", _id);
                }
            }
        }
Пример #5
0
        public IDNodeBase(MPIDCtl mpIDCtl, IDListBase listBase)
        {
            _mpIDCtl  = mpIDCtl;
            _listBase = listBase;

            int index = _mpIDCtl.NextControlNo++;

            _lblText.AutoSize    = false;
            _lblText.Name        = string.Format("lblName{0}", index);
            _lblText.Size        = new System.Drawing.Size(0, 13);
            _lblText.Font        = _mpIDCtl.LblRoot.Font;
            _lblText.FlatStyle   = System.Windows.Forms.FlatStyle.System;
            _lblText.Margin      = new System.Windows.Forms.Padding(0);
            _lblText.TabIndex    = index;
            _lblText.Text        = "";
            _lblText.Tag         = this;
            _lblText.TextAlign   = System.Drawing.ContentAlignment.MiddleCenter;
            _lblText.MouseClick += _mpIDCtl.DelMouseClick;
            //_lblText.MouseEnter += new EventHandler(OnMouseEnter);
            //_lblText.MouseLeave += new EventHandler(OnMouseLeave);
            mpIDCtl.Controls.Add(_lblText);
        }
Пример #6
0
        public string SplitMethodOrProperty(IDListBase curList, string id)
        {
            // Could be any of the following
            // CompNode.CompNode.Method(...
            // CompNode.CompNode.Property,...
            // Method(...
            // Property,...

            // No Literals expected here
            while (!string.IsNullOrEmpty(id))
            {
                string sNode   = id;
                int    iDelim  = id.IndexOfAny(new char[] { '.', ',', '(' });
                char   chDelim = '\0';
                if (iDelim < 0)
                {
                    id = string.Empty;
                }
                else
                {
                    chDelim = id[iDelim];
                    sNode   = id.Substring(0, iDelim);
                    id      = id.Substring(iDelim + 1);
                }
                if (chDelim == '.')
                {
                    // We have here a Path element
                    curList.InsertPathNode(sNode);
                }
                else // Must be last element
                {
                    curList.SetLast(sNode.TrimEnd(')'));
                    break;
                }
            }
            return(id);
        }
Пример #7
0
 public IDMethod(MPIDCtl mpIDCtl, IDListBase listBase)
     : base(mpIDCtl, listBase)
 {
 }
Пример #8
0
 public IDPath(MPIDCtl mpIDCtl, IDListBase listBase)
     : base(mpIDCtl, listBase)
 {
 }