예제 #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;
 }