Beispiel #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (!Focused)
            {
                Focus();
            }

            updateMouseInfo(e.Location);
            if (e.Button == MouseButtons.Left)
            {
                if (highlightArrow != null)
                {
                    highlightArrow.Expanded = !highlightArrow.Expanded;
                    Invalidate();
                }

                if (highlightNode != null)
                {
                    SelectedNode = highlightNode;
                }
            }

            DynamicTreeNode n = NodeAt(e.Location);

            OnNodeMouseDown(new DynamicTreeNodeMouseEventArgs(n, e));
        }
Beispiel #2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);

            DynamicTreeNode n = NodeAt(e.Location);

            OnNodeMouseUp(new DynamicTreeNodeMouseEventArgs(n, e));
        }
Beispiel #3
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            lastClick = e;

            DynamicTreeNode n = NodeAt(e.Location);

            OnNodeMouseClick(new DynamicTreeNodeMouseEventArgs(n, e));
        }
Beispiel #4
0
 private void ValidateSelectedNode()
 {
     if (SelectedNode != null)
     {
         if (!Nodes.VisibleNodes.Contains(SelectedNode))
         {
             SelectedNode = null;
         }
     }
 }
Beispiel #5
0
        protected override void OnDoubleClick(EventArgs e)
        {
            base.OnDoubleClick(e);

            if (lastClick == null)
            {
                return;
            }

            DynamicTreeNode n = NodeAt(lastClick.Location);

            OnNodeMouseDoubleClick(new DynamicTreeNodeMouseEventArgs(n, lastClick));
        }
 public override bool HighlightWhenSelected(DynamicTreeNode n)
 {
     return(Link.HighlightWhenSelected(n));
 }
 public DynamicTreeLinkNode(DynamicTreeNodeCollection collection, DynamicTreeNode link)
     : base(collection, null)
 {
     Link       = link;
     nodesCache = new DynamicTreeNodeCollection(View, this);
 }
 public virtual bool HighlightWhenSelected(DynamicTreeNode n)
 {
     return(ClientData.HighlightWhenSelected.Contains(n.ClientData));
 }
 private void ChangedDataChild(int index, IDynamicTreeNodeDataProxy d)
 {
     Nodes[index] = new DynamicTreeNode(Nodes, d);
 }
 public DynamicTreeNodeMouseEventArgs(DynamicTreeNode n, MouseEventArgs e)
     : base(e.Button, e.Clicks, e.X, e.Y, e.Delta)
 {
     node = n;
 }
 public override bool HighlightWhenSelected(DynamicTreeNode n)
 {
     return Link.HighlightWhenSelected(n);
 }
 public virtual bool HighlightWhenSelected(DynamicTreeNode n)
 {
     return ClientData.HighlightWhenSelected.Contains(n.ClientData);
 }
Beispiel #13
0
        }                                                                                                                                //Gets or sets a root node for the view. Its nodes will be shown as the root's child nodes.

        public void SetRoot(IDynamicTreeNodeDataProxy data)
        {
            Root = data != null ? new DynamicTreeNode(new DynamicTreeNodeCollection(this), data) : null;
        }
Beispiel #14
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (e.KeyCode == Keys.Down)
            {
                if (SelectedNode == null)
                {
                    if (Nodes.Count == 0)
                    {
                        return;
                    }
                    SelectedNode = Nodes.VisibleNodes.First();
                    return;
                }
                int index = Nodes.VisibleNodes.IndexOf(SelectedNode) + 1;
                index        = Math.Min(Nodes.VisibleNodes.Count - 1, index);
                SelectedNode = Nodes.VisibleNodes[index];
            }
            else if (e.KeyCode == Keys.Up)
            {
                if (SelectedNode == null)
                {
                    if (Nodes.Count == 0)
                    {
                        return;
                    }
                    SelectedNode = Nodes.VisibleNodes.Last();
                    return;
                }
                int index = Nodes.VisibleNodes.IndexOf(SelectedNode) - 1;
                index        = Math.Max(0, index);
                SelectedNode = Nodes.VisibleNodes[index];
            }
            else if (e.KeyCode == Keys.Left)
            {
                if (SelectedNode != null && SelectedNode.Expanded)
                {
                    SelectedNode.Expanded = false;
                    Invalidate();
                }
            }
            else if (e.KeyCode == Keys.Right)
            {
                if (SelectedNode != null && !SelectedNode.Expanded)
                {
                    SelectedNode.Expanded = true;
                    Invalidate();
                }
            }
            else if (e.KeyCode == Keys.Home)
            {
                SelectedNode = Nodes.VisibleNodes.First();
            }
            else if (e.KeyCode == Keys.End)
            {
                SelectedNode = Nodes.VisibleNodes.Last();
            }
            else if (e.KeyCode == Keys.PageDown)
            {
                if (SelectedNode == null)
                {
                    SelectedNode = Nodes.VisibleNodes.First();
                    return;
                }
                int index = Nodes.VisibleNodes.IndexOf(SelectedNode) + 10;
                index        = Math.Min(Nodes.VisibleNodes.Count - 1, index);
                SelectedNode = Nodes.VisibleNodes[index];
            }
            else if (e.KeyCode == Keys.PageUp)
            {
                if (SelectedNode == null)
                {
                    SelectedNode = Nodes.VisibleNodes.Last();
                    return;
                }

                int index = Nodes.VisibleNodes.IndexOf(SelectedNode) - 10;
                index        = Math.Max(0, index);
                SelectedNode = Nodes.VisibleNodes[index];
            }

            /*
             * if (e.KeyCode == Keys.F)
             * {
             *  if (ArrowRenderStyle == DynamicTreeViewRenderStyle.Native)
             *  {
             *      ArrowRenderStyle = DynamicTreeViewRenderStyle.FakeNative;
             *      SelectionRenderStyle = DynamicTreeViewRenderStyle.FakeNative;
             *  }
             *  else
             *  {
             *      ArrowRenderStyle = DynamicTreeViewRenderStyle.Native;
             *      SelectionRenderStyle = DynamicTreeViewRenderStyle.Native;
             *  }
             *  Invalidate();
             * }*/
        }
 public DynamicTreeNodeMouseEventArgs(DynamicTreeNode n, MouseEventArgs e)
     : base(e.Button, e.Clicks, e.X, e.Y, e.Delta)
 {
     node = n;
 }
 private void ChangedDataChild(int index, IDynamicTreeNodeDataProxy d)
 {
     Nodes[index] = new DynamicTreeNode(Nodes, d);
 }
 public DynamicTreeLinkNode(DynamicTreeNodeCollection collection, DynamicTreeNode link)
     : base(collection, null)
 {
     Link = link;
     nodesCache = new DynamicTreeNodeCollection(View, this);
 }