Пример #1
0
        public void NotifyDragAction(UIBrowserTreeNode src, UIElement dest)
        {
            var basep = src.DisplayElement.BindingElement.PositionScreen;

            if (dest is BrowserTreeDisplayNode)
            {
                BrowserTreeDisplayNode dest2 = (BrowserTreeDisplayNode)dest;
                if (src == dest2.Info)
                {
                    return;
                }
                dest2.Info.AddChildTreeNode(src);
            }
            else if (dest == _viewPort)
            {
                if (src.InfoParent != null)
                {
                    src.InfoParent.RemoveChildTreeNode(src);
                    src.InfoParent = null;
                }
                else
                {
                    RemoveTreeRoot(src);
                }
                Editor.Viewer.Canvas.Root.AppendChild(src.DisplayElement.BindingElement);
                AddElement(src);
            }
            src.DisplayElement.BindingElement.Position = src.DisplayElement.BindingElement.ScreenPositionToParentAR(basep);
            src.DisplayElement.BindingElement.Recalculate();
            Editor.NotifySelectionChange();
        }
Пример #2
0
 private void _assignEvent(UIBrowserTreeNode treenode)
 {
     treenode.Parent = this;
     treenode.DisplayElement.OnMouseDown += DisplayElement_OnMouseDown;
     foreach (var child in treenode.TreeNodes)
     {
         _assignEvent(child);
     }
 }
Пример #3
0
 public void AddChildTreeNode(UIBrowserTreeNode node)
 {
     if (node.InfoParent != null)
     {
         node.InfoParent.RemoveChildTreeNode(node);
         node.InfoParent.CanFold = node.InfoParent.TreeNodes.Count > 0;
     }
     else
     {
         var tree = (UIBrowserTreeList)Parent;
         tree.RemoveTreeRoot(node);
     }
     node.InfoParent = this;
     DisplayElement.BindingElement.AppendChild(node.DisplayElement.BindingElement);
     TreeNodes.Add(node);
 }
Пример #4
0
 private void _dfsCalculate(UIBrowserTreeNode node, float leftPadding, GameTime gameTime)
 {
     _maxLeftPadding = Math.Max(_maxLeftPadding, leftPadding);
     node.DisplayElement.LeftOffset = leftPadding;
     node.DisplayElement.Position   = new Vector2(0, _totHeight);
     node.DisplayElement.IsSelected = (node.DisplayElement == SelectedElement);
     node.DisplayElement.IsDragOver = (node.DisplayElement.ScreenHitBox.Contains(Main.MouseScreen));
     node.DisplayElement.Update(gameTime);
     _addElement(node.DisplayElement);
     _totHeight  += node.DisplayElement.Height + ItemMargin;
     node.CanFold = (node.TreeNodes.Count != 0);
     if (node.DisplayElement.IsFolded)
     {
         return;
     }
     foreach (var child in node.TreeNodes)
     {
         _dfsCalculate(child, leftPadding + LayerPaddingLeft, gameTime);
     }
 }
Пример #5
0
 internal void RemoveTreeRoot(UIBrowserTreeNode node)
 {
     _roots.Remove(node);
 }
Пример #6
0
 public BrowserTreeDisplayNode(string text, UIElement element, UIBrowserTreeNode info) : base(text)
 {
     BindingElement = element;
     Info           = info;
 }
Пример #7
0
 public void RemoveChildTreeNode(UIBrowserTreeNode node)
 {
     DisplayElement.BindingElement.RemoveChild(node.DisplayElement.BindingElement);
     TreeNodes.Remove(node);
     CanFold = TreeNodes.Count > 0;
 }