Merge pull request #171 from ZerXGIT/master

Drag and drop feature for Project Explorer
This commit is contained in:
dexyfex 2022-09-08 10:26:01 +10:00 committed by GitHub
commit 26d5fe1d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,7 @@
//
// ProjectTreeView
//
this.ProjectTreeView.AllowDrop = true;
this.ProjectTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.ProjectTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProjectTreeView.FullRowSelect = true;
@ -47,6 +48,8 @@
this.ProjectTreeView.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.ProjectTreeView_BeforeCollapse);
this.ProjectTreeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.ProjectTreeView_BeforeExpand);
this.ProjectTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ProjectTreeView_AfterSelect);
this.ProjectTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.ProjectTreeView_DragDrop);
this.ProjectTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.ProjectTreeView_DragEnter);
this.ProjectTreeView.DoubleClick += new System.EventHandler(this.ProjectTreeView_DoubleClick);
this.ProjectTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ProjectTreeView_MouseDown);
//

View File

@ -2708,6 +2708,20 @@ namespace CodeWalker.Project.Panels
{
inDoubleClick = (e.Clicks > 1); //disabling doubleclick expand/collapse
}
private void ProjectTreeView_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetData(DataFormats.FileDrop) != null) //disabling drag and drop text
e.Effect = DragDropEffects.All;
}
private void ProjectTreeView_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
ProjectForm.OpenFiles(files);
}
}
public delegate void ProjectExplorerItemSelectHandler(object item);
public delegate void ProjectExplorerItemActivateHandler(object item);