mirror of https://github.com/buggins/dlangide.git
implement drag&drop files to application window - issue #24
This commit is contained in:
parent
2fe2506eca
commit
f60032cc4a
|
@ -4,7 +4,6 @@ public import dlangui.core.events;
|
||||||
import dlangui.widgets.editors;
|
import dlangui.widgets.editors;
|
||||||
|
|
||||||
enum IDEActions : int {
|
enum IDEActions : int {
|
||||||
None = 0,
|
|
||||||
//ProjectOpen = 1010000,
|
//ProjectOpen = 1010000,
|
||||||
FileNew = 1010000,
|
FileNew = 1010000,
|
||||||
FileNewWorkspace,
|
FileNewWorkspace,
|
||||||
|
@ -43,6 +42,12 @@ enum IDEActions : int {
|
||||||
ProjectFolderRenameItem,
|
ProjectFolderRenameItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__gshared static this() {
|
||||||
|
// register editor action names and ids
|
||||||
|
registerActionEnum!IDEActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Action ACTION_PROJECT_FOLDER_ADD_ITEM = new Action(IDEActions.ProjectFolderAddItem, "MENU_PROJECT_FOLDER_ADD_ITEM"c);
|
const Action ACTION_PROJECT_FOLDER_ADD_ITEM = new Action(IDEActions.ProjectFolderAddItem, "MENU_PROJECT_FOLDER_ADD_ITEM"c);
|
||||||
const Action ACTION_PROJECT_FOLDER_OPEN_ITEM = new Action(IDEActions.ProjectFolderOpenItem, "MENU_PROJECT_FOLDER_OPEN_ITEM"c);
|
const Action ACTION_PROJECT_FOLDER_OPEN_ITEM = new Action(IDEActions.ProjectFolderOpenItem, "MENU_PROJECT_FOLDER_OPEN_ITEM"c);
|
||||||
const Action ACTION_PROJECT_FOLDER_REMOVE_ITEM = new Action(IDEActions.ProjectFolderRemoveItem, "MENU_PROJECT_FOLDER_REMOVE_ITEM"c);
|
const Action ACTION_PROJECT_FOLDER_REMOVE_ITEM = new Action(IDEActions.ProjectFolderRemoveItem, "MENU_PROJECT_FOLDER_REMOVE_ITEM"c);
|
||||||
|
@ -87,3 +92,4 @@ const Action ACTION_HELP_ABOUT = new Action(IDEActions.HelpAbout, "MENU_HELP_ABO
|
||||||
const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowCloseAllDocuments, "MENU_WINDOW_CLOSE_ALL_DOCUMENTS"c);
|
const Action ACTION_WINDOW_CLOSE_ALL_DOCUMENTS = new Action(IDEActions.WindowCloseAllDocuments, "MENU_WINDOW_CLOSE_ALL_DOCUMENTS"c);
|
||||||
const Action ACTION_CREATE_NEW_WORKSPACE = new Action(IDEActions.CreateNewWorkspace, "Create new workspace"d);
|
const Action ACTION_CREATE_NEW_WORKSPACE = new Action(IDEActions.CreateNewWorkspace, "Create new workspace"d);
|
||||||
const Action ACTION_ADD_TO_CURRENT_WORKSPACE = new Action(IDEActions.AddToCurrentWorkspace, "Add to current workspace"d);
|
const Action ACTION_ADD_TO_CURRENT_WORKSPACE = new Action(IDEActions.AddToCurrentWorkspace, "Add to current workspace"d);
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ class IDEFrame : AppFrame {
|
||||||
this(Window window) {
|
this(Window window) {
|
||||||
super();
|
super();
|
||||||
window.mainWidget = this;
|
window.mainWidget = this;
|
||||||
|
window.onFilesDropped = &onFilesDropped;
|
||||||
}
|
}
|
||||||
|
|
||||||
override protected void init() {
|
override protected void init() {
|
||||||
|
@ -615,6 +616,13 @@ class IDEFrame : AppFrame {
|
||||||
Builder op = new Builder(this, currentWorkspace.startupProject, _logPanel, currentWorkspace.buildConfiguration, buildOp, false);
|
Builder op = new Builder(this, currentWorkspace.startupProject, _logPanel, currentWorkspace.buildConfiguration, buildOp, false);
|
||||||
setBackgroundOperation(op);
|
setBackgroundOperation(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onFilesDropped(string[] filenames) {
|
||||||
|
//Log.d("onFilesDropped(", filenames, ")");
|
||||||
|
for (int i = 0; i < filenames.length; i++) {
|
||||||
|
openSourceFile(filenames[i], null, i == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget createAboutWidget()
|
Widget createAboutWidget()
|
||||||
|
|
Loading…
Reference in New Issue