Пример #1
0
            /// <inheritdoc />
            public override void OnDragLeave()
            {
                _currentDragEffect = DragDropEffect.None;
                _timeline.DragHandlers.ForEach(x => x.Helper.OnDragLeave());

                base.OnDragLeave();
            }
Пример #2
0
 public void NotifyDropped(DragDropEffect dropEffect)
 {
     if (dropEffect == DragDropEffect.Move)
     {
         this.CloseGroup();
     }
 }
Пример #3
0
            /// <inheritdoc />
            public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
            {
                var result = base.OnDragEnter(ref location, data);

                if (result == DragDropEffect.None)
                {
                    if (_needSetup)
                    {
                        _needSetup = false;
                        _timeline.SetupDragDrop();
                    }
                    for (int i = 0; i < _timeline.DragHandlers.Count; i++)
                    {
                        var dragHelper = _timeline.DragHandlers[i].Helper;
                        if (dragHelper.OnDragEnter(data))
                        {
                            result = dragHelper.Effect;
                            break;
                        }
                    }
                    _currentDragEffect = result;
                }

                return(result);
            }
Пример #4
0
 /// <summary>
 /// Notifies the handler, that a drag operation has started above the control
 /// </summary>
 public void NotifyDragStarted(DragDropEffect effect)
 {
     if (effect != DragDropEffect.None)
     {
         this.SetUpAdorner();
     }
 }
Пример #5
0
 public void Drop(IEnumerable <IDragSource> nodes, DropPosition mode, DragDropEffect effect, DragDropKeyStates initialKeyStates)
 {
     foreach (var node in nodes)
     {
         this.Drop(node, mode, effect == DragDropEffect.Copy);
     }
 }
Пример #6
0
 public void Drop(IEnumerable<IDragSource> nodes, DropPosition mode, DragDropEffect effect, DragDropKeyStates initialKeyStates)
 {
     foreach (var node in nodes)
     {
         this.Drop(node, mode, effect == DragDropEffect.Copy);
     }
 }
Пример #7
0
        private void HandleDragStart(DragDropEffect effect)
        {
            if (this.isDragging == false)
            {
                this.OpenPopup();
                this.dragTargetHandler.NotifyDragStarted(effect);

                this.isDragging = true;
            }
        }
Пример #8
0
 /// <summary>
 /// Notifies the handler of an update of the mouse position on the control
 /// </summary>
 public void NotifyDragChanged(DragDropEffect effect, DragPosition position)
 {
     if (effect == DragDropEffect.None)
     {
         this.TearDownAdorner();
     }
     else
     {
         this.SetUpAdorner();
     }
 }
Пример #9
0
        /// <summary>
        /// Drops the data on the target with the given drop effect. <c>additionalDropInfo</c> may contain
        /// additonal data that can be used during the drop operation, depending on the type of target UI control
        /// </summary>
        public void DoDrop(IDataObject data, DragDropEffect effect, AdditionalDropInfo additionalDropInfo)
        {
            DragDropItemHandlerBase ItemHandler = this.GetItemHandler(data);

            if (ItemHandler != null)
            {
                ItemHandler.DoDrop(data, effect, additionalDropInfo);
            }
            else
            {
                throw new InvalidOperationException("drag drop not requested, but doDrop was called");
            }
        }
Пример #10
0
 /// <summary>
 /// Notifies the handler of an update of the mouse position on the control
 /// </summary>
 public void NotifyDragChanged(DragDropEffect effect, DragPosition position)
 {
     if (effect == DragDropEffect.None)
     {
         this.TearDownAdorner();
     }
     else
     {
         int  DropIndex  = this.CalculateDropIndex(position.GetPosition(this.Element));
         Rect DropMarker = this.CalculateDropMarker(DropIndex);
         this.UpdateAdorner(DropIndex, DropMarker);
     }
 }
Пример #11
0
        public bool CanDrop(IDragSource node, DropPosition mode, DragDropEffect effect)
        {
            var cvm2 = this;

            while (cvm2 != null)
            {
                if (cvm2 == node)
                {
                    return(false);
                }
                cvm2 = cvm2.Parent;
            }
            return(node is NodeViewModel && (mode == DropPosition.Add || this.Parent != null));
        }
