Beispiel #1
0
        /// <summary>
        /// Called on drag and drop event
        /// </summary>
        /// <param name="e">Event args</param>
        protected virtual void OnDragDrop(DragEventArgs e)
        {
            IInstancingContext   instancingContext = m_rootAssetFolder.As <IInstancingContext>();
            IEnumerable <object> converted         = ApplicationUtil.Convert(e.Data, instancingContext, m_dataObjectConverters);

            ApplicationUtil.Drop(converted, instancingContext, m_statusService);
        }
Beispiel #2
0
        /// <summary>
        /// Called when the underlying tree control raises the DragOver event</summary>
        /// <param name="e">Event args from the tree control's DragOver event</param>
        protected virtual void OnDragOver(DragEventArgs e)
        {
            bool canInsert = false;

            if (TreeControl.DragBetween)
            {
                TreeControl.Node parent, before;
                Point            clientPoint = TreeControl.PointToClient(new Point(e.X, e.Y));
                if (TreeControl.GetInsertionNodes(clientPoint, out parent, out before))
                {
                    canInsert = ApplicationUtil.CanInsertBetween(
                        m_treeControlAdapter.TreeView,
                        parent != null ? parent.Tag : null,
                        before != null ? before.Tag : null,
                        e.Data);
                }
            }
            else
            {
                canInsert = ApplicationUtil.CanInsert(
                    m_treeControlAdapter.TreeView,
                    m_treeControlAdapter.LastHit,
                    e.Data);
            }



            e.Effect = canInsert ? DragDropEffects.Move : DragDropEffects.None;

            // A refresh is required to display the drag-between cue.
            if (TreeControl.ShowDragBetweenCue)
            {
                TreeControl.Invalidate();
            }
        }
Beispiel #3
0
        private void thumbnailControl_DragDrop(object sender, DragEventArgs e)
        {
            m_lastHit = m_currentAssetFolder;
            IInstancingContext   instancingContext = m_rootAssetFolder.As <IInstancingContext>();
            IEnumerable <object> converted         = ApplicationUtil.Convert(e.Data, instancingContext, m_dataObjectConverters);

            ApplicationUtil.Drop(converted, instancingContext, m_statusService);
        }
Beispiel #4
0
 /// <summary>
 /// Called when the underlying ListView raises the DragDrop event</summary>
 /// <param name="e">Event args from the ListView's DragDrop event</param>
 protected virtual void OnDragDrop(DragEventArgs e)
 {
     ApplicationUtil.Insert(
         m_listViewAdapter.ListView,
         null,
         e.Data,
         "Drag and Drop".Localize(),
         m_statusService);
 }
Beispiel #5
0
 /// <summary>
 /// Called on mouse up event
 /// </summary>
 /// <param name="e">Event args</param>
 protected virtual void OnMouseUp(MouseEventArgs e) // for tree control on the left pane
 {
     if (e.Button == MouseButtons.Right)
     {
         List <object> commands    = ApplicationUtil.GetPopupCommandTags(m_lastHit, m_contextMenuCommandProviders);
         Point         screenPoint = m_treeControl.PointToScreen(new Point(e.X, e.Y));
         m_commandService.RunContextMenu(commands, screenPoint);
     }
 }
