use of com.kotcrab.vis.ui.widget.MenuItem in project talos by rockbite.
the class ShaderAddon method buildMenu.
@Override
public void buildMenu(MenuBar menuBar) {
Menu menu = new Menu("Shader Graph");
MenuItem newFile = new MenuItem("New Shader");
menu.addItem(newFile);
MenuItem openFile = new MenuItem("Open Shader");
menu.addItem(openFile);
MenuItem exportRaw = new MenuItem("Export RAW");
menu.addItem(exportRaw);
MenuItem exportPNG = new MenuItem("Export PNG");
menu.addItem(exportPNG);
MenuItem exportSequence = new MenuItem("Export Sequence");
menu.addItem(exportSequence);
newFile.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
TalosMain.Instance().ProjectController().newProject(SHADER_PROJECT);
}
});
openFile.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().UIStage().openProjectAction(SHADER_PROJECT);
}
});
exportRaw.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// export RAW logic
TalosMain.Instance().UIStage().showSaveFileChooser(".frag", new FileChooserAdapter() {
@Override
public void selected(Array<FileHandle> files) {
String fragShader = ((ShaderNodeStage) (nodeStage)).getFragShader();
FileHandle file = files.get(0);
file.writeString(fragShader, false);
}
});
}
});
exportPNG.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// export RAW logic
TalosMain.Instance().UIStage().showSaveFileChooser(".png", new FileChooserAdapter() {
@Override
public void selected(Array<FileHandle> files) {
FileHandle file = files.get(0);
Pixmap pixmap = ((ShaderNodeStage) (nodeStage)).exportPixmap();
if (pixmap != null) {
PixmapIO.writePNG(file, pixmap);
pixmap.dispose();
}
}
});
}
});
exportSequence.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().UIStage().getStage().addActor(exportSequenceDialog.fadeIn());
}
});
menuBar.addMenu(menu);
}
use of com.kotcrab.vis.ui.widget.MenuItem in project talos by rockbite.
the class UIStage method initExampleList.
public void initExampleList(PopupMenu examples) {
FileHandle list = Gdx.files.internal("samples/list.xml");
XmlReader xmlReader = new XmlReader();
XmlReader.Element root = xmlReader.parse(list);
Array<XmlReader.Element> samples = root.getChildrenByName("sample");
for (XmlReader.Element sample : samples) {
String name = sample.getAttribute("name");
final String fileName = sample.getAttribute("file");
MenuItem item = new MenuItem(name);
examples.addItem(item);
item.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
// openProject(fileName);
TalosMain.Instance().ProjectController().lastDirTrackingDisable();
TalosMain.Instance().ProjectController().setProject(ProjectController.TLS);
TalosMain.Instance().ProjectController().loadProject(Gdx.files.internal("samples/" + fileName));
TalosMain.Instance().ProjectController().lastDirTrackingEnable();
TalosMain.Instance().ProjectController().unbindFromFile();
}
});
}
}
use of com.kotcrab.vis.ui.widget.MenuItem in project talos by rockbite.
the class BvBAddon method buildMenu.
@Override
public void buildMenu(MenuBar menuBar) {
Menu bvbMenu = new Menu("Animations");
MenuItem newBvbProject = new MenuItem("New Project");
bvbMenu.addItem(newBvbProject);
MenuItem openBvbProject = new MenuItem("Open Project");
bvbMenu.addItem(openBvbProject);
// TODO: add other menu items here
newBvbProject.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().ProjectController().newProject(BVB);
}
});
openBvbProject.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().UIStage().openProjectAction(BVB);
}
});
menuBar.addMenu(bvbMenu);
}
use of com.kotcrab.vis.ui.widget.MenuItem in project vis-ui by kotcrab.
the class TestApplication method createSubMenu.
private PopupMenu createSubMenu() {
PopupMenu menu = new PopupMenu();
menu.addItem(new MenuItem("submenuitem #1"));
menu.addItem(new MenuItem("submenuitem #2"));
menu.addSeparator();
menu.addItem(new MenuItem("submenuitem #3"));
menu.addItem(new MenuItem("submenuitem #4"));
return menu;
}
use of com.kotcrab.vis.ui.widget.MenuItem in project vis-ui by kotcrab.
the class TestApplication method createMenus.
private void createMenus() {
Menu fileMenu = new Menu("File");
Menu editMenu = new Menu("Edit");
Menu windowMenu = new Menu("Window");
Menu helpMenu = new Menu("Help");
fileMenu.addItem(createTestsMenu());
fileMenu.addItem(new MenuItem("menuitem #1"));
fileMenu.addItem(new MenuItem("menuitem #2").setShortcut("f1"));
fileMenu.addItem(new MenuItem("menuitem #3").setShortcut("f2"));
fileMenu.addItem(new MenuItem("menuitem #4").setShortcut("alt + f4"));
MenuItem subMenuItem = new MenuItem("submenu #1");
subMenuItem.setShortcut("alt + insert");
subMenuItem.setSubMenu(createSubMenu());
fileMenu.addItem(subMenuItem);
MenuItem subMenuItem2 = new MenuItem("submenu #2");
subMenuItem2.setSubMenu(createSubMenu());
fileMenu.addItem(subMenuItem2);
MenuItem subMenuItem3 = new MenuItem("submenu disabled");
subMenuItem3.setDisabled(true);
subMenuItem3.setSubMenu(createSubMenu());
fileMenu.addItem(subMenuItem3);
// ---
editMenu.addItem(new MenuItem("menuitem #5"));
editMenu.addItem(new MenuItem("menuitem #6"));
editMenu.addSeparator();
editMenu.addItem(new MenuItem("menuitem #7"));
editMenu.addItem(new MenuItem("menuitem #8"));
editMenu.addItem(createDoubleNestedMenu());
MenuItem disabledItem = new MenuItem("disabled menuitem");
disabledItem.setDisabled(true);
MenuItem disabledItem2 = new MenuItem("disabled menuitem shortcut").setShortcut("alt + f4");
disabledItem2.setDisabled(true);
editMenu.addItem(disabledItem);
editMenu.addItem(disabledItem2);
windowMenu.addItem(new MenuItem("menuitem #9"));
windowMenu.addItem(new MenuItem("menuitem #10"));
windowMenu.addItem(new MenuItem("menuitem #11"));
windowMenu.addSeparator();
windowMenu.addItem(new MenuItem("menuitem #12"));
helpMenu.addItem(new MenuItem("about", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
Dialogs.showOKDialog(stage, "about", "visui test application");
}
}));
menuBar.addMenu(fileMenu);
menuBar.addMenu(editMenu);
menuBar.addMenu(windowMenu);
menuBar.addMenu(helpMenu);
}
Aggregations