Пример #12
0
        /// <summary>
        /// Called when drag enter.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <returns>The result.</returns>
        public DragDropEffect OnDragEnter(/*ref Vector2 location, */ DragData data)
        {
            DragDropEffect effect = DragDropEffect.None;

            for (var i = 0; i < Count; i++)
            {
                var dragHelper = this[i];
                if (dragHelper.OnDragEnter(data))
                {
                    effect = dragHelper.Effect;
                }
            }

            return(effect);
        }
Пример #13
0
        /// <inheritdoc />
        public override DragDropEffect OnDragEnter(ref Vector2 location, DragData data)
        {
            _dragEffect = DragDropEffect.None;

            var result = base.OnDragEnter(ref location, data);

            if (result != DragDropEffect.None)
            {
                return(result);
            }

            if (data is DragDataText textData && DragScripts.IsValidData(textData))
            {
                return(_dragEffect = DragDropEffect.Move);
            }

            return(result);
        }
Пример #14
0
        private DragDropEffects GetDropEffect(DragDropEffects allowedEffects, DragDropKeyStates keyStates, IDataObject data)
        {
            DragDropEffects   AcceptedEffects = this.targetHandler.GetDropEffects(data);
            DragDropKeyStates KeyboardStates  = keyStates & (DragDropKeyStates.AltKey | DragDropKeyStates.ShiftKey | DragDropKeyStates.ControlKey);
            DragDropKeyStates MouseStates     = keyStates & (DragDropKeyStates.LeftMouseButton | DragDropKeyStates.RightMouseButton | DragDropKeyStates.MiddleMouseButton);

            if (AcceptedEffects == DragDropEffects.Scroll)
            {
                return(DragDropEffects.Scroll);
            }

            if (KeyboardStates == DragDropKeyStates.None)
            {
                DragDropEffect DefaultEffect = this.targetHandler.GetDefaultEffect(data);
                if ((allowedEffects & (DragDropEffects)DefaultEffect) != 0)
                {
                    return((DragDropEffects)DefaultEffect);
                }
            }
            else if ((KeyboardStates & DragDropKeyStates.ControlKey) != 0)
            {
                if ((allowedEffects & DragDropEffects.Copy) != 0 && (AcceptedEffects & DragDropEffects.Copy) != 0)
                {
                    return(DragDropEffects.Copy);
                }
            }
            else if ((KeyboardStates & DragDropKeyStates.ShiftKey) != 0)
            {
                if ((allowedEffects & DragDropEffects.Move) != 0 && (AcceptedEffects & DragDropEffects.Move) != 0)
                {
                    return(DragDropEffects.Move);
                }
            }
            else if ((KeyboardStates & DragDropKeyStates.AltKey) != 0)
            {
                if ((allowedEffects & DragDropEffects.Link) != 0 && (AcceptedEffects & DragDropEffects.Link) != 0)
                {
                    return(DragDropEffects.Link);
                }
            }

            return(DragDropEffects.None);
        }
Пример #15
0
        /// <inheritdoc />
        public override DragDropEffect OnDragDrop(ref Vector2 location, DragData data)
        {
            var result = base.OnDragDrop(ref location, data);

            if (result != DragDropEffect.None)
            {
                return(result);
            }

            if (_dragEffect != DragDropEffect.None)
            {
                result      = _dragEffect;
                _dragEffect = DragDropEffect.None;

                _editor.ReorderScript(_script, _index);
            }

            return(result);
        }
