Refactor additional component UI
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 6.3 KiB |
@@ -447,6 +447,9 @@
|
||||
up: button-panel-bg,
|
||||
imageUp: icon-close-white
|
||||
},
|
||||
close-properties: {
|
||||
imageUp: icon-close-white
|
||||
},
|
||||
trash-button: {
|
||||
imageDown: icon-trash-disabled,
|
||||
imageOver: icon-trash-over,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 143 KiB |
@@ -221,4 +221,10 @@ public class StandardWidgetsFactory {
|
||||
button.addListener(new CursorListener(CursorManager.FINGER));
|
||||
return button;
|
||||
}
|
||||
|
||||
public static VisImageButton createImageButton(String style) {
|
||||
VisImageButton button = new VisImageButton(style);
|
||||
button.addListener(new CursorListener(CursorManager.FINGER));
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class UILayerBoxMediator extends PanelMediator<UILayerBox> {
|
||||
if(deletingLayerIndex != -1) {
|
||||
String layerName = layers.get(deletingLayerIndex).layerName;
|
||||
Dialogs.showConfirmDialog(sandbox.getUIStage(),
|
||||
"Delete Layer", "Do you realy want to delete '" + layerName + "' layer?",
|
||||
"Delete Layer", "Do you really want to delete '" + layerName + "' layer?",
|
||||
new String[]{"Cancel", "Delete"}, new Integer[]{0, 1}, r -> {
|
||||
if (r == 1) {
|
||||
facade.sendNotification(MsgAPI.ACTION_DELETE_LAYER, layerName);
|
||||
|
||||
+2
-2
@@ -49,8 +49,8 @@ public abstract class UIItemCollapsibleProperties extends UIItemProperties {
|
||||
header = new VisTable();
|
||||
header.setBackground(VisUI.getSkin().getDrawable("expandable-properties-active-bg"));
|
||||
header.add(StandardWidgetsFactory.createLabel(title)).right().expandX().padRight(6);
|
||||
VisImageButton button = new VisImageButton("expandable-properties-button");
|
||||
header.add(button).padRight(3);
|
||||
VisImageButton button = StandardWidgetsFactory.createImageButton("expandable-properties-button");
|
||||
header.add(button).padRight(8);
|
||||
header.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.kotcrab.vis.ui.VisUI;
|
||||
import com.kotcrab.vis.ui.util.dialog.Dialogs;
|
||||
import com.kotcrab.vis.ui.widget.VisImageButton;
|
||||
import com.kotcrab.vis.ui.widget.VisTable;
|
||||
import games.rednblack.editor.utils.StandardWidgetsFactory;
|
||||
import games.rednblack.editor.view.stage.Sandbox;
|
||||
import games.rednblack.h2d.common.MsgAPI;
|
||||
|
||||
/**
|
||||
* Created by CyberJoe on 7/2/2015.
|
||||
@@ -21,11 +24,11 @@ public abstract class UIRemovableProperties extends UIItemCollapsibleProperties
|
||||
public Table crateHeaderTable() {
|
||||
VisTable header = new VisTable();
|
||||
header.setBackground(VisUI.getSkin().getDrawable("expandable-properties-active-bg"));
|
||||
VisImageButton collapseButton = new VisImageButton("expandable-properties-button");
|
||||
VisImageButton closeButton = new VisImageButton("close-panel");
|
||||
VisImageButton collapseButton = StandardWidgetsFactory.createImageButton("expandable-properties-button");
|
||||
VisImageButton closeButton = StandardWidgetsFactory.createImageButton("close-properties");
|
||||
header.add(closeButton).left().padLeft(2);
|
||||
header.add(StandardWidgetsFactory.createLabel(title)).left().expandX().padLeft(6);
|
||||
header.add(collapseButton).right().padRight(3);
|
||||
header.add(collapseButton).right().padRight(8);
|
||||
header.addListener(new ClickListener() {
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
@@ -38,8 +41,14 @@ public abstract class UIRemovableProperties extends UIItemCollapsibleProperties
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y) {
|
||||
super.clicked(event, x, y);
|
||||
onRemove();
|
||||
remove();
|
||||
Dialogs.showConfirmDialog(Sandbox.getInstance().getUIStage(),
|
||||
"Delete Component", "Do you want to delete this component?",
|
||||
new String[]{"Cancel", "Delete"}, new Integer[]{0, 1}, r -> {
|
||||
if (r == 1) {
|
||||
onRemove();
|
||||
remove();
|
||||
}
|
||||
}).padBottom(20).pack();
|
||||
}
|
||||
});
|
||||
return header;
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class UIPhysicsProperties extends UIRemovableProperties {
|
||||
public static final String prefix = "games.rednblack.editor.view.ui.properties.panels.UIPhysicsProperties";
|
||||
public static final String CLOSE_CLICKED = prefix + ".CLOSE_CLICKED";
|
||||
|
||||
private HashMap<Integer, String> bodyTypes = new HashMap<>();
|
||||
private final HashMap<Integer, String> bodyTypes = new HashMap<>();
|
||||
|
||||
private VisSelectBox<String> bodyTypeBox;
|
||||
private VisValidatableTextField massField;
|
||||
|
||||
Reference in New Issue
Block a user