コード例 #1
0
ファイル: Timeline.UI.cs プロジェクト: MiheevN/FlaxEngine
            /// <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
ファイル: Timeline.UI.cs プロジェクト: MiheevN/FlaxEngine
            /// <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
ファイル: DragHandlers.cs プロジェクト: MiheevN/FlaxEngine
        /// <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);
            }
コード例 #17
0
            /// <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
ファイル: EntityViewModel.cs プロジェクト: trymnilsen/Aegir
 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
ファイル: EntityViewModel.cs プロジェクト: trymnilsen/Aegir
 public void Drop(IEnumerable <IDragSource> items, DropPosition dropPosition, DragDropEffect effect, PropertyTools.DragDropKeyStates initialKeyStates)
 {
 }
コード例 #31
0
 /// <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);
 }
コード例 #32
0
 // 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));
 }