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); }
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; }
private void Item_AnimalStopEvent(ScTabHeaderItem selectedItem) { if (SelectedItemEvent != null && downItem != null) { SelectedItemEvent(downItem); downItem = null; } }
public void MouseDownItem(ScTabHeaderItem downItem) { LinkedListNode<ScTabHeaderItem> selectedItemNodeInDepth = tabHeadItemListDepth.Last; selectedItemNodeInDepth.Value.StartLeaveAnim(); AdjustItemDepth(downItem); ReAddAllItems(); this.downItem = downItem; }
public int SetSelectedItem(ScTabHeaderItem downItem) { downItem.SetSelectedItem(); AdjustItemDepth(downItem); ReAddAllItems(); if (SelectedItemEvent != null) SelectedItemEvent(downItem); return downItem.index; }
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(); } }
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); }
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; }
public void SetSelectedTabPage(ScTabHeaderItem item) { scTabHead.SetSelectedItem(item); }
private void Item_MouseDownItemEvent(ScTabHeaderItem item) { MouseDownItem(item); }