use of com.talosvfx.talos.editor.widgets.ui.common.SquareButton in project talos by rockbite.
the class AssetSelectWidget method getSubWidget.
@Override
public Actor getSubWidget() {
Table table = new Table();
Skin skin = TalosMain.Instance().getSkin();
final SquareButton button = new SquareButton(skin, skin.getDrawable("ic-file-edit"));
nameLabel = new Label("", skin);
nameLabel.setEllipsis(true);
nameLabel.setAlignment(Align.right);
table.add(nameLabel).growX().maxWidth(130).padRight(2);
table.add(button).right().padRight(-2);
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Vector2 pos = new Vector2(button.getWidth() / 2f, button.getHeight() / 2f);
button.localToStageCoordinates(pos);
AssetListPopup assetListPopup = SceneEditorAddon.get().workspace.getAssetListPopup();
assetListPopup.showPopup(getStage(), pos, filter, new FilteredTree.ItemListener() {
@Override
public void chosen(FilteredTree.Node node) {
String path = (String) node.getObject();
if (Gdx.files.absolute(path).isDirectory())
return;
String relative = AssetImporter.relative(Gdx.files.absolute(path));
updateWidget(relative);
callValueChanged(relative);
assetListPopup.remove();
}
});
}
});
return table;
}
use of com.talosvfx.talos.editor.widgets.ui.common.SquareButton in project talos by rockbite.
the class DynamicItemListWidget method getSubWidget.
@Override
public Actor getSubWidget() {
Table table = new Table();
Skin skin = TalosMain.Instance().getSkin();
Table topBar = new Table();
topBar.setBackground(ColorLibrary.obtainBackground(getSkin(), ColorLibrary.BackgroundColor.DARK_GRAY));
SquareButton newBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-new"));
SquareButton deleteBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-delete"));
topBar.add().expandX();
topBar.add(newBtn).padRight(2);
topBar.add(deleteBtn).padRight(2);
list = new FilteredTree<>(skin, "modern");
list.draggable = true;
list.setItemListener(new FilteredTree.ItemListener() {
@Override
public void onNodeMove(FilteredTree.Node parentToMoveTo, FilteredTree.Node childThatHasMoved, int indexInParent, int indexOfPayloadInPayloadBefore) {
callValueChanged(makeDataArray());
}
@Override
public void delete(Array<FilteredTree.Node> nodes) {
deleteSelection();
}
});
table.add(list).growX();
table.row();
table.add(topBar).growX().padLeft(-10).padRight(-10);
newBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
ItemData newItemData = new ItemData(defaultItemName, defaultItemName);
Selection<FilteredTree.Node<Object>> selection = list.getSelection();
FilteredTree.Node node;
if (selection.size() > 0) {
int index = 0;
Array<FilteredTree.Node<Object>> rootNodes = list.getRootNodes();
for (index = 0; index < rootNodes.size; index++) {
if (rootNodes.get(index) == selection.first()) {
break;
}
}
node = addNode(newItemData, index + 1);
} else {
node = addNode(newItemData);
}
callValueChanged(makeDataArray());
EditableLabel label = (EditableLabel) node.getActor();
label.setEditMode();
}
});
deleteBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
deleteSelection();
}
});
return table;
}
use of com.talosvfx.talos.editor.widgets.ui.common.SquareButton in project talos by rockbite.
the class ButtonPropertyWidget method getSubWidget.
@Override
public Actor getSubWidget() {
Skin skin = TalosMain.Instance().getSkin();
Table table = new Table();
buttonLabel = new Label("Edit", skin);
button = new SquareButton(skin, buttonLabel);
button.getStyle().checked = null;
button.getStyle().checkedOver = null;
button.getStyle().checkedDown = null;
table.add(button).expand().right().growX();
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
if (btnListener != null) {
btnListener.clicked(ButtonPropertyWidget.this);
}
}
});
return table;
}
use of com.talosvfx.talos.editor.widgets.ui.common.SquareButton in project talos by rockbite.
the class TimelineLeft method buildHeader.
private Table buildHeader() {
Skin skin = getSkin();
SquareButton ffBack = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-ff"));
ffBack.flipHorizontal();
playBack = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-play"), true);
playBack.flipHorizontal();
play = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-play"), true);
SquareButton ffForward = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-ff"));
repeatBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-repeat"), true);
newBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-new"));
newBtn.getIconCell().padTop(2).padLeft(1);
SquareButton deleteBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-delete"));
upBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-play"));
upBtn.flipVertical();
downBtn = new SquareButton(skin, skin.getDrawable("timeline-btn-icon-play"));
downBtn.flipVertical();
downBtn.flipHorizontal();
Table header = new Table();
header.setBackground(skin.getDrawable("timeline-top-bar-bg"));
Table topPart = new Table();
Table bottomPart = new Table();
topPart.add(ffBack).padLeft(6).left();
// topPart.add(playBack).padLeft(6).left(); // TODO: add this back when we can support
topPart.add(play).padLeft(6).left();
topPart.add(ffForward).padLeft(6).left();
topPart.add(repeatBtn).padLeft(6).left();
topPart.add().growX().minWidth(20);
topPart.add(upBtn).padRight(6).right();
topPart.add(downBtn).padRight(10).right();
topPart.add(newBtn).right().padRight(6);
topPart.add(deleteBtn).right().padRight(6);
topActionCell = topPart.add().right();
typeLabel = new Label("Items", skin);
typeLabel.setColor(ColorLibrary.FONT_GRAY);
bottomPart.add(typeLabel).padBottom(2).padLeft(5).left().expandX();
header.add(topPart).height(33).padBottom(1).growX().row();
header.add(bottomPart).height(16).growX().row();
/**
* Build header actions
*/
ffBack.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.skipToStart);
}
});
ffForward.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.skipToEnd);
}
});
playBack.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.rewind);
}
});
play.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.play);
}
});
repeatBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.toggleLoop);
}
});
deleteBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.deleteSelection);
}
});
newBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.newItem);
}
});
upBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.up);
}
});
downBtn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
timeline.onActionButtonClicked(TimelineListener.Type.down);
}
});
return header;
}
use of com.talosvfx.talos.editor.widgets.ui.common.SquareButton in project talos by rockbite.
the class SEPropertyPanel method showPanel.
@Override
public void showPanel(IPropertyHolder target, Iterable<IPropertyProvider> propertyProviders) {
super.showPanel(target, propertyProviders);
if (target instanceof GameObject) {
// add part with custom components
container.row();
Table table = new Table();
Label label = new Label("Add Component", TalosMain.Instance().getSkin());
SquareButton button = new SquareButton(TalosMain.Instance().getSkin(), label);
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Popup popup = new Popup();
popup.show(button, (GameObject) target);
}
});
table.add(button).height(30).growX();
container.add(button).pad(10).growX();
}
}
Aggregations