Exemple #1
0
            public override void HandleDragMotion(object o, Gtk.DragMotionArgs args)
            {
                base.HandleDragMotion(o, args);

                var h = Handler;

                if (h == null)
                {
                    return;
                }
                var info = h.GetDragInfo(DragArgs);

                if (info == null)
                {
                    return;
                }
                var item        = info.Item;
                var insertIndex = info.InsertIndex;

                if (!ReferenceEquals(item, null))
                {
                    var path = h.model.GetPathFromItem(item as ITreeGridItem);
                    if (path == null)
                    {
                        return;
                    }
                    var pos = info.Position.ToGtk();

                    // make sure we are in range of child indecies
                    var iter = h.model.GetIterFromItem(info.Parent as ITreeGridItem);
                    if (iter != null && insertIndex != -1)
                    {
                        var i           = iter.Value;
                        var numChildren = h.model.IterNChildren(i);
                        if (insertIndex >= numChildren)
                        {
                            insertIndex = numChildren - 1;
                            pos         = Gtk.TreeViewDropPosition.After;
                            h.model.IterNthChild(out i, i, insertIndex);
                            path = h.model.GetPath(i);
                        }
                    }

                    if (path.Depth > 0)
                    {
                        h.Tree.SetDragDestRow(path, pos);
                    }
                }
                else if (insertIndex != -1 && !ReferenceEquals(info.Parent, null) && info.Position == GridDragPosition.After)
                {
                    var path = h.model.GetPathFromItem(info.Parent as ITreeGridItem);
                    if (path == null)
                    {
                        return;
                    }

                    path.AppendIndex(0);
                    h.Tree.SetDragDestRow(path, Gtk.TreeViewDropPosition.Before);
                }
            }
Exemple #2
0
 void HandleTargetDragMotion
     (object sender, Gtk.DragMotionArgs args)
 {
     Gdk.Drag.Status(args.Context,
                     args.Context.SuggestedAction,
                     args.Time);
     args.RetVal = true;
 }
Exemple #3
0
        protected virtual void OnDragMotion(object o, Gtk.DragMotionArgs args)
        {
            // FIXME: how do we check from here if that drag has data that we want?

            Gtk.TreePath             path;
            Gtk.TreeViewDropPosition drop_position;
            if (GetDestRowAtPos(args.X, args.Y, out path, out drop_position))
            {
                SetDragDestRow(path, Gtk.TreeViewDropPosition.IntoOrAfter);
            }
            else
            {
                UnsetRowsDragDest();
            }
        }
Exemple #4
0
        static void FaultDragMotion(object obj, Gtk.DragMotionArgs args)
        {
            int wx, wy, width, height, depth;

            Gtk.Widget widget = (Gtk.Widget)obj;
            int        px     = args.X + widget.Allocation.X;
            int        py     = args.Y + widget.Allocation.Y;

            Fault fault = FindFault(px, py, widget);

            // If there's a splitter visible, and we're not currently dragging
            // in the fault that owns that splitter, hide it
            if (splitter != null && dragFault != fault)
            {
                DestroySplitter();
            }

            if (dragFault != fault)
            {
                dragFault = fault;
                if (dragFault == null)
                {
                    return;
                }

                splitter = NewWindow(fault.Owner.Wrapped, Gdk.WindowClass.InputOutput);
                fault.Window.GetGeometry(out wx, out wy, out width, out height, out depth);
                if (fault.Orientation == Gtk.Orientation.Horizontal)
                {
                    splitter.MoveResize(wx, wy + height / 2 - FaultOverlap,
                                        width, 2 * FaultOverlap);
                }
                else
                {
                    splitter.MoveResize(wx + width / 2 - FaultOverlap, wy,
                                        2 * FaultOverlap, height);
                }
                splitter.ShowUnraised();
                fault.Window.Lower();
            }
            else if (dragFault == null)
            {
                return;
            }

            Gdk.Drag.Status(args.Context, Gdk.DragAction.Move, args.Time);
            args.RetVal = true;
        }
Exemple #5
0
        void HandleWidgetDragMotion(object o, Gtk.DragMotionArgs args)
        {
            lastDragPosition = new Point(args.X, args.Y);

            DragDropAction ac;

            if ((enabledEvents & WidgetEvent.DragOverCheck) == 0)
            {
                if ((enabledEvents & WidgetEvent.DragOver) != 0)
                {
                    ac = DragDropAction.Default;
                }
                else
                {
                    ac = ConvertDragAction(destDragAction);
                }
            }
            else
            {
                DragOverCheckEventArgs da = new DragOverCheckEventArgs(new Point(args.X, args.Y), Util.GetDragTypes(args.Context.Targets), ConvertDragAction(args.Context.Actions));
                Toolkit.Invoke(delegate {
                    EventSink.OnDragOverCheck(da);
                });
                ac = da.AllowedAction;
                if ((enabledEvents & WidgetEvent.DragOver) == 0 && ac == DragDropAction.Default)
                {
                    ac = DragDropAction.None;
                }
            }

            if (ac == DragDropAction.None)
            {
                args.RetVal = true;
                Gdk.Drag.Status(args.Context, (Gdk.DragAction) 0, args.Time);
            }
            else if (ac == DragDropAction.Default)
            {
                // Undefined, we need more data
                args.RetVal = true;
                QueryDragData(args.Context, args.Time, true);
            }
            else
            {
//				Gtk.Drag.Highlight (Widget);
                args.RetVal = true;
                Gdk.Drag.Status(args.Context, ConvertDragAction(ac), args.Time);
            }
        }
Exemple #6
0
            public virtual void HandleDragMotion(object o, Gtk.DragMotionArgs args)
            {
                DragArgs = GetDragEventArgs(args.Context, new PointF(args.X, args.Y), args.Time);

                if (!isDragOver)
                {
                    Handler.Callback.OnDragEnter(Handler.Widget, DragArgs);
                }
                else
                {
                    Handler.Callback.OnDragOver(Handler.Widget, DragArgs);
                }

                Gdk.Drag.Status(args.Context, DragArgs.Effects.ToGdk(), args.Time);

                isDragOver  = true;
                args.RetVal = true;
            }
Exemple #7
0
            public override void HandleDragMotion(object o, Gtk.DragMotionArgs args)
            {
                base.HandleDragMotion(o, args);

                var h = Handler;

                if (h == null)
                {
                    return;
                }
                var info = h.GetDragInfo(DragArgs);

                if (info == null)
                {
                    return;
                }

                if (info.Index >= 0)
                {
                    var path = new Gtk.TreePath(new[] { info.Index });
                    var pos  = info.Position.ToGtk();
                    h.Tree.SetDragDestRow(path, pos);
                }
            }
Exemple #8
0
 void HandleWidgetDragMotion(object o, Gtk.DragMotionArgs args)
 {
     args.RetVal = DoDragMotion(args.Context, args.X, args.Y, args.Time);
 }
 /// <summary>
 /// Handles the DragMotion event.
 /// </summary>
 /// <param name="o">The menu layout Gtk.TreeView.</param>
 /// <param name="args">The event data.</param>
 protected void HandleDragMotion(object o, Gtk.DragMotionArgs args)
 {
     DebugDragDrop("HandleDragMotion");
 }