/// <summary> /// Indexer /// </summary> public GLSubItem this[int nItemIndex] { get { // int nTmpCount = 0; // if ( Parent == null ) // rare case when there is no parent set (almost always during collection editor) // nTmpCount = 255; // basically infinite during collection editor // else // nTmpCount = Parent.Columns.Count; int nBailout = 0; // check to make sure it exists first while (List.Count <= nItemIndex) { GLSubItem newitem = new GLSubItem(); newitem.ChangedEvent += new ChangedEventHandler(SubItem_Changed); newitem.Parent = this.m_Parent; //newitem.Control = Parent.Columns[ nItemIndex ] List.Add(newitem); // if the index doesn't yet exist, fill in the subitems till it does if (nBailout++ > 25) { break; } } return((GLSubItem)List[nItemIndex]); } }
/// <summary> /// Changes in the columns, items or subitems /// </summary> /// <param name="ctType"></param> /// <param name="column"></param> /// <param name="item"></param> /// <param name="subItem"></param> public ChangedEventArgs(ChangedTypes ctType, GLColumn column, GLItem item, GLSubItem subItem) { m_Column = column; m_Item = item; m_SubItem = subItem; m_ctType = ctType; }
/// <summary> /// remove an item from the list /// </summary> /// <param name="subItem"></param> public void Remove(GLSubItem subItem) { List.Remove(subItem); if (ChangedEvent != null) { ChangedEvent(this, new ChangedEventArgs(ChangedTypes.SubItemCollectionChanged, null, null, null)); } }
/// <summary> /// insert an item into the list at specified index /// </summary> /// <param name="nIndex"></param> /// <param name="strItemText"></param> /// <returns></returns> public GLSubItem Insert(int nIndex, string strItemText) { GLSubItem subItem = new GLSubItem(); //GLItem item = new GLItem(Parent); //item.SubItems[0].Text = strItemText; nIndex = Insert(nIndex, subItem); return(subItem); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) { m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; this.Items.Add("i1"); this.Items.Add("i2"); this.Items.Add("i3"); return(true); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) // populate this control however you wish with item { // set the styles you want for this this.BorderStyle = BorderStyle.None; this.AutoSize = false; m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; return(true); // we don't do any heavy processing in this ctrl so we just return true }
/// <summary> /// lowest level of add/insert. All add and insert routines eventually call this /// /// in the future always have routines call this one as well to keep one point of entry /// </summary> /// <param name="nIndex"></param> /// <param name="subItem"></param> /// <returns></returns> public int Insert(int nIndex, GLSubItem subItem) { subItem.Parent = this.m_Parent; subItem.ChangedEvent += new ChangedEventHandler(SubItem_Changed); if (nIndex < 0) { nIndex = List.Add(subItem); // add the subItem itself } else { List.Insert(nIndex, subItem); } if (ChangedEvent != null) { ChangedEvent(this, new ChangedEventArgs(ChangedTypes.SubItemCollectionChanged, null, null, subItem)); } return(nIndex); }
public bool GLLoad(GLItem item, GLSubItem subItem, GlacialList listctrl) { this.Format = DateTimePickerFormat.Long; try { m_item = item; m_subItem = subItem; m_Parent = listctrl; this.Text = subItem.Text; //this.Value = subItem.Text; } catch (Exception ex) { Debug.WriteLine(ex.ToString()); this.Text = DateTime.Now.ToString(); } return(true); }
/// <summary> /// add an itemto the items collection /// </summary> /// <param name="subItem"></param> /// <returns></returns> public int Add(GLSubItem subItem) { return(Insert(-1, subItem)); }