Example #1
0
        void AdjustItemDepth(ScTabHeadItem downItem)
        {
            LinkedListNode <ScTabHeadItem> selectedItemNodeInDepth = tabHeadItemListDepth.Last;
            LinkedListNode <ScTabHeadItem> selectedNodeInLocation  = tabHeadItemListLocation.Find(selectedItemNodeInDepth.Value);
            LinkedListNode <ScTabHeadItem> preNode  = selectedNodeInLocation.Previous;
            LinkedListNode <ScTabHeadItem> nextNode = selectedNodeInLocation.Next;

            if (preNode == null && nextNode == null)
            {
                return;
            }

            tabHeadItemListDepth.Remove(selectedItemNodeInDepth);
            LinkedListNode <ScTabHeadItem> nodeDepth;

            if (preNode == null)
            {
                nodeDepth = tabHeadItemListDepth.Find(nextNode.Value);
                tabHeadItemListDepth.AddBefore(nodeDepth, selectedItemNodeInDepth);
            }
            else
            {
                nodeDepth = tabHeadItemListDepth.Find(preNode.Value);
                tabHeadItemListDepth.AddAfter(nodeDepth, selectedItemNodeInDepth);
            }

            LinkedListNode <ScTabHeadItem> node = tabHeadItemListDepth.Find(downItem);

            tabHeadItemListDepth.Remove(node);
            tabHeadItemListDepth.AddLast(node);
        }
Example #2
0
        public ScTabHeadItem SetSelectedIndex(int selectedIndex)
        {
            ScTabHeadItem item;
            ScTabHeadItem selectedItem          = null;
            LinkedListNode <ScTabHeadItem> node = tabHeadItemListLocation.First;

            for (; node != null; node = node.Next)
            {
                item = node.Value;

                if (item.index == selectedIndex)
                {
                    item.SetSelectedItem();
                    selectedItem = item;
                }
                else
                {
                    item.SetNormalItem();
                }
            }

            if (selectedItem == null)
            {
                return(null);
            }

            AdjustItemDepth(selectedItem);
            ReAddAllItems();
            if (SelectedItemEvent != null)
            {
                SelectedItemEvent(selectedItem);
            }

            return(selectedItem);
        }
Example #3
0
 private void ScTab_SelectedItemEvent(ScTabHeadItem selectedItem)
 {
     if (SelectedItemEvent != null)
     {
         SelectedItemEvent(selectedItem);
     }
 }
Example #4
0
        private void ScTabHead_SelectedItemEvent(ScTabHeadItem selectedItem)
        {
            if (Controlsx.tabPageDict.ContainsKey(selectedItem))
            {
                selectedIndex = selectedItem.index;

                Control tabBodyViewBox = Controlsx.tabPageDict[selectedItem];
                tabBodyViewBox.Dock = DockStyle.Fill;

                panelTabBody.Controls.Clear();
                panelTabBody.Controls.Add(tabBodyViewBox);
                panelTabBody.Refresh();

                if (SelectedIndexChanged != null)
                {
                    EventArgs e = new EventArgs();
                    SelectedIndexChanged(this, e);
                }

                if (Click != null)
                {
                    EventArgs e = new EventArgs();
                    Click(this, e);
                }
            }
        }
Example #5
0
 private void Item_AnimalStopEvent(ScTabHeadItem selectedItem)
 {
     if (SelectedItemEvent != null && downItem != null)
     {
         SelectedItemEvent(downItem);
         downItem = null;
     }
 }
Example #6
0
        public void SetSelectedTabPage(ScTabHeadItem item)
        {
            if (item == null)
            {
                return;
            }

            scTabHead.SetSelectedItem(item);
        }
Example #7
0
        public void MouseDownItem(ScTabHeadItem downItem)
        {
            LinkedListNode <ScTabHeadItem> selectedItemNodeInDepth = tabHeadItemListDepth.Last;

            selectedItemNodeInDepth.Value.StartLeaveAnim();

            AdjustItemDepth(downItem);
            ReAddAllItems();
            this.downItem = downItem;
        }
Example #8
0
        private void ScTabHeadItem_MouseLeave(object sender)
        {
            ScTabHeadItem item = scTabHead.GetSelectedItem();

            if (item == this)
            {
                return;
            }

            StartAnim(normalColor);
        }
Example #9
0
        private void ScTabHeadItem_MouseEnter(object sender, ScMouseEventArgs e)
        {
            ScTabHeadItem item = scTabHead.GetSelectedItem();

            if (item == this)
            {
                return;
            }

            StartAnim(enterColor);
        }
Example #10
0
        public ScTabHeadItem AddTabPage(string name)
        {
            /*
             * Size size = scTab.GetTabPageSize();
             * ScContainer scScrollContainer = new ScContainer(size.Width, size.Height);
             * scScrollContainer.HitRegion = new Region(scScrollContainer.rect);
             */

            ScTabHeadItem item = scTab.AddTabPageContentControl(name, null);

            return(item);
        }
Example #11
0
        public void Add(Control control)
        {
            ScSharpTabPage tabPage = (ScSharpTabPage)control;

            tabPage.TextChangedEvent += TabPage_TextChangedEvent;

            ScTabHeadItem item = scSharpTab.head.AddItem(control.Text);

            tabPageDict.Add(item, control);

            ScSharpTabPage scSharpTabPage = (ScSharpTabPage)control;

            scSharpTabPage.scTabHeadItem = item;
        }
Example #12
0
        private void ScTabHead_SelectedItemEvent(ScTabHeadItem selectedItem)
        {
            if (tabPageDict.ContainsKey(selectedItem))
            {
                ScLayer tabBodyViewBox = tabPageDict[selectedItem];
                tabBodyBox.Clear();

                tabBodyBox.Add(tabBodyViewBox);

                if (SelectedItemEvent != null)
                {
                    SelectedItemEvent(selectedItem);
                }

                tabBodyViewBox.Refresh();
            }
        }
Example #13
0
        public int SetSelectedItem(ScTabHeadItem downItem)
        {
            if (downItem == null)
            {
                return(0);
            }

            downItem.SetSelectedItem();
            AdjustItemDepth(downItem);
            ReAddAllItems();
            if (SelectedItemEvent != null)
            {
                SelectedItemEvent(downItem);
            }

            return(downItem.index);
        }
Example #14
0
        void DrawItemRect(Graphics g, RectangleF rect)
        {
            ScTabHeadItem item = scTabHead.GetSelectedItem();

            float        len    = gradientSize;
            GraphicsPath myPath = new GraphicsPath();//建立GraphicsPath()类对象


            PointF[] points1 =
            {
                new PointF(rect.Left,            rect.Bottom),
                new PointF(rect.Left + len,      rect.Top),
                new PointF(rect.Right - len - 1, rect.Top),
                new PointF(rect.Right - 1,       rect.Bottom)
            };


            PointF[] points2 =
            {
                new PointF(rect.Left,        rect.Top),
                new PointF(rect.Left + len,  rect.Bottom - 1),
                new PointF(rect.Right - len, rect.Bottom - 1),
                new PointF(rect.Right,       rect.Top)
            };

            PointF[] points;

            if (upOrBottom == 0)
            {
                points = points1;
            }
            else
            {
                points = points2;
            }


            myPath.AddLines(points);

            Pen pen = new Pen(itemBoxColor, 1.5f);

            System.Drawing.Brush brush = new SolidBrush(color);
            g.FillPath(brush, myPath);
            g.DrawPath(pen, myPath);
        }
Example #15
0
        public ScTabHeadItem AddTabPageContentControl(string name, ScLayer control)
        {
            ScTabHeadItem item = scTabHead.AddItem(name);

            ScLayer tabBodyViewBox = new ScLayer();

            tabBodyViewBox.Location = new Point(5, 5);
            tabBodyViewBox.Width    = tabBodyBox.Width - 10;
            tabBodyViewBox.Height   = tabBodyBox.Height - 10;

            if (control != null)
            {
                tabBodyViewBox.Add(control);
            }

            tabPageDict.Add(item, tabBodyViewBox);
            return(item);
        }
Example #16
0
        public ScTabHeadItem AddItem(string name)
        {
            Size size = TextRenderer.MeasureText(name, font);
            int  w    = size.Width + 40;

            ScTabHeadItem item = new ScTabHeadItem(ScMgr, this);

            item.upOrBottom = upOrBottom;
            item.Dock       = ScDockStyle.TopBottom;
            item.Name       = name;

            switch (sizeMode)
            {
            case SizeMode.Normal:
                item.Width  = itemSize.Width;
                item.Height = itemSize.Height;
                break;

            case SizeMode.Fixed:
                item.Width  = w;
                item.Height = size.Height;
                break;
            }

            item.index            = tabHeadItemListLocation.Count;
            item.AnimalStopEvent += Item_AnimalStopEvent;
            item.IsHitThrough     = false;

            tabHeadItemListLocation.AddLast(item);
            tabHeadItemListDepth.AddLast(item);
            AdjustItemLocation();

            panelView.Add(item);

            return(item);
        }
Example #17
0
        public ScTabHeadItem AddTabPage(string name, ScLayer scControl)
        {
            ScTabHeadItem item = scTab.AddTabPageContentControl(name, scControl);

            return(item);
        }
Example #18
0
 public void SetSelectedTabPage(ScTabHeadItem item)
 {
     scTab.SetSelectedTabPage(item);
 }
Example #19
0
        public ScTabHeadItem AddItem(string name)
        {
            ScTabHeadItem item = scTabHead.AddItem(name);

            return(item);
        }
Example #20
0
 public int SetSelectedTabPage(ScTabHeadItem selectedTab)
 {
     return(scTabHead.SetSelectedItem(selectedTab));
 }