Ejemplo n.º 1
0
        private void RemoveThis()
        {
            if (isDummyItem)
            {
                return;
            }

            IBTabControl parent = Parent as IBTabControl;

            if (parent == null)
            {
                return;
            }

            parent.Items.Remove(this);

            if (parent.Items.Count == 0)
            {
                parent.Items.Add(new SubTabItem()
                {
                    isDummyItem = true, Header = "*** NoItems ***"
                });
            }
        }
Ejemplo n.º 2
0
        protected override void MaskRect_PreviewDragEnter(object sender, DragEventArgs e)
        {
            //base.MaskRect_PreviewDragEnter(sender, e);

            EndDrag();

            SubTabItem ti = e.Data.GetData(typeof(SubTabItem)) as SubTabItem;

            if (ti == null)
            {
                return;
            }
            if (ti == this)
            {
                return;
            }

            if (ti.Element as IBProjectElement == null)
            {
                return;
            }
            if (ti.Element as IBProjectElement == Element)
            {
                return;
            }

            IBTabControl parentTC = Parent as IBTabControl;

            if (parentTC == null)
            {
                throw new IBLayoutException("SubTabItem の親が IBTabControl でありません");
            }

            IBTabControl parentTC2 = ti.Parent as IBTabControl;

            if (parentTC2 == null)
            {
                throw new IBLayoutException("SubTabItem の親が IBTabControl でありません");
            }

            if (parentTC == parentTC2)
            {
                parentTC.ReplaceItems(this, ti);
            }
            else
            {
                parentTC2.Items.Remove(ti);
                parentTC.Items.Insert(parentTC.Items.IndexOf(this), ti);

                if (isDummyItem)
                {
                    parentTC.Items.Remove(this);
                }

                if (parentTC2.Items.Count == 0)
                {
                    parentTC2.Items.Add(new SubTabItem()
                    {
                        isDummyItem = true, Header = "*** NoItems ***"
                    });
                }
            }

            ti.IsSelected = true;
            parentTC.EndDrag();
        }