/// ------------------------------------------------------------------------------------ /// <summary> /// Adds an item to the search pattern /// </summary> /// ------------------------------------------------------------------------------------ public void Insert(string ipaText) { PatternLabel lbl = new PatternLabel(0, ClassType.NotApplicable, ipaText); lbl.MouseEnter += new EventHandler(lbl_MouseEnter); Controls.Add(lbl); m_labels.Insert(m_insertIndex, lbl); ArrangeItems(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds an item to the search pattern /// </summary> /// ------------------------------------------------------------------------------------ public void Insert(int classId, SearchClassType type, string patternText) { if (VerifyClassToInsert(classId, type)) { PatternLabel lbl = new PatternLabel(classId, type, patternText); lbl.MouseEnter += new EventHandler(lbl_MouseEnter); Controls.Add(lbl); m_labels.Insert(m_insertIndex, lbl); ArrangeItems(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Clears any existing patterns. copies the collection of specified patterns and /// inserts them in the panel. This method will not perform any validation. It assumes /// the patterns are valid. /// </summary> /// ------------------------------------------------------------------------------------ public void Insert(List <PatternLabel> patterns) { if (patterns == null || patterns.Count == 0) { return; } SuspendLayout(); m_labels.Clear(); Controls.Clear(); foreach (PatternLabel lbl in patterns) { PatternLabel newlbl = PatternLabel.Copy(lbl); lbl.MouseEnter += new EventHandler(lbl_MouseEnter); Controls.Add(lbl); m_labels.Add(lbl); } ArrangeItems(); ResumeLayout(true); Invalidate(); // This is necessary sometimes. }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a new pattern label whose contenst are identical to the one specified. /// </summary> /// ------------------------------------------------------------------------------------ public static PatternLabel Copy(PatternLabel source) { return(new PatternLabel(source.ClassId, source.ClassType, source.Text)); }