use of com.kotcrab.vis.ui.widget.MenuItem in project talos by rockbite.
the class SceneEditorAddon method buildMenu.
@Override
public void buildMenu(MenuBar menuBar) {
Menu mainMenu = new Menu("Scene Editor");
MenuItem newProject = new MenuItem("New Project");
mainMenu.addItem(newProject);
MenuItem openProject = new MenuItem("Open Project");
mainMenu.addItem(openProject);
mainMenu.addSeparator();
MenuItem projectSettings = new MenuItem("Project Settings");
mainMenu.addItem(projectSettings);
newProject.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().ProjectController().newProject(SE);
}
});
openProject.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
TalosMain.Instance().UIStage().openProjectAction(SE);
}
});
projectSettings.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
if (TalosMain.Instance().ProjectController().getProject() == SE) {
showSettingsDialog();
}
}
});
menuBar.addMenu(mainMenu);
}
use of com.kotcrab.vis.ui.widget.MenuItem in project talos by rockbite.
the class UIStage method createModuleListPopup.
public PopupMenu createModuleListPopup() {
OrthographicCamera cam = (OrthographicCamera) TalosMain.Instance().NodeStage().getStage().getCamera();
Vector2 location = new Vector2(cam.position.x, cam.position.y);
PopupMenu menu = new PopupMenu();
Array<Class> temp = new Array<>();
for (Class registeredModule : ParticleEmitterDescriptor.getRegisteredModules()) {
temp.add(registeredModule);
}
temp.sort(new Comparator<Class>() {
@Override
public int compare(Class o1, Class o2) {
return o1.getSimpleName().compareTo(o2.getSimpleName());
}
});
for (final Class clazz : temp) {
String className = clazz.getSimpleName();
MenuItem menuItem = new MenuItem(className);
menu.addItem(menuItem);
final Vector2 finalLocation = location;
menuItem.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
TalosMain.Instance().NodeStage().moduleBoardWidget.createModule(clazz, finalLocation.x, finalLocation.y);
}
});
}
return menu;
}
use of com.kotcrab.vis.ui.widget.MenuItem in project vis-ui by kotcrab.
the class TestApplication method createTestsMenu.
private MenuItem createTestsMenu() {
MenuItem item = new MenuItem("start test");
PopupMenu menu = new PopupMenu();
menu.addItem(new MenuItem("tabbed pane", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestTabbedPane(false));
}
}));
menu.addItem(new MenuItem("tabbed pane (vertical)", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestTabbedPane(true));
}
}));
menu.addItem(new MenuItem("flow groups", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestFlowGroup());
}
}));
menu.addItem(new MenuItem("button bar", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestButtonBar());
}
}));
menu.addItem(new MenuItem("list view", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestListView());
}
}));
menu.addItem(new MenuItem("toasts", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestToasts(stage));
}
}));
menu.addItem(new MenuItem("highlight textarea", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestHighlightTextArea());
}
}));
menu.addItem(new MenuItem("busybar", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestBusyBar());
}
}));
menu.addItem(new MenuItem("multisplitpane", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestMultiSplitPane());
}
}));
menu.addItem(new MenuItem("generate disabled image", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestGenerateDisabledImage());
}
}));
menu.addSeparator();
menu.addItem(new MenuItem("test issue #131", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestIssue131());
}
}));
menu.addItem(new MenuItem("test issue #326", new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
stage.addActor(new TestIssue326());
}
}));
item.setSubMenu(menu);
return item;
}
use of com.kotcrab.vis.ui.widget.MenuItem in project vis-ui by kotcrab.
the class TestApplication method createDoubleNestedMenu.
private MenuItem createDoubleNestedMenu() {
MenuItem doubleNestedMenuItem = new MenuItem("submenu nested x2");
doubleNestedMenuItem.setSubMenu(createSubMenu());
PopupMenu nestedMenu = new PopupMenu();
nestedMenu.addItem(doubleNestedMenuItem);
nestedMenu.addItem(new MenuItem("single nested"));
MenuItem menuItem = new MenuItem("submenu nested");
menuItem.setSubMenu(nestedMenu);
return menuItem;
}
use of com.kotcrab.vis.ui.widget.MenuItem in project vis-ui by kotcrab.
the class DirsSuggestionPopup method createRecentDirSuggestions.
private int createRecentDirSuggestions(Array<FileHandle> files, float width) {
clearChildren();
int suggestions = 0;
for (final FileHandle file : files) {
if (file.exists() == false)
continue;
MenuItem item = createMenuItem(file.path());
item.getLabel().setEllipsis(true);
item.getLabelCell().width(width - 20);
addItem(item);
item.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
chooser.setDirectory(file, FileChooser.HistoryPolicy.ADD);
}
});
suggestions++;
if (suggestions == MAX_SUGGESTIONS) {
break;
}
}
return suggestions;
}
Aggregations