Exemplo n.º 1
0
        void HandleWidgetDragDrop(object o, Gtk.DragDropArgs args)
        {
            lastDragPosition = new Point (args.X, args.Y);
            var cda = ConvertDragAction (args.Context.Action);

            DragDropResult res;
            if ((enabledEvents & WidgetEvent.DragDropCheck) == 0) {
                if ((enabledEvents & WidgetEvent.DragDrop) != 0)
                    res = DragDropResult.None;
                else
                    res = DragDropResult.Canceled;
            }
            else {
                DragCheckEventArgs da = new DragCheckEventArgs (new Point (args.X, args.Y), Util.GetDragTypes (args.Context.Targets), cda);
                Toolkit.Invoke (delegate {
                    EventSink.OnDragDropCheck (da);
                });
                res = da.Result;
                if ((enabledEvents & WidgetEvent.DragDrop) == 0 && res == DragDropResult.None)
                    res = DragDropResult.Canceled;
            }
            if (res == DragDropResult.Canceled) {
                args.RetVal = true;
                Gtk.Drag.Finish (args.Context, false, false, args.Time);
            }
            else if (res == DragDropResult.Success) {
                args.RetVal = true;
                Gtk.Drag.Finish (args.Context, true, cda == DragDropAction.Move, args.Time);
            }
            else {
                // Undefined, we need more data
                args.RetVal = true;
                QueryDragData (args.Context, args.Time, false);
            }
        }
Exemplo n.º 2
0
        internal bool DoDragDrop(Gdk.DragContext context, int x, int y, uint time)
        {
            DragDropInfo.LastDragPosition = new Point (x, y);
            var cda = ConvertDragAction (context.Action);

            DragDropResult res;
            if ((enabledEvents & WidgetEvent.DragDropCheck) == 0) {
                if ((enabledEvents & WidgetEvent.DragDrop) != 0)
                    res = DragDropResult.None;
                else
                    res = DragDropResult.Canceled;
            }
            else {
                DragCheckEventArgs da = new DragCheckEventArgs (new Point (x, y), Util.GetDragTypes (context.Targets), cda);
                ApplicationContext.InvokeUserCode (delegate {
                    EventSink.OnDragDropCheck (da);
                });
                res = da.Result;
                if ((enabledEvents & WidgetEvent.DragDrop) == 0 && res == DragDropResult.None)
                    res = DragDropResult.Canceled;
            }
            if (res == DragDropResult.Canceled) {
                Gtk.Drag.Finish (context, false, false, time);
                return true;
            }
            else if (res == DragDropResult.Success) {
                Gtk.Drag.Finish (context, true, cda == DragDropAction.Move, time);
                return true;
            }
            else {
                // Undefined, we need more data
                QueryDragData (context, time, false);
                return true;
            }
        }
Exemplo n.º 3
0
 public void OnDragDropCheck(DragCheckEventArgs args)
 {
     Parent.OnDragDropCheck (args);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Raises the DragDropCheck event.
 /// </summary>
 /// <param name='args'>
 /// Arguments.
 /// </param>
 protected internal virtual void OnDragDropCheck(DragCheckEventArgs args)
 {
     if (dragDropCheck != null)
         dragDropCheck (this, args);
 }
Exemplo n.º 5
0
 public void OnDragDropCheck(DragCheckEventArgs args)
 {
     Parent.OnDragDropCheck(args);
 }