Пример #16
0
            /// <summary>
            /// Notifies the handler, that a drag operation has started above the control
            /// </summary>
            /// <param name="effect"></param>
            public void NotifyDragStarted(DragDropEffect effect)
            {
                TabPanel TabPanel = this.element.GetVisualDescendantsDepthFirst <TabPanel>().FirstOrDefault();

                if (TabPanel != null)
                {
                    IDragDropUiTargetHandler Handler = DragDrop.GetDragDropUITargetHandler(TabPanel.GetType());
                    if (Handler != null)
                    {
                        this.panelTargetHandler = Handler.Create(TabPanel, this.adapter, false);
                    }
                }
                if (this.panelTargetHandler == null)
                {
                    this.panelTargetHandler = new DummyUiHandler();
                }

                this.panelTargetHandler.NotifyDragStarted(effect);
            }
            /// <summary>
            /// Notifies the handler, that a drag operation has started above the control
            /// </summary>
            /// <param name="effect"></param>
            public void NotifyDragStarted(DragDropEffect effect)
            {
                ItemsPresenter ItemsPresenter = this.element.GetVisualDescendantsDepthFirst <ItemsPresenter>().FirstOrDefault();

                if (ItemsPresenter != null)
                {
                    Panel ItemsPanel = VisualTreeHelper.GetChild(ItemsPresenter, 0) as Panel;
                    if (ItemsPanel != null)
                    {
                        IDragDropUiTargetHandler Handler = DragDrop.GetDragDropUITargetHandler(ItemsPanel.GetType());
                        if (Handler != null)
                        {
                            this.panelTargetHandler = Handler.Create(ItemsPanel, this.adapter, false);
                        }
                    }
                }
                if (this.panelTargetHandler == null)
                {
                    this.panelTargetHandler = new DummyUiHandler();
                }

                this.panelTargetHandler.NotifyDragStarted(effect);
            }
Пример #18
0
 public bool CanDrop(IDragSource node, DropPosition mode, DragDropEffect effect)
 {
     return node is NodeViewModel && (mode == DropPosition.Add || this.Parent != null);
 }
Пример #19
0
 public void NotifyDropped(DragDropEffect dropEffect)
 {
 }
Пример #20
0
 public abstract void DoDrop(IDataObject data, DragDropEffect effect, AdditionalDropInfo additionalDropInfo);
Пример #21
0
 override bool CanDrop(TreeNodeController source, DragDropEffect effect)
 {
     return(false);
 }
Пример #22
0
 override bool CanDrop(TreeNodeController source, DragDropEffect effect)
 {
     return(!IsReadOnly && !data.IsChildOf(source.data) && effect == DragDropEffect.Move);
 }
Пример #23
0
 public bool CanDrop(IDragSource node, DropPosition mode, DragDropEffect effect)
 {
     return(node is NodeViewModel && (mode == DropPosition.Add || this.Parent != null));
 }
Пример #24
0
 private void HandleDragUpdate(DragDropEffect effect, DragPosition position)
 {
     this.dragTargetHandler.NotifyDragChanged(effect, position);
 }
Пример #25
0
 public void NotifyDragChanged(DragDropEffect effect, DragPosition position)
 {
 }
Пример #26
0
 public void NotifyDragStarted(DragDropEffect effect)
 {
 }
Пример #27
0
 public bool CanDrop(IDragSource node, DropPosition dropPosition, DragDropEffect effect)
 {
     return(true);
 }
Пример #28
0
            public override void DoDrop(IDataObject data, DragDropEffect effect, AdditionalDropInfo additionalDropInfo)
            {
                TItemType Data = this.GetData(data);

                this.doDropAction(Data, effect, additionalDropInfo);
            }
Пример #29
0
        /// <inheritdoc />
        public override void OnDragLeave()
        {
            _dragEffect = DragDropEffect.None;

            base.OnDragLeave();
        }
Пример #30
0
 public void Drop(IEnumerable <IDragSource> items, DropPosition dropPosition, DragDropEffect effect, PropertyTools.DragDropKeyStates initialKeyStates)
 {
 }
 /// <summary>
 /// Notifies the handler of an update of the mouse position on the control
 /// </summary>
 public void NotifyDragChanged(DragDropEffect effect, DragPosition position)
 {
     this.panelTargetHandler.NotifyDragChanged(effect, position);
 }
 // ReSharper disable MemberCanBePrivate.Global
 /// <summary>
 /// Add handling routines for the given <c>ItemType</c>. Allowed effects are given as concrete values.
 /// </summary>
 public DragDropTargetFactory AddTypeHandler <TItemType>(DragDropEffects allowedEffects, DragDropEffect defaultEffect, Action <TItemType, DragDropEffect, AdditionalDropInfo> doDropAction)
 {
     return(this.AddTypeHandler(_ => allowedEffects, _ => defaultEffect, doDropAction));
 }