Beispiel #6
0
 /// <summary>
 /// Called when the underlying ListView raises the DragOver event</summary>
 /// <param name="e">Event args from the ListView's DragOver event</param>
 protected virtual void OnDragOver(DragEventArgs e)
 {
     if (ApplicationUtil.CanInsert(m_listViewAdapter.ListView, null, e.Data))
     {
         e.Effect = DragDropEffects.Move;
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
 }
Beispiel #7
0
        /// <summary>
        /// Called on dragging mouse over event
        /// </summary>
        /// <param name="e">Event args</param>
        protected virtual void OnDragOver(DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;
            IInstancingContext instancingContext = m_rootAssetFolder.As <IInstancingContext>();
            IEnumerable        converted         = ApplicationUtil.Convert(e.Data, instancingContext, m_dataObjectConverters);

            if (converted != null)
            {
                e.Effect = DragDropEffects.Move;
            }
        }
Beispiel #8
0
        private void thumbnailControl_DragOver(object sender, DragEventArgs e)
        {
            e.Effect  = DragDropEffects.None;
            m_lastHit = m_currentAssetFolder;
            IInstancingContext instancingContext = m_rootAssetFolder.As <IInstancingContext>();
            IEnumerable        converted         = ApplicationUtil.Convert(e.Data, instancingContext, m_dataObjectConverters);

            if (converted != null)
            {
                e.Effect = DragDropEffects.Move;
            }
        }
        /// <summary>
        /// Method triggered when DragOver event is fired on the TreeListView</summary>
        /// <param name="e">Drag-and-drop event arguments</param>
        protected virtual void OnDragOver(DragEventArgs e)
        {
            bool canInsert = false;

            try
            {
                canInsert = ApplicationUtil.CanInsert(View, LastHit, e.Data);
            }
            finally
            {
                e.Effect = canInsert ? DragDropEffects.Move : DragDropEffects.None;
            }
        }
Beispiel #10
0
        private void thumbnailControl_MouseUp(object sender, MouseEventArgs e)
        {
            IResource asset = null;

            if (e.Button == MouseButtons.Right)
            {
                Point screenPoint;
                Point clientPoint = new Point(e.X, e.Y);
                if (m_thumbnailControl.Visible)
                {
                    asset       = SelectedAsset(m_thumbnailControl, clientPoint);
                    screenPoint = m_thumbnailControl.PointToScreen(clientPoint);
                }
                else
                {
                    asset       = SelectedAsset(m_listView, clientPoint);
                    screenPoint = m_listView.PointToScreen(clientPoint);
                }

                if (asset != null)
                {
                    IResource assetObj = asset as IResource;
                    if (assetObj != null)
                    {
                        List <object> commands = ApplicationUtil.GetPopupCommandTags(assetObj, m_contextMenuCommandProviders);
                        commands.Add(Command.ReloadAsset);
                        commands.Add(Command.UnloadAssets);
                        commands.Add(Command.DetailsView);
                        commands.Add(Command.ThumbnailView);
                        commands.Add(Command.AddExistingAsset);

                        m_commandService.RunContextMenu(commands, screenPoint);
                    }
                }
                else
                {
                    List <object> commands = new List <object>();
                    commands.Add(Command.ReloadAsset);
                    commands.Add(Command.UnloadAssets);
                    commands.Add(Command.DetailsView);
                    commands.Add(Command.ThumbnailView);
                    commands.Add(Command.AddExistingAsset);

                    m_commandService.RunContextMenu(commands, screenPoint);
                }
            }

            m_dragging = false;
        }
Beispiel #11
0
        /// <summary>
        /// Called when the underlying tree control raises the DragDrop event</summary>
        /// <param name="e">Event args from the tree control's DragDrop event</param>
        protected virtual void OnDragDrop(DragEventArgs e)
        {
            ApplicationUtil.Insert(
                m_treeControlAdapter.TreeView,
                m_treeControlAdapter.LastHit,
                e.Data,
                "Drag and Drop",
                m_statusService);

            if (!TreeControl.ShowDragBetweenCue)
            {
                return;
            }

            TreeControl.ShowDragBetweenCue = false;
            TreeControl.Invalidate();
        }
Beispiel #12
0
        /// <summary>
        /// Called when the underlying tree control raises the DragOver event</summary>
        /// <param name="e">Event args from the tree control's DragOver event</param>
        protected virtual void OnDragOver(DragEventArgs e)
        {
            bool showDragBetweenCue = TreeControl.ShowDragBetweenCue;

            TreeControl.ShowDragBetweenCue = false;

            bool canInsert = ApplicationUtil.CanInsert(
                m_treeControlAdapter.TreeView,
                m_treeControlAdapter.LastHit,
                e.Data);

            e.Effect = canInsert ? DragDropEffects.Move : DragDropEffects.None;

            if (showDragBetweenCue != TreeControl.ShowDragBetweenCue)
            {
                TreeControl.Refresh();
            }
        }
Beispiel #13
0
        /// <summary>
        /// Called when the underlying tree control raises the DragDrop event</summary>
        /// <param name="e">Event args from the tree control's DragDrop event</param>
        protected virtual void OnDragDrop(DragEventArgs e)
        {
            if (TreeControl.DragBetween)
            {
                TreeControl.Node parent, before;
                Point            clientPoint = TreeControl.PointToClient(new Point(e.X, e.Y));
                if (TreeControl.GetInsertionNodes(clientPoint, out parent, out before))
                {
                    ApplicationUtil.InsertBetween(
                        m_treeControlAdapter.TreeView,
                        parent != null ? parent.Tag : null,
                        before != null ? before.Tag : null,
                        e.Data,
                        "Drag and Drop",
                        m_statusService);
                }
            }
            else
            {
                ApplicationUtil.Insert(
                    m_treeControlAdapter.TreeView,
                    m_treeControlAdapter.LastHit,
                    e.Data,
                    "Drag and Drop",
                    m_statusService);
            }


            if (!TreeControl.ShowDragBetweenCue)
            {
                return;
            }


            TreeControl.Invalidate();
        }
 /// <summary>
 /// Method triggered when DragDrop event is fired on the TreeListView</summary>
 /// <param name="e">Drag-and-drop event arguments</param>
 protected virtual void OnDragDrop(DragEventArgs e)
 {
     ApplicationUtil.Insert(View, LastHit, e.Data, "Drag and drop", StatusService);
 }