Exemplo n.º 1
0
        private void ClearHoveredNode()
        {
            try
            {
                if (hoveredNode != null)
                {
                    //if (!hoveredNode.wasExpanded)
                    //{
                    //    var node = hoveredNode.node;
                    //    new Thread(() =>
                    //    {
                    //        Thread.Sleep(1000);
                    //        directoryTreeView.Invoke((Action)(() =>
                    //        {
                    //            if (hoveredNode != null && !IsParent(node, hoveredNode.node))
                    //                node.Collapse();
                    //        }));
                    //    }).Start();
                    //}

                    hoveredNode.node.BackColor = Color.Transparent;
                    hoveredNode = null;
                }
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        private void SetHoveredNode(TreeNode node)
        {
            if (hoveredNode == null || node != hoveredNode.node)
            {
                ClearHoveredNode();

                if (node != null)
                {
                    try
                    {
                        hoveredNode = new HoveredNode();

                        hoveredNode.node = node;

                        hoveredNode.wasExpanded    = hoveredNode.node.IsExpanded;
                        hoveredNode.node.BackColor = Color.SkyBlue;
                    }
                    catch
                    {
                        hoveredNode = null;
                    }
                }
            }
            else
            {
                if ((DateTime.Now - hoveredNode.startHoverTime).TotalSeconds >= 1.0)
                {
                    hoveredNode.node.Expand();
                }
            }
        }
Exemplo n.º 3
0
        protected override bool OnMotionNotifyEvent(Gdk.EventMotion evnt)
        {
            double dx = evnt.X;
            double dy = evnt.Y;

            if (MouseGrabNode != null)
            {
                if (MouseGrabNode.Draggable && evnt.State.HasFlag(Gdk.ModifierType.Button1Mask))
                {
                    if (!dragging && (Math.Abs(DragStart.X - dx) > 5 || Math.Abs(DragStart.Y - dy) > 5))
                    {
                        dragging = true;
                    }

                    if (dragging)
                    {
                        var point = engine.TransformPoint(MouseGrabNode.Parent, dx, dy);
                        MouseGrabNode.X = point.X - DragOffset.X;
                        MouseGrabNode.Y = point.Y - DragOffset.Y;
                        QueueDraw();
                    }
                }
                else
                {
                    var point = engine.TransformPoint(MouseGrabNode, evnt.X, evnt.Y);
                    MouseGrabNode.MouseMotion(point.X, point.Y, (ModifierType)evnt.State);
                }
            }
            else
            {
                HoveredNode = engine.InputNodeAt(root, evnt.X, evnt.Y);
                if (HoveredNode != null)
                {
                    var point = engine.TransformPoint(HoveredNode, evnt.X, evnt.Y);
                    HoveredNode.MouseMotion(point.X, point.Y, (ModifierType)evnt.State);
                }
            }

            return(base.OnMotionNotifyEvent(evnt));
        }
Exemplo n.º 4
0
        private void SetHoveredNode(TreeNode node)
        {
            if (hoveredNode == null || node != hoveredNode.node)
            {
                ClearHoveredNode();

                if (node != null)
                {
                    try
                    {
                        hoveredNode = new HoveredNode();

                        hoveredNode.node = node;

                        hoveredNode.wasExpanded = hoveredNode.node.IsExpanded;
                        hoveredNode.node.BackColor = Color.SkyBlue;
                    }
                    catch
                    {
                        hoveredNode = null;
                    }
                }
            }
            else
            {
                if ((DateTime.Now - hoveredNode.startHoverTime).TotalSeconds >= 1.0)
                {
                    hoveredNode.node.Expand();
                }
            }
        }
Exemplo n.º 5
0
        private void ClearHoveredNode()
        {
            try
            {
                if (hoveredNode != null)
                {
                    //if (!hoveredNode.wasExpanded)
                    //{
                    //    var node = hoveredNode.node;
                    //    new Thread(() =>
                    //    {
                    //        Thread.Sleep(1000);
                    //        directoryTreeView.Invoke((Action)(() =>
                    //        {
                    //            if (hoveredNode != null && !IsParent(node, hoveredNode.node))
                    //                node.Collapse();
                    //        }));
                    //    }).Start();
                    //}

                    hoveredNode.node.BackColor = Color.Transparent;
                    hoveredNode = null;
                }
            }
            catch
            {
            }
        }