示例#1
0
        public int Add(HeaderSection item)
        {
            int index = this.alSectionsByOrder.Count;

            Insert(index, item);

            return(index);
        }
示例#2
0
        public void Remove(HeaderSection item)
        {
            int index = this.alSectionsByOrder.IndexOf(item);

            if (index != -1)
            {
                RemoveAt(index);
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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;
        }
示例#5
0
        /// <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;
        }
示例#6
0
        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;
            }
        }
示例#7
0
        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;
            }
        }
示例#8
0
        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);
            }
        }
示例#9
0
 // Construction
 public HeaderSectionOrderConformableEventArgs(HeaderSection item)
     : base(item)
 {
 }
示例#10
0
 public HeaderSectionConformableEventArgs(HeaderSection item, MouseButtons enButton)
     : base(item, enButton)
 {
 }
示例#11
0
 // Construction
 public HeaderSectionWidthEventArgs(HeaderSection item)
     : base(item)
 {
 }
示例#12
0
 /// <summary>
 /// Operations
 /// </summary>
 internal int _FindSectionRawIndex(HeaderSection item)
 {
     return(this.alSectionsByRawIndex.IndexOf(item));
 }
示例#13
0
 public HeaderSectionEventArgs(HeaderSection item, MouseButtons enButton)
 {
     this.item     = item;
     this.enButton = enButton;
 }
示例#14
0
 public int IndexOf(HeaderSection item)
 {
     return(this.alSectionsByOrder.IndexOf(item));
 }
示例#15
0
 public HeaderSectionOrderEventArgs(HeaderSection item, MouseButtons enButton,
                                    int iOrder)
     : base(item, enButton)
 {
     this.iOrder = iOrder;
 }
示例#16
0
 public HeaderSectionOrderEventArgs(HeaderSection item, MouseButtons enButton)
     : base(item, enButton)
 {
 }
示例#17
0
 // Construction
 public HeaderSectionOrderEventArgs(HeaderSection item)
     : base(item)
 {
 }
示例#18
0
 public HeaderSectionWidthConformableEventArgs(HeaderSection item, MouseButtons enButton,
                                               int cxWidth)
     : base(item, enButton, cxWidth)
 {
 }
示例#19
0
 public HeaderSectionWidthEventArgs(HeaderSection item, MouseButtons enButton,
                                    int cxWidth)
     : base(item, enButton)
 {
     this.cxWidth = cxWidth;
 }
示例#20
0
 public bool Contains(HeaderSection item)
 {
     return(this.alSectionsByOrder.IndexOf(item) != -1);
 }
示例#21
0
 public HeaderSectionOrderConformableEventArgs(HeaderSection item, MouseButtons enButton,
                                               int iOrder)
     : base(item, enButton, iOrder)
 {
 }
示例#22
0
 public TableColumn()
 {
     _headerSection = new HeaderSection("", 40);
     TopBorder      = true;
     RightBorder    = true;
 }
示例#23
0
 // Construction
 public HeaderSectionEventArgs(HeaderSection item)
 {
     this.item = item;
 }