use of com.kotcrab.vis.ui.widget.PopupMenu 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.PopupMenu in project talos by rockbite.
the class NodeGroup method init.
public void init(Skin skin) {
this.skin = skin;
frameImage = new Image(skin.getDrawable("group_frame"));
frameImage.setColor(44 / 255f, 140 / 255f, 209 / 255f, 1f);
addActor(frameImage);
topHit = new Actor();
topHit.setTouchable(Touchable.enabled);
addActor(topHit);
title = new EditableLabel("GROUP NAME", skin);
addActor(title);
settings = new ImageButton(skin, "settings");
settings.setSize(25, 25);
addActor(settings);
settings.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
final Vector2 vec = new Vector2(Gdx.input.getX(), Gdx.input.getY());
(TalosMain.Instance().UIStage().getStage().getViewport()).unproject(vec);
settingsPopup.showMenu(TalosMain.Instance().UIStage().getStage(), vec.x, vec.y);
}
});
settingsPopup = new PopupMenu();
MenuItem changeColorMenuItem = new MenuItem("Change Color");
MenuItem ungroupMenuItem = new MenuItem("Ungroup");
settingsPopup.addItem(changeColorMenuItem);
settingsPopup.addItem(ungroupMenuItem);
changeColorMenuItem.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
TalosMain.Instance().UIStage().showColorPicker(new ColorPickerAdapter() {
@Override
public void changed(Color newColor) {
super.changed(newColor);
frameImage.setColor(newColor);
}
});
}
});
ungroupMenuItem.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
nodeBoard.removeGroup(NodeGroup.this);
}
});
topHit.addListener(new ClickListener() {
Vector2 tmp = new Vector2();
Vector2 pos = new Vector2();
Vector2 diff = new Vector2();
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
pos.set(x, y);
topHit.localToStageCoordinates(pos);
nodeBoard.setSelectedNodes(nodes);
return true;
}
@Override
public void touchDragged(InputEvent event, float x, float y, int pointer) {
tmp.set(x, y);
topHit.localToStageCoordinates(tmp);
diff.set(tmp).sub(pos);
moveGroupBy(diff.x, diff.y);
pos.set(tmp);
super.touchDragged(event, x, y, pointer);
}
@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
event.cancel();
}
});
setTouchable(Touchable.childrenOnly);
frameImage.setTouchable(Touchable.disabled);
}
use of com.kotcrab.vis.ui.widget.PopupMenu 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.PopupMenu 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.PopupMenu 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;
}
Aggregations