mirror of https://github.com/buggins/dlangide.git
toolbars and actions
This commit is contained in:
parent
f8b20e7b99
commit
33f6c146e0
|
@ -1,5 +1,6 @@
|
|||
EXIT=Exit
|
||||
MENU_FILE=&FILE
|
||||
MENU_FILE_NEW=&New
|
||||
MENU_FILE_OPEN=&Open
|
||||
MENU_FILE_OPEN_RECENT=Open recent
|
||||
MENU_FILE_SAVE=&Save
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 247 B |
Binary file not shown.
After Width: | Height: | Size: 246 B |
Binary file not shown.
After Width: | Height: | Size: 245 B |
Binary file not shown.
After Width: | Height: | Size: 224 B |
|
@ -101,6 +101,7 @@
|
|||
<state state_pressed="true" backgroundColor="#C0404080"/>
|
||||
<state state_hovered="true" backgroundColor="#F0404080"/>
|
||||
</style>
|
||||
|
||||
<style id="TAB_UP"
|
||||
backgroundImageId="tab_up_background"
|
||||
layoutWidth="FILL_PARENT"
|
||||
|
@ -125,9 +126,9 @@
|
|||
backgroundColor="#F0F0F0"
|
||||
/>
|
||||
<style id="TAB_WIDGET"
|
||||
padding="3,3,3,3"
|
||||
backgroundColor="#EEEEEE"
|
||||
/>
|
||||
|
||||
<style id="MAIN_MENU"
|
||||
layoutWidth="FILL_PARENT"
|
||||
backgroundColor="#EFEFF2"
|
||||
|
@ -275,9 +276,10 @@
|
|||
margins="2,2,2,2"
|
||||
/>
|
||||
<style id="TOOLBAR_BUTTON"
|
||||
backgroundImageId="btn_background_transparent"
|
||||
backgroundImageId="toolbar_button_background"
|
||||
align="Center"
|
||||
margins="2,2,2,2"
|
||||
margins="1,1,1,1"
|
||||
padding="4,4,4,4"
|
||||
/>
|
||||
<style id="TOOLBAR_SEPARATOR"
|
||||
align="Center"
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item
|
||||
android:drawable="toolbar_button_hover"
|
||||
android:state_enabled="false"
|
||||
android:state_focused="true" />
|
||||
<item
|
||||
android:drawable="toolbar_button_hover"
|
||||
android:state_hovered="true"
|
||||
android:state_focused="true" />
|
||||
<item
|
||||
android:drawable="toolbar_button_hover"
|
||||
android:state_focused="true"
|
||||
/>
|
||||
<item
|
||||
android:drawable="toolbar_button_pressed"
|
||||
android:state_pressed="true" />
|
||||
<item
|
||||
android:drawable="toolbar_button_hover"
|
||||
android:state_hovered="true" />
|
||||
<item
|
||||
android:drawable="@null" />
|
||||
</selector>
|
|
@ -41,7 +41,6 @@ extern (C) int UIAppMain(string[] args) {
|
|||
IDEFrame frame = new IDEFrame(window);
|
||||
|
||||
// create some widget to show in window
|
||||
window.mainWidget = frame;
|
||||
window.windowIcon = drawableCache.getImage("dlangui-logo1");
|
||||
|
||||
frame.loadWorkspace(appendPath(exePath, "../workspaces/sample1/sample1.dlangidews"));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module dlangide.ui.commands;
|
||||
|
||||
import dlangui.core.events;
|
||||
import dlangui.widgets.editors;
|
||||
|
||||
enum : int {
|
||||
ACTION_HELP_ABOUT = 5500,
|
||||
|
@ -14,18 +15,14 @@ enum IDEActions : int {
|
|||
FileSave,
|
||||
FileClose,
|
||||
FileExit,
|
||||
EditCopy = 1011000,
|
||||
EditPaste,
|
||||
EditCut,
|
||||
EditUndo,
|
||||
EditRedo,
|
||||
}
|
||||
|
||||
__gshared Action ACTION_FILE_OPEN;
|
||||
__gshared Action ACTION_FILE_SAVE;
|
||||
__gshared Action ACTION_FILE_EXIT;
|
||||
__gshared static this() {
|
||||
ACTION_FILE_OPEN = new Action(IDEActions.FileOpen, "MENU_FILE_OPEN"c, "document-open", KeyCode.KEY_O, KeyFlag.Control);
|
||||
ACTION_FILE_SAVE = new Action(IDEActions.FileSave, "MENU_FILE_SAVE"c, "document-save", KeyCode.KEY_S, KeyFlag.Control);
|
||||
ACTION_FILE_EXIT = new Action(IDEActions.FileExit, "MENU_FILE_EXIT"c, "document-close"c, KeyCode.KEY_X, KeyFlag.Alt);
|
||||
}
|
||||
__gshared Action ACTION_FILE_NEW = new Action(IDEActions.FileOpen, "MENU_FILE_NEW"c, "document-new", KeyCode.KEY_N, KeyFlag.Control);
|
||||
__gshared Action ACTION_FILE_OPEN = new Action(IDEActions.FileOpen, "MENU_FILE_OPEN"c, "document-open", KeyCode.KEY_O, KeyFlag.Control);
|
||||
__gshared Action ACTION_FILE_SAVE = new Action(IDEActions.FileSave, "MENU_FILE_SAVE"c, "document-save", KeyCode.KEY_S, KeyFlag.Control);
|
||||
__gshared Action ACTION_FILE_EXIT = new Action(IDEActions.FileExit, "MENU_FILE_EXIT"c, "document-close"c, KeyCode.KEY_X, KeyFlag.Alt);
|
||||
__gshared Action ACTION_EDIT_COPY = new Action(EditorActions.Copy, "Copy"d, "edit-copy"c, KeyCode.KEY_C, KeyFlag.Control);
|
||||
__gshared Action ACTION_EDIT_PASTE = new Action(EditorActions.Copy, "Paste"d, "edit-paste"c, KeyCode.KEY_V, KeyFlag.Control);
|
||||
__gshared Action ACTION_EDIT_CUT = new Action(EditorActions.Copy, "Cut"d, "edit-cut"c, KeyCode.KEY_X, KeyFlag.Control);
|
||||
__gshared Action ACTION_EDIT_UNDO = new Action(EditorActions.Undo, "Undo"d, "edit-undo"c, KeyCode.KEY_Z, KeyFlag.Control);
|
||||
__gshared Action ACTION_EDIT_REDO = new Action(EditorActions.Redo, "Redo"d, "edit-redo"c, KeyCode.KEY_Z, KeyFlag.Control|KeyFlag.Shift);
|
||||
|
|
|
@ -27,6 +27,7 @@ class IDEFrame : AppFrame {
|
|||
|
||||
this(Window window) {
|
||||
super();
|
||||
window.mainWidget = this;
|
||||
}
|
||||
|
||||
override protected void init() {
|
||||
|
@ -46,16 +47,20 @@ class IDEFrame : AppFrame {
|
|||
tabs.styleId = STYLE_DOCK_HOST_BODY;
|
||||
|
||||
// create Editors test tab
|
||||
VerticalLayout editors = new VerticalLayout("editors");
|
||||
editors.layoutWidth = FILL_PARENT;
|
||||
editors.layoutHeight = FILL_PARENT;
|
||||
//VerticalLayout editors = new VerticalLayout("editors");
|
||||
//editors.layoutWidth = FILL_PARENT;
|
||||
//editors.layoutHeight = FILL_PARENT;
|
||||
EditBox editBox = new EditBox("editbox1", "Some text\nSecond line\nYet another line\n\n\tforeach(s;lines);\n\t\twriteln(s);\n"d);
|
||||
editBox.enabled = true;
|
||||
editBox.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
|
||||
editBox.minFontSize(12).maxFontSize(75); // allow font zoom with Ctrl + MouseWheel
|
||||
editors.addChild(editBox);
|
||||
editBox.fontFamily = FontFamily.MonoSpace;
|
||||
editBox.focusable = true;
|
||||
//editors.addChild(editBox);
|
||||
//editBox.popupMenu = editPopupItem;
|
||||
tabs.addTab(editors, "Sample"d);
|
||||
tabs.selectTab("editors");
|
||||
tabs.addTab(editBox, "Sample"d);
|
||||
//tabs.addTab(editors, "Sample"d);
|
||||
tabs.selectTab("editbox1");
|
||||
|
||||
|
||||
_dockHost.bodyWidget = tabs;
|
||||
|
@ -73,15 +78,11 @@ class IDEFrame : AppFrame {
|
|||
|
||||
mainMenuItems = new MenuItem();
|
||||
MenuItem fileItem = new MenuItem(new Action(1, "MENU_FILE"));
|
||||
fileItem.add(ACTION_FILE_OPEN);
|
||||
fileItem.add(ACTION_FILE_SAVE);
|
||||
fileItem.add(ACTION_FILE_EXIT);
|
||||
fileItem.add(ACTION_FILE_NEW, ACTION_FILE_OPEN, ACTION_FILE_SAVE, ACTION_FILE_EXIT);
|
||||
|
||||
MenuItem editItem = new MenuItem(new Action(2, "MENU_EDIT"));
|
||||
editItem.add(new Action(EditorActions.Copy, "MENU_EDIT_COPY"c, "edit-copy", KeyCode.KEY_C, KeyFlag.Control));
|
||||
editItem.add(new Action(EditorActions.Paste, "MENU_EDIT_PASTE"c, "edit-paste", KeyCode.KEY_V, KeyFlag.Control));
|
||||
editItem.add(new Action(EditorActions.Cut, "MENU_EDIT_CUT"c, "edit-cut", KeyCode.KEY_X, KeyFlag.Control));
|
||||
editItem.add(new Action(EditorActions.Undo, "MENU_EDIT_UNDO"c, "edit-undo", KeyCode.KEY_Z, KeyFlag.Control));
|
||||
editItem.add(new Action(EditorActions.Redo, "MENU_EDIT_REDO"c, "edit-redo", KeyCode.KEY_Y, KeyFlag.Control));
|
||||
editItem.add(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_EDIT_UNDO, ACTION_EDIT_REDO);
|
||||
|
||||
editItem.add(new Action(20, "MENU_EDIT_PREFERENCES"));
|
||||
MenuItem windowItem = new MenuItem(new Action(3, "MENU_WINDOW"c));
|
||||
windowItem.add(new Action(30, "MENU_WINDOW_PREFERENCES"));
|
||||
|
@ -111,7 +112,8 @@ class IDEFrame : AppFrame {
|
|||
ToolBarHost res = new ToolBarHost();
|
||||
ToolBar tb;
|
||||
tb = res.getOrAddToolbar("Standard");
|
||||
tb.addButtons(ACTION_FILE_OPEN, ACTION_FILE_SAVE, ACTION_SEPARATOR, ACTION_FILE_EXIT);
|
||||
tb.addButtons(ACTION_FILE_OPEN, ACTION_FILE_SAVE, ACTION_SEPARATOR,
|
||||
ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue