Ejemplo n.º 1
0
 public DragOverEventArgs(Point position, ITransferData info, DragDropAction action)
 {
     Position      = position;
     Info          = info;
     Action        = action;
     AllowedAction = DragDropAction.Default;
 }
Ejemplo n.º 2
0
        public void SetDragTarget(string[] types, DragDropAction dragAction)
        {
            SetupForDragDrop(Widget.GetType());
            var dtypes = types.Select(t => ToNSDragType(t)).ToArray();

            Widget.RegisterForDraggedTypes(dtypes);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Xwt.DragOverEventArgs"/> class.
 /// </summary>
 /// <param name="position">The potential drop coordinates (in widget coordinates).</param>
 /// <param name="dataStore">The collection of transferred data.</param>
 /// <param name="action">The proposed drag&amp;drop action type.</param>
 public DragOverEventArgs(Point position, ITransferData dataStore, DragDropAction action)
 {
     Position      = position;
     Data          = dataStore;
     Action        = action;
     AllowedAction = DragDropAction.Default;
 }
Ejemplo n.º 4
0
		public DragEventArgs (Point position, Xwt.Backends.TransferDataStore dataStore, DragDropAction action)
		{
			Data = dataStore;
			Position = position;
			Action = action;
			Success = false;
		}
Ejemplo n.º 5
0
        public void SetDragSource(string[] types, DragDropAction dragAction)
        {
            sourceDragAction = ConvertDragAction(dragAction);
            var table = Util.BuildTargetTable(types);

            Gtk.Drag.SourceSet(Widget, (Gdk.ModifierType) 0, (Gtk.TargetEntry[])table, sourceDragAction);
        }
Ejemplo n.º 6
0
		public DragOverCheckEventArgs (Point position, TransferDataType[] types, DragDropAction action)
		{
			DataTypes = types;
			Action = action;
			Position = position;
			AllowedAction = DragDropAction.Default;
		}
Ejemplo n.º 7
0
 public DragCheckEventArgs(Point position, TransferDataType[] types, DragDropAction action)
 {
     DataTypes = types;
     Action = action;
     Position = position;
     Result = DragDropResult.None;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Xwt.DragEventArgs"/> class.
 /// </summary>
 /// <param name="position">The drop coordinates (in widget coordinates).</param>
 /// <param name="dataStore">The collection of transferred data.</param>
 /// <param name="action">The drag&amp;drop action type.</param>
 public DragEventArgs(Point position, Xwt.Backends.TransferDataStore dataStore, DragDropAction action)
 {
     Data     = dataStore;
     Position = position;
     Action   = action;
     Success  = false;
 }
Ejemplo n.º 9
0
        public void SetDragSource(TransferDataType[] types, DragDropAction dragAction)
        {
            DragDropInfo.SourceDragAction = ConvertDragAction(dragAction);
            var table = Util.BuildTargetTable(types);

            OnSetDragSource(Gdk.ModifierType.Button1Mask, (Gtk.TargetEntry[])table, DragDropInfo.SourceDragAction);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Xwt.DragOverCheckEventArgs"/> class.
 /// </summary>
 /// <param name="position">The potential drop coordinates (in widget coordinates).</param>
 /// <param name="types">The transferred data types.</param>
 /// <param name="action">The proposed drag&amp;drop action type.</param>
 public DragOverCheckEventArgs(Point position, TransferDataType[] types, DragDropAction action)
 {
     DataTypes     = types;
     Action        = action;
     Position      = position;
     AllowedAction = DragDropAction.Default;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Xwt.DragCheckEventArgs"/> class.
 /// </summary>
 /// <param name="position">The drop coordinates (in widget coordinates).</param>
 /// <param name="types">The types of the transferred data.</param>
 /// <param name="action">The proposed drag&amp;drop action type.</param>
 public DragCheckEventArgs(Point position, TransferDataType[] types, DragDropAction action)
 {
     DataTypes = types;
     Action    = action;
     Position  = position;
     Result    = DragDropResult.None;
 }
Ejemplo n.º 12
0
 public DragEventArgs(Point position, ITransferData data, DragDropAction action)
 {
     Data     = data;
     Position = position;
     Action   = action;
     Success  = false;
 }
Ejemplo n.º 13
0
        public void SetDragTarget(string[] types, DragDropAction dragAction)
        {
            destDragAction = ConvertDragAction(dragAction);
            var table = Util.BuildTargetTable(types);

            validDropTypes = (Gtk.TargetEntry[])table;
            Gtk.Drag.DestSet(Widget, Gtk.DestDefaults.Highlight, validDropTypes, destDragAction);
        }
Ejemplo n.º 14
0
 internal DragStartData(TransferDataSource data, DragDropAction action, object imageBackend, double hotX, double hotY)
 {
     Data         = data;
     DragAction   = action;
     ImageBackend = imageBackend;
     HotX         = hotX;
     HotY         = hotY;
 }
Ejemplo n.º 15
0
 public void DragStart(TransferDataSource data, DragDropAction dragAction, object imageBackend, double hotX, double hotY)
 {
     Gdk.DragAction action = ConvertDragAction(dragAction);
     currentDragData   = data;
     Widget.DragBegin += HandleDragBegin;
     IconInitializer.Init(Widget, (Gdk.Pixbuf)imageBackend, hotX, hotY);
     Gtk.Drag.Begin(Widget, Util.BuildTargetTable(data.DataTypes), action, 1, Gtk.Global.CurrentEvent);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Sets up a widget so that XWT will start a drag operation when the user clicks and drags on the widget.
 /// </summary>
 /// <param name='types'>
 /// Types of data that can be dragged from this widget
 /// </param>
 /// <param name='dragAction'>
 /// Bitmask of possible actions for a drag from this widget
 /// </param>
 public virtual void SetDragSource(DragDropAction dragAction, params TransferDataType[] types)
 {
     if (DragDropInfo.AutodetectDrag)
     {
         return; // Drag auto detect has been already activated.
     }
     DragDropInfo.AutodetectDrag = true;
     DragDropInfo.SourceTypes    = types;
 }
Ejemplo n.º 17
0
    private static void AddDropCardAction(this GameObject gameObject, DragDropAction dropAction)
    {
        BoxCollider2D boxCollider = gameObject.AddComponent <BoxCollider2D>();

        boxCollider.isTrigger = true;
        boxCollider.size      = D.CardSize;
        var dropController = gameObject.AddComponent <DropCardController>();

        dropController.DragDropAction = dropAction;
    }
Ejemplo n.º 18
0
 public void SetDragSource(TransferDataType [] types, DragDropAction dragAction)
 {
     if (DragDropInfo.AutodetectDrag)
     {
         return;                 // Drag auto detect has been already activated.
     }
     DragDropInfo.AutodetectDrag = true;
     Widget.MouseUp   += WidgetMouseUpForDragHandler;
     Widget.MouseMove += WidgetMouseMoveForDragHandler;
 }
Ejemplo n.º 19
0
    static DragDropAction GetOrCreateAction(DependencyObject depObj)
    {
        DragDropAction action = depObj.GetValue(DragDropActionProperty) as DragDropAction;

        if (action == null)
        {
            action = new DragDropAction();
            depObj.SetValue(DragDropActionProperty, action);
        }
        return(action);
    }
        public void DragOver(IDropInfo dropInfo)
        {
            DragDropAction <StartListItemViewModel> action
                = dropInfo.GetDragDropAction <StartListItemViewModel>(inSource: s => this.Skiers.Data.Contains(s));

            if (action == null)
            {
                return;
            }

            switch (action.Drag, action.Drop)
            {
Ejemplo n.º 21
0
 public override void SetDragSource(DragDropAction dragAction, params TransferDataType[] types)
 {
     base.SetDragSource(dragAction, types);
     Backend.MouseUp += (s, e) => {
         var ev = Converter.Convert(e);
         MouseUp(ev);
     };
     Backend.MouseMove += (s, e) => {
         var ev = Converter.Convert(e);
         MouseMove(ev);
     };
 }
Ejemplo n.º 22
0
        private void ListViewControl_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Effect != DragDropEffects.Copy)
            {
                return;
            }
            if (!e.Data.GetDataPresent(typeof(DragDropData)))
            {
                return;
            }

            DragDropData   data   = e.Data.GetData(typeof(DragDropData)) as DragDropData;
            DragDropKey    key    = new DragDropKey(data.SourceColumn.GetType().FullName, GetType().FullName);
            DragDropAction action = Host.DragDropHandlers[key];

            action.Invoke(data.SourceColumn, this, data.Items);
        }
Ejemplo n.º 23
0
        static NSDragOperation ConvertAction(DragDropAction action)
        {
            NSDragOperation res = (NSDragOperation)0;

            if ((action & DragDropAction.Copy) != 0)
            {
                res |= NSDragOperation.Copy;
            }
            if ((action & DragDropAction.Move) != 0)
            {
                res |= NSDragOperation.Move;
            }
            if ((action & DragDropAction.Link) != 0)
            {
                res |= NSDragOperation.Link;
            }
            return(res);
        }
Ejemplo n.º 24
0
        public static DragDropEffects ToWpfDropEffect(this DragDropAction value)
        {
            var effects = DragDropEffects.None;

            if ((value & DragDropAction.Copy) > 0)
            {
                effects |= DragDropEffects.Copy;
            }
            if ((value & DragDropAction.Move) > 0)
            {
                effects |= DragDropEffects.Move;
            }
            if ((value & DragDropAction.Link) > 0)
            {
                effects |= DragDropEffects.Link;
            }
            return(effects);
        }
Ejemplo n.º 25
0
            protected override IEnumerable <DragDropAction> CreateDragDropActions()
            {
                /*
                 * var stashDD = new DragDropAction<StashNode>(
                 *  (draggedStash) => IsActive,
                 *  (draggedStash) =>
                 *  {
                 *      // normal -> Pop
                 *      // Alt -> Apply
                 *      UICommands.StartStashDialog();
                 *  });
                 */
                var branchDD = new DragDropAction <BranchNode>(draggedBranch =>
                {
                    string activeBranch = UICommands.Module.GetSelectedBranch();
                    if (Equals(FullPath, activeBranch))
                    {
// target is active -> merge dropped
                        return(true);
                    }
                    if (Equals(draggedBranch.FullPath, activeBranch))
                    {
// dragged is active -> merge dragged
                        return(true);
                    }
                    return(false);
                }, draggedBranch =>
                {
                    string activeBranch = UICommands.Module.GetSelectedBranch();
                    if (Equals(FullPath, activeBranch))
                    {
// target is active -> merge dropped
                        UICommands.StartMergeBranchDialog(draggedBranch.FullPath);
                    }
                    if (Equals(draggedBranch.FullPath, activeBranch))
                    {
// dropped is active -> merge target
                        UICommands.StartMergeBranchDialog(FullPath);
                    }
                });


                return(new DragDropAction[] { /*stashDD,*/ branchDD });
            }
Ejemplo n.º 26
0
        static DragDropAction ConvertAction(NSDragOperation action)
        {
            if (action == NSDragOperation.AllObsolete)
            {
                return(DragDropAction.All);
            }
            DragDropAction res = (DragDropAction)0;

            if ((action & NSDragOperation.Copy) != 0)
            {
                res |= DragDropAction.Copy;
            }
            if ((action & NSDragOperation.Move) != 0)
            {
                res |= DragDropAction.Move;
            }
            if ((action & NSDragOperation.Link) != 0)
            {
                res |= DragDropAction.Link;
            }
            return(res);
        }
Ejemplo n.º 27
0
        public void DragStart(TransferDataSource data, DragDropAction dragAction, object image, double xhot, double yhot)
        {
            var lo = RootWidget.ConvertPointToBase(new PointF(Widget.Bounds.X, Widget.Bounds.Y));

            lo = RootWidget.Window.ConvertBaseToScreen(lo);
            var ml = NSEvent.CurrentMouseLocation;
            var pb = NSPasteboard.FromName(NSPasteboard.NSDragPasteboardName);

            if (pb == null)
            {
                throw new InvalidOperationException("Could not get pasteboard");
            }
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            InitPasteboard(pb, data);
            var img = (NSImage)image;
            var pos = new PointF(ml.X - lo.X - (float)xhot, lo.Y - ml.Y - (float)yhot + img.Size.Height);

            Widget.DragImage(img, pos, new SizeF(0, 0), NSApplication.SharedApplication.CurrentEvent, pb, Widget, true);
        }
Ejemplo n.º 28
0
        public virtual DragDropAction DragDropActionFromKeyState(int keyState, DragDropAction allowedEffect)
        {
            // Set the effect based upon the KeyState.
            if ((keyState & (8 + 32)) == (8 + 32) &&
                (allowedEffect & DragDropAction.Link) == DragDropAction.Link)
            {
                // KeyState 8 + 32 = CTL + ALT

                // Link drag and drop effect.
                return(DragDropAction.Link);
            }
            else if ((keyState & 32) == 32 &&
                     (allowedEffect & DragDropAction.Link) == DragDropAction.Link)
            {
                // ALT KeyState for link.
                return(DragDropAction.Link);
            }
            else if ((keyState & 4) == 4 &&
                     (allowedEffect & DragDropAction.Move) == DragDropAction.Move)
            {
                // SHIFT KeyState for move.
                return(DragDropAction.Move);
            }
            else if ((keyState & 8) == 8 &&
                     (allowedEffect & DragDropAction.Copy) == DragDropAction.Copy)
            {
                // CTL KeyState for copy.
                return(DragDropAction.Copy);
            }
            else if ((allowedEffect & DragDropAction.Move) == DragDropAction.Move)
            {
                // By default, the drop action should be copy, if allowed.
                return(DragDropAction.Copy);
            }
            return(DragDropAction.Copy);
        }
Ejemplo n.º 29
0
 public void SetDragTarget(string[] types, DragDropAction dragAction)
 {
 }
Ejemplo n.º 30
0
 public void SetDragSource(string[] types, DragDropAction dragAction)
 {
 }
Ejemplo n.º 31
0
 public void DragStart(TransferDataSource data, DragDropAction dragAction, object dragImage, double xhot, double yhot)
 {
     throw new NotImplementedException ();
 }
Ejemplo n.º 32
0
 public void SetDragTarget(TransferDataType[] types, DragDropAction dragAction)
 {
     DragDropInfo.DestDragAction = ConvertDragAction (dragAction);
     var table = Util.BuildTargetTable (types);
     DragDropInfo.ValidDropTypes = (Gtk.TargetEntry[]) table;
     OnSetDragTarget (DragDropInfo.ValidDropTypes, DragDropInfo.DestDragAction);
 }
Ejemplo n.º 33
0
 public void SetDragSource(TransferDataType[] types, DragDropAction dragAction)
 {
     AllocEventBox ();
     DragDropInfo.SourceDragAction = ConvertDragAction (dragAction);
     var table = Util.BuildTargetTable (types);
     OnSetDragSource (Gdk.ModifierType.Button1Mask, (Gtk.TargetEntry[]) table, DragDropInfo.SourceDragAction);
 }
Ejemplo n.º 34
0
		void IWidgetBackend.SetDragSource (TransferDataType[] types, DragDropAction dragAction)
		{
			this.SetDragSource (dragAction, types);
		}
Ejemplo n.º 35
0
 public void SetDragSource(TransferDataType [] types, DragDropAction dragAction)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 36
0
 Gdk.DragAction ConvertDragAction(DragDropAction dragAction)
 {
     Gdk.DragAction action = (Gdk.DragAction)0;
     if ((dragAction & DragDropAction.Copy) != 0)
         action |= Gdk.DragAction.Copy;
     if ((dragAction & DragDropAction.Move) != 0)
         action |= Gdk.DragAction.Move;
     if ((dragAction & DragDropAction.Link) != 0)
         action |= Gdk.DragAction.Link;
     return action;
 }
Ejemplo n.º 37
0
 public void SetDragSource(string[] types, DragDropAction dragAction)
 {
     sourceDragAction = ConvertDragAction (dragAction);
     var table = Util.BuildTargetTable (types);
     Gtk.Drag.SourceSet (Widget, (Gdk.ModifierType)0, (Gtk.TargetEntry[]) table, sourceDragAction);
 }
Ejemplo n.º 38
0
 public void SetDragSource(DragDropAction dragAction, params string[] types)
 {
     Backend.SetDragSource (types, dragAction);
 }
Ejemplo n.º 39
0
 public DragOverEventArgs(Point position, ITransferData dataStore, DragDropAction action)
 {
     Position = position;
     Data = dataStore;
     Action = action;
     AllowedAction = DragDropAction.Default;
 }
Ejemplo n.º 40
0
 public void SetDragSource(DragDropAction dragAction, params Type[] types)
 {
     Backend.SetDragSource (types.Select (t => TransferDataType.FromType (t)).ToArray(), dragAction);
 }
Ejemplo n.º 41
0
 public void SetDragSource(DragDropAction dragAction, params TransferDataType[] types)
 {
     Backend.SetDragSource (types, dragAction);
 }
Ejemplo n.º 42
0
            protected override IEnumerable<DragDropAction> CreateDragDropActions()
            {
                /*
                var stashDD = new DragDropAction<StashNode>(
                    (draggedStash) => IsActive,
                    (draggedStash) =>
                    {
                        // normal -> Pop
                        // Alt -> Apply
                        UICommands.StartStashDialog();
                    });
                */
                var branchDD = new DragDropAction<BranchNode>(draggedBranch =>
                {
                    string activeBranch = UICommands.Module.GetSelectedBranch();
                    if (Equals(FullPath, activeBranch))
                    {// target is active -> merge dropped
                        return true;
                    }
                    if (Equals(draggedBranch.FullPath, activeBranch))
                    {// dragged is active -> merge dragged
                        return true;
                    }
                    return false;
                }, draggedBranch =>
                {
                    string activeBranch = UICommands.Module.GetSelectedBranch();
                    if (Equals(FullPath, activeBranch))
                    {// target is active -> merge dropped
                        UICommands.StartMergeBranchDialog(draggedBranch.FullPath);
                    }
                    if (Equals(draggedBranch.FullPath, activeBranch))
                    {// dropped is active -> merge target
                        UICommands.StartMergeBranchDialog(FullPath);
                    }
                });

                return new DragDropAction[] { /*stashDD,*/ branchDD };
            }
Ejemplo n.º 43
0
 public void SetDragDropTarget(DragDropAction dragAction, params Type[] types)
 {
     Backend.SetDragTarget (types.Select (t => TransferDataType.GetDataType (t)).ToArray(), dragAction);
 }
Ejemplo n.º 44
0
 public void DragStart(TransferDataSource data, DragDropAction dragAction, object imageBackend, double hotX, double hotY)
 {
     Gdk.DragAction action = ConvertDragAction (dragAction);
     currentDragData = data;
     Widget.DragBegin += HandleDragBegin;
     IconInitializer.Init (Widget, (Gdk.Pixbuf) imageBackend, hotX, hotY);
     Gtk.Drag.Begin (Widget, Util.BuildTargetTable (data.DataTypes), action, 1, Gtk.Global.CurrentEvent);
 }
Ejemplo n.º 45
0
        public void SetDragSource(TransferDataType [] types, DragDropAction dragAction)
        {
            if (DragDropInfo.AutodetectDrag)
                return; // Drag auto detect has been already activated.

            DragDropInfo.AutodetectDrag = true;
            Widget.MouseUp += WidgetMouseUpForDragHandler;
            Widget.MouseMove += WidgetMouseMoveForDragHandler;
        }
Ejemplo n.º 46
0
 public void SetDragTarget(string[] types, DragDropAction dragAction)
 {
     destDragAction = ConvertDragAction (dragAction);
     var table = Util.BuildTargetTable (types);
     validDropTypes = (Gtk.TargetEntry[]) table;
     Gtk.Drag.DestSet (Widget, Gtk.DestDefaults.Highlight, validDropTypes, destDragAction);
 }
Ejemplo n.º 47
0
 public void SetDragSource(DragDropAction dragAction, params Type[] types)
 {
     Backend.SetDragSource (types.Select (t => t.FullName).ToArray(), dragAction);
 }
Ejemplo n.º 48
0
 public void DragStart(TransferDataSource data, DragDropAction dragAction, object imageBackend, double hotX, double hotY)
 {
     throw new NotImplementedException ();
 }
Ejemplo n.º 49
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Xwt.Backends.DragStartData"/> class.
		/// </summary>
		/// <param name="data">The collection of data to be transferred through drag operation.</param>
		/// <param name="action">The type of the drag action.</param>
		/// <param name="imageBackend">The image backend of the drag image.</param>
		/// <param name="hotX">The image hotspot X coordinate.</param>
		/// <param name="hotY">The image hotspot Y coordinate.</param>
		internal DragStartData (TransferDataSource data, DragDropAction action, object imageBackend, double hotX, double hotY)
		{
			Data = data;
			DragAction = action;
			ImageBackend = imageBackend;
			HotX = hotX;
			HotY = hotY;
		}
Ejemplo n.º 50
0
 public void SetDragTarget(string [] types, DragDropAction dragAction)
 {
     throw new NotImplementedException ();
 }
Ejemplo n.º 51
0
 public void SetDragDropTarget(DragDropAction dragAction, params string[] types)
 {
     Backend.SetDragTarget (types, dragAction);
 }
Ejemplo n.º 52
0
 public void SetDragTarget(string[] types, DragDropAction dragAction)
 {
 }
Ejemplo n.º 53
0
 internal void DragStart(TransferDataSource data, DragDropAction allowedDragActions, object image, double hotX, double hotY)
 {
     Backend.DragStart (data, allowedDragActions, image, hotX, hotY);
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Sets a widget as a potential drop destination
 /// </summary>
 /// <param name='types'>
 /// Types.
 /// </param>
 /// <param name='dragAction'>
 /// Drag action.
 /// </param>
 public override void SetDragTarget(DragDropAction dragAction, params TransferDataType[] types)
 {
     DragDropInfo.TargetTypes = types == null ? new TransferDataType[0] : types;
     Backend.AllowDrop        = true;
 }
Ejemplo n.º 55
0
 public void SetDragTarget(TransferDataType [] types, DragDropAction dragAction)
 {
     throw new NotImplementedException ();
 }
Ejemplo n.º 56
0
 public void SetDragTarget(TransferDataType [] types, DragDropAction dragAction)
 {
     DragDropInfo.TargetTypes = types == null ? new TransferDataType [0] : types;
     Widget.AllowDrop = true;
 }
Ejemplo n.º 57
0
 public void SetDragDropTarget(DragDropAction dragAction, params TransferDataType[] types)
 {
     Backend.SetDragTarget (types, dragAction);
 }