public int Add(HeaderSection item) { int index = this.alSectionsByOrder.Count; Insert(index, item); return(index); }
public void Remove(HeaderSection item) { int index = this.alSectionsByOrder.IndexOf(item); if (index != -1) { RemoveAt(index); } }
internal void _Move(int iFrom, int iTo) { Debug.Assert(iFrom >= 0 || iFrom < this.alSectionsByOrder.Count); Debug.Assert(iTo >= 0 || iTo < this.alSectionsByOrder.Count); Debug.Assert(this.alSectionsByOrder.Count == this.alSectionsByRawIndex.Count); HeaderSection item = (HeaderSection)this.alSectionsByOrder[iFrom]; this.alSectionsByOrder.RemoveAt(iFrom); this.alSectionsByOrder.Insert(iTo, item); }
private void UnbindSection(HeaderSection item) { if (item == null) { throw new ArgumentNullException("item", ErrMsg.NullVal()); } if (item.Collection != this) { throw new ArgumentException(ErrMsg.SectionDoesNotExist(item.Text), "item"); } item.Collection = null; }
/// <summary> /// Helpers /// </summary> private void BindSection(HeaderSection item) { if (item == null) { throw new ArgumentNullException("item", ErrMsg.NullVal()); } if (item.Collection != null) { throw new ArgumentException(ErrMsg.SectionIsAlreadyAttached(item.Text), "item"); } item.Collection = this; }
public void Insert(int index, HeaderSection item) { Debug.Assert(this.alSectionsByOrder.Count == this.alSectionsByRawIndex.Count); if (index < 0 || index > this.alSectionsByOrder.Count) { throw new ArgumentOutOfRangeException("index", index, ErrMsg.IndexOutOfRange()); } // Bind item to the collection BindSection(item); try { this.alSectionsByOrder.Insert(index, item); this.alSectionsByRawIndex.Insert(index, item); try { // Notify owner if (this.owner != null) { this.owner._OnSectionInserted(index, item); } } catch { this.alSectionsByOrder.Remove(item); this.alSectionsByRawIndex.Remove(item); throw; } } catch { if (this.alSectionsByOrder.Count > this.alSectionsByRawIndex.Count) { this.alSectionsByOrder.RemoveAt(index); } UnbindSection(item); throw; } }
internal void _SetSection(int index, HeaderSection item) { Debug.Assert(index >= 0 || index < this.alSectionsByOrder.Count); Debug.Assert(this.alSectionsByOrder.Count == this.alSectionsByRawIndex.Count); // Bind item to the collection BindSection(item); HeaderSection itemOld = (HeaderSection)this.alSectionsByOrder[index]; int iSection = this.alSectionsByRawIndex.IndexOf(itemOld); try { this.alSectionsByOrder[index] = item; this.alSectionsByRawIndex[iSection] = item; UnbindSection(itemOld); // Notify owner if (this.owner != null) { this.owner._OnSectionChanged(iSection, item); } } catch { if (itemOld.Collection == null) { BindSection(itemOld); } this.alSectionsByOrder[index] = itemOld; this.alSectionsByRawIndex[iSection] = itemOld; UnbindSection(item); throw; } }
public void RemoveAt(int index) { Debug.Assert(this.alSectionsByOrder.Count == this.alSectionsByRawIndex.Count); if (index < 0 || index >= this.alSectionsByOrder.Count) { throw new ArgumentOutOfRangeException("index", index, ErrMsg.IndexOutOfRange()); } HeaderSection item = (HeaderSection)this.alSectionsByOrder[index]; int iSectionRemoved = this.alSectionsByRawIndex.IndexOf(item); Debug.Assert(iSectionRemoved >= 0); UnbindSection(item); this.alSectionsByOrder.RemoveAt(index); this.alSectionsByRawIndex.RemoveAt(iSectionRemoved); if (this.owner != null) { this.owner._OnSectionRemoved(iSectionRemoved, item); } }
// Construction public HeaderSectionOrderConformableEventArgs(HeaderSection item) : base(item) { }
public HeaderSectionConformableEventArgs(HeaderSection item, MouseButtons enButton) : base(item, enButton) { }
// Construction public HeaderSectionWidthEventArgs(HeaderSection item) : base(item) { }
/// <summary> /// Operations /// </summary> internal int _FindSectionRawIndex(HeaderSection item) { return(this.alSectionsByRawIndex.IndexOf(item)); }
public HeaderSectionEventArgs(HeaderSection item, MouseButtons enButton) { this.item = item; this.enButton = enButton; }
public int IndexOf(HeaderSection item) { return(this.alSectionsByOrder.IndexOf(item)); }
public HeaderSectionOrderEventArgs(HeaderSection item, MouseButtons enButton, int iOrder) : base(item, enButton) { this.iOrder = iOrder; }
public HeaderSectionOrderEventArgs(HeaderSection item, MouseButtons enButton) : base(item, enButton) { }
// Construction public HeaderSectionOrderEventArgs(HeaderSection item) : base(item) { }
public HeaderSectionWidthConformableEventArgs(HeaderSection item, MouseButtons enButton, int cxWidth) : base(item, enButton, cxWidth) { }
public HeaderSectionWidthEventArgs(HeaderSection item, MouseButtons enButton, int cxWidth) : base(item, enButton) { this.cxWidth = cxWidth; }
public bool Contains(HeaderSection item) { return(this.alSectionsByOrder.IndexOf(item) != -1); }
public HeaderSectionOrderConformableEventArgs(HeaderSection item, MouseButtons enButton, int iOrder) : base(item, enButton, iOrder) { }
public TableColumn() { _headerSection = new HeaderSection("", 40); TopBorder = true; RightBorder = true; }
// Construction public HeaderSectionEventArgs(HeaderSection item) { this.item = item; }