Пример #1
0
        void AdjustItemDepth(ScTabHeaderItem downItem)
        {
            LinkedListNode<ScTabHeaderItem> selectedItemNodeInDepth = tabHeadItemListDepth.Last;
            LinkedListNode<ScTabHeaderItem> selectedNodeInLocation = tabHeadItemListLocation.Find(selectedItemNodeInDepth.Value);
            LinkedListNode<ScTabHeaderItem> preNode = selectedNodeInLocation.Previous;
            LinkedListNode<ScTabHeaderItem> nextNode = selectedNodeInLocation.Next;

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

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

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

            LinkedListNode<ScTabHeaderItem> node = tabHeadItemListDepth.Find(downItem);
            tabHeadItemListDepth.Remove(node);
            tabHeadItemListDepth.AddLast(node);
        }
Пример #2
0
        public ScTabHeaderItem SetSelectedIndex(int selectedIndex)
        {
            ScTabHeaderItem item;
            ScTabHeaderItem selectedItem = null;
            LinkedListNode<ScTabHeaderItem> 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;
        }
Пример #3
0
 private void Item_AnimalStopEvent(ScTabHeaderItem selectedItem)
 {
     if (SelectedItemEvent != null && downItem != null)
     {
         SelectedItemEvent(downItem);
         downItem = null;
     }
 }
Пример #4
0
        public void MouseDownItem(ScTabHeaderItem downItem)
        {
            LinkedListNode<ScTabHeaderItem> selectedItemNodeInDepth = tabHeadItemListDepth.Last;
            selectedItemNodeInDepth.Value.StartLeaveAnim();

            AdjustItemDepth(downItem);
            ReAddAllItems();
            this.downItem = downItem;
        }
Пример #5
0
        public int SetSelectedItem(ScTabHeaderItem downItem)
        {
            downItem.SetSelectedItem();
            AdjustItemDepth(downItem);
            ReAddAllItems();
            if (SelectedItemEvent != null)
                SelectedItemEvent(downItem);

            return downItem.index;
        }
Пример #6
0
Файл: ScTab.cs Проект: lypvc/Sc
        private void ScTabHead_SelectedItemEvent(ScTabHeaderItem selectedItem)
        {
            if (tabPageDict.ContainsKey(selectedItem))
            {
                ScLayer tabBodyViewBox = tabPageDict[selectedItem];
                tabBodyBox.Clear();

                tabBodyBox.Add(tabBodyViewBox);

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

                tabBodyViewBox.Refresh();
            }
        }
Пример #7
0
Файл: ScTab.cs Проект: lypvc/Sc
        public ScTabHeaderItem AddTabPageContentLayer(string name, ScLayer layer)
        {
            ScTabHeaderItem 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 (layer != null)
            {
                tabBodyViewBox.Add(layer);
            }

            tabPageDict.Add(item, tabBodyViewBox);
            return(item);
        }
Пример #8
0
        public ScTabHeaderItem AddItem(string name)
        {
            Size size = TextRenderer.MeasureText(name, font);
            int w = size.Width + 40;

            ScTabHeaderItem item = new ScTabHeaderItem(ScMgr);



            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.Name = name;
            item.GetSelectedItemEvent += Item_GetSelectedItemEvent;
            item.MouseDownItemEvent += Item_MouseDownItemEvent;
            item.AnimalStopEvent += Item_AnimalStopEvent;
            item.IsHitThrough = false;

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

            panelView.Add(item);

            return item;
        }
Пример #9
0
Файл: ScTab.cs Проект: lypvc/Sc
 public void SetSelectedTabPage(ScTabHeaderItem item)
 {
     scTabHead.SetSelectedItem(item);
 }
Пример #10
0
 private void Item_MouseDownItemEvent(ScTabHeaderItem item)
 {
     MouseDownItem(item);
 }