Search in sources :

Example 1 with DeleteStyleUndoable

use of com.ray3k.skincomposer.UndoableManager.DeleteStyleUndoable in project skin-composer by raeleus.

the class DialogFactory method showDeleteStyleDialog.

public void showDeleteStyleDialog(Skin skin, Stage stage) {
    StyleData styleData = main.getRootTable().getSelectedStyle();
    Dialog dialog = new Dialog("Delete Style", skin, "bg") {

        @Override
        protected void result(Object object) {
            if ((Boolean) object) {
                main.getUndoableManager().addUndoable(new DeleteStyleUndoable(styleData, main), true);
            }
        }
    };
    dialog.getTitleLabel().setAlignment(Align.center);
    dialog.getContentTable().defaults().padLeft(10.0f).padRight(10.0f);
    dialog.text("Are you sure you want to delete style " + styleData.name + "?");
    dialog.getContentTable().getCells().first().pad(10.0f);
    dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
    dialog.button("Yes, delete the style", true).button("No", false);
    dialog.getButtonTable().getCells().first().getActor().addListener(main.getHandListener());
    dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
    dialog.key(Input.Keys.ENTER, true).key(Input.Keys.ESCAPE, false);
    dialog.show(stage);
}
Also used : DeleteStyleUndoable(com.ray3k.skincomposer.UndoableManager.DeleteStyleUndoable) Dialog(com.badlogic.gdx.scenes.scene2d.ui.Dialog) StyleData(com.ray3k.skincomposer.data.StyleData)

Aggregations

Dialog (com.badlogic.gdx.scenes.scene2d.ui.Dialog)1 DeleteStyleUndoable (com.ray3k.skincomposer.UndoableManager.DeleteStyleUndoable)1 StyleData (com.ray3k.skincomposer.data.StyleData)1