Search in sources :

Example 16 with Spinner

use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.

the class ImageTextButtonListeners method imageTextButtonPaddingListener.

public static EventListener imageTextButtonPaddingListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simImageTextButton = (DialogSceneComposerModel.SimImageTextButton) simActor;
    var popTableClickListener = new PopTableClickListener(skin) {

        {
            getPopTable().key(Keys.ENTER, popTable::hide);
            getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
            getPopTable().key(Keys.ESCAPE, popTable::hide);
        }

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            update();
        }

        public void update() {
            var popTable = getPopTable();
            popTable.clearChildren();
            var changeListener = new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    Spinner padLeft = popTable.findActor("pad-left");
                    Spinner padRight = popTable.findActor("pad-right");
                    Spinner padTop = popTable.findActor("pad-top");
                    Spinner padBottom = popTable.findActor("pad-bottom");
                    events.imageTextButtonPadding((float) padLeft.getValue(), (float) padRight.getValue(), (float) padTop.getValue(), (float) padBottom.getValue());
                }
            };
            var label = new Label("Padding:", skin, "scene-label-colored");
            popTable.add(label).colspan(2);
            popTable.row();
            popTable.defaults().right().spaceRight(5);
            label = new Label("Left:", skin, "scene-label-colored");
            popTable.add(label);
            var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setName("pad-left");
            spinner.setValue(simImageTextButton.padLeft);
            popTable.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding on the left of the contents.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            popTable.row();
            label = new Label("Right:", skin, "scene-label-colored");
            popTable.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setName("pad-right");
            spinner.setValue(simImageTextButton.padRight);
            popTable.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding on the right of the contents.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            popTable.row();
            label = new Label("Top:", skin, "scene-label-colored");
            popTable.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setName("pad-top");
            spinner.setValue(simImageTextButton.padTop);
            popTable.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding on the top of the contents.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            popTable.row();
            label = new Label("Bottom:", skin, "scene-label-colored");
            popTable.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setName("pad-bottom");
            spinner.setValue(simImageTextButton.padBottom);
            popTable.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding on the bottom of the contents.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Spinner(com.ray3k.stripe.Spinner) Actor(com.badlogic.gdx.scenes.scene2d.Actor) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Example 17 with Spinner

use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.

the class ProgressBarListeners method progressBarValueSettingsListener.

public static EventListener progressBarValueSettingsListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simProgressBar = (DialogSceneComposerModel.SimProgressBar) simActor;
    var popTableClickListener = new PopTableClickListener(skin) {

        {
            getPopTable().key(Keys.ESCAPE, popTable::hide);
        }

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            update();
        }

        public void update() {
            var popTable = getPopTable();
            popTable.clearChildren();
            var table = new Table();
            popTable.add(table);
            var label = new Label("Value:", skin, "scene-label-colored");
            table.add(label);
            var valueSpinner = new Spinner(simProgressBar.value, simProgressBar.increment, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            valueSpinner.setMinimum(simProgressBar.minimum);
            valueSpinner.setMaximum(simProgressBar.maximum);
            table.add(valueSpinner).width(100).uniformX();
            valueSpinner.getTextField().addListener(ibeamListener);
            valueSpinner.getButtonMinus().addListener(handListener);
            valueSpinner.getButtonPlus().addListener(handListener);
            valueSpinner.addListener(new TextTooltip("The value of the ProgressBar.", tooltipManager, skin, "scene"));
            valueSpinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    events.progressBarValue((float) valueSpinner.getValue());
                }
            });
            table.row();
            label = new Label("Minimum:", skin, "scene-label-colored");
            table.add(label);
            var minimumSpinner = new Spinner(simProgressBar.minimum, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            minimumSpinner.setMaximum(simProgressBar.maximum);
            var maximumSpinner = new Spinner(simProgressBar.maximum, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            maximumSpinner.setMinimum(simProgressBar.minimum);
            table.add(minimumSpinner).uniformX().fillX();
            minimumSpinner.getTextField().addListener(ibeamListener);
            minimumSpinner.getButtonMinus().addListener(handListener);
            minimumSpinner.getButtonPlus().addListener(handListener);
            minimumSpinner.addListener(new TextTooltip("The minimum value of the ProgressBar.", tooltipManager, skin, "scene"));
            minimumSpinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    events.progressBarMinimum((float) minimumSpinner.getValue());
                    if (valueSpinner.getValue() < minimumSpinner.getValue()) {
                        valueSpinner.setValue(simProgressBar.minimum);
                    }
                    maximumSpinner.setMinimum(simProgressBar.minimum);
                }
            });
            table.row();
            label = new Label("Maximum:", skin, "scene-label-colored");
            table.add(label);
            maximumSpinner.setValue(simProgressBar.maximum);
            table.add(maximumSpinner).uniformX().fillX();
            maximumSpinner.getTextField().addListener(ibeamListener);
            maximumSpinner.getButtonMinus().addListener(handListener);
            maximumSpinner.getButtonPlus().addListener(handListener);
            maximumSpinner.addListener(new TextTooltip("The maximum value of the ProgressBar.", tooltipManager, skin, "scene"));
            maximumSpinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    events.progressBarMaximum((float) maximumSpinner.getValue());
                    if (valueSpinner.getValue() > maximumSpinner.getValue()) {
                        valueSpinner.setValue(simProgressBar.maximum);
                    }
                    minimumSpinner.setMaximum(simProgressBar.maximum);
                }
            });
            table.row();
            label = new Label("Increment:", skin, "scene-label-colored");
            table.add(label);
            var incrementSpinner = new Spinner(0, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            incrementSpinner.setValue(simProgressBar.increment);
            incrementSpinner.setMinimum(.0000000001);
            table.add(incrementSpinner).uniformX().fillX();
            incrementSpinner.getTextField().addListener(ibeamListener);
            incrementSpinner.getButtonMinus().addListener(handListener);
            incrementSpinner.getButtonPlus().addListener(handListener);
            incrementSpinner.addListener(new TextTooltip("The increment value of the ProgressBar.", tooltipManager, skin, "scene"));
            incrementSpinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    events.progressBarIncrement((float) incrementSpinner.getValue());
                }
            });
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) Spinner(com.ray3k.stripe.Spinner) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Actor(com.badlogic.gdx.scenes.scene2d.Actor) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Example 18 with Spinner

use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.

the class DialogDrawables method tiledDrawableSettingsDialog.

private void tiledDrawableSettingsDialog(String title, DrawableData drawable, boolean newDrawable) {
    final Spinner minWidthSpinner = new Spinner(0.0f, 1.0f, true, Spinner.Orientation.HORIZONTAL, getSkin());
    final Spinner minHeightSpinner = new Spinner(0.0f, 1.0f, true, Spinner.Orientation.HORIZONTAL, getSkin());
    TextField textField = new TextField("", getSkin()) {

        @Override
        public void next(boolean up) {
            if (up) {
                getStage().setKeyboardFocus(minHeightSpinner.getTextField());
                minHeightSpinner.getTextField().selectAll();
            } else {
                getStage().setKeyboardFocus(minWidthSpinner.getTextField());
                minWidthSpinner.getTextField().selectAll();
            }
        }
    };
    Dialog tileDialog = new Dialog(title, getSkin(), "bg") {

        @Override
        protected void result(Object object) {
            super.result(object);
            if (object instanceof Boolean && (boolean) object == true) {
                Button button = this.findActor("color-selector");
                tiledDrawableSettings(drawable, (ColorData) button.getUserObject(), (float) minWidthSpinner.getValue(), (float) minHeightSpinner.getValue(), textField.getText());
            }
            getStage().setScrollFocus(scrollPane);
        }

        @Override
        public Dialog show(Stage stage) {
            Dialog dialog = super.show(stage);
            stage.setKeyboardFocus(textField);
            return dialog;
        }
    };
    tileDialog.getTitleTable().padLeft(5.0f);
    tileDialog.getContentTable().padLeft(10.0f).padRight(10.0f).padTop(5.0f);
    tileDialog.getButtonTable().padBottom(15.0f);
    var label = new Label("Please enter a name for the TiledDrawable: ", getSkin());
    label.setName("name-label");
    tileDialog.getContentTable().add(label);
    tileDialog.button("OK", true);
    tileDialog.button("Cancel", false).key(Keys.ESCAPE, false);
    TextButton okButton = (TextButton) tileDialog.getButtonTable().getCells().first().getActor();
    okButton.addListener(handListener);
    tileDialog.getButtonTable().getCells().get(1).getActor().addListener(handListener);
    tileDialog.getContentTable().row();
    var table = new Table();
    table.defaults().space(10.0f);
    tileDialog.getContentTable().add(table);
    textField.setText(drawable.name);
    textField.selectAll();
    table.add(textField).growX().colspan(2);
    table.row();
    label = new Label("Color:", getSkin());
    label.setName("color-label");
    table.add(label).right();
    var subTable = new Table();
    subTable.setBackground(getSkin().getDrawable("dark-gray"));
    table.add(subTable).growX().height(35);
    var button = new Button(getSkin(), "color-selector");
    button.setName("color-selector");
    if (drawable.tintName != null) {
        button.setColor(jsonData.getColorByName(drawable.tintName).color);
    } else {
        label = new Label("none", getSkin());
        button.add(label);
    }
    button.setUserObject(jsonData.getColorByName(drawable.tintName));
    subTable.add(button).grow().pad(3);
    button.addListener(handListener);
    button.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeListener.ChangeEvent ce, Actor actor) {
            DialogColors dialog = new DialogColors(main, (StyleProperty) null, true, (colorData, pressedCancel) -> {
                Button button = tileDialog.findActor("color-selector");
                if (colorData != null) {
                    button.setColor(colorData.color);
                    button.setUserObject(colorData);
                    button.clearChildren();
                } else {
                    if (button.getUserObject() != null) {
                        button.setColor(((ColorData) button.getUserObject()).color);
                    } else {
                        button.setColor(Color.WHITE);
                    }
                }
                okButton.setDisabled(!validateTiledDrawable(tileDialog, textField.getText(), drawable.name, (ColorData) button.getUserObject(), newDrawable));
            });
            dialog.setFillParent(true);
            dialog.show(getStage());
            dialog.refreshTable();
        }
    });
    table.row();
    label = new Label("MinWidth:", getSkin());
    table.add(label).right();
    minWidthSpinner.setValue(drawable.minWidth);
    minWidthSpinner.setMinimum(0.0f);
    table.add(minWidthSpinner).minWidth(150.0f);
    minWidthSpinner.setTransversalPrevious(textField);
    minWidthSpinner.setTransversalNext(minHeightSpinner.getTextField());
    minWidthSpinner.getButtonMinus().addListener(handListener);
    minWidthSpinner.getButtonPlus().addListener(handListener);
    minWidthSpinner.getTextField().addListener(ibeamListener);
    table.row();
    label = new Label("MinHeight:", getSkin());
    table.add(label).right();
    minHeightSpinner.setValue(drawable.minHeight);
    minHeightSpinner.setMinimum(0.0f);
    table.add(minHeightSpinner).minWidth(150.0f);
    minHeightSpinner.setTransversalPrevious(minWidthSpinner.getTextField());
    minHeightSpinner.setTransversalNext(textField);
    minHeightSpinner.getButtonMinus().addListener(handListener);
    minHeightSpinner.getButtonPlus().addListener(handListener);
    minHeightSpinner.getTextField().addListener(ibeamListener);
    okButton.setDisabled(!validateTiledDrawable(tileDialog, textField.getText(), drawable.name, (ColorData) button.getUserObject(), newDrawable));
    textField.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            Button button = tileDialog.findActor("color-selector");
            okButton.setDisabled(!validateTiledDrawable(tileDialog, textField.getText(), drawable.name, (ColorData) button.getUserObject(), newDrawable));
        }
    });
    textField.setTextFieldListener((TextField textField1, char c) -> {
        if (c == '\n') {
            if (!okButton.isDisabled()) {
                Button button1 = tileDialog.findActor("color-selector");
                tiledDrawableSettings(drawable, (ColorData) button1.getUserObject(), (float) minWidthSpinner.getValue(), (float) minHeightSpinner.getValue(), textField1.getText());
                tileDialog.hide();
            }
        }
    });
    textField.addListener(ibeamListener);
    tileDialog.show(getStage());
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) MathUtils(com.badlogic.gdx.math.MathUtils) Array(com.badlogic.gdx.utils.Array) Scaling(com.badlogic.gdx.utils.Scaling) Utils(com.ray3k.skincomposer.utils.Utils) Spinner(com.ray3k.stripe.Spinner) Gdx(com.badlogic.gdx.Gdx) com.ray3k.skincomposer.data(com.ray3k.skincomposer.data) Values(com.badlogic.gdx.utils.ObjectMap.Values) CustomDrawableUndoable(com.ray3k.skincomposer.UndoableManager.CustomDrawableUndoable) Vector2(com.badlogic.gdx.math.Vector2) Locale(java.util.Locale) DrawableUndoable(com.ray3k.skincomposer.UndoableManager.DrawableUndoable) Actions(com.badlogic.gdx.scenes.scene2d.actions.Actions) Input(com.badlogic.gdx.Input) com.badlogic.gdx.scenes.scene2d(com.badlogic.gdx.scenes.scene2d) UndoableManager(com.ray3k.skincomposer.UndoableManager) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Sort(com.badlogic.gdx.utils.Sort) com.badlogic.gdx.scenes.scene2d.ui(com.badlogic.gdx.scenes.scene2d.ui) Iterator(java.util.Iterator) Cursor(com.badlogic.gdx.graphics.Cursor) SystemCursor(com.badlogic.gdx.graphics.Cursor.SystemCursor) FilesDroppedListener(com.ray3k.skincomposer.FilesDroppedListener) Align(com.badlogic.gdx.utils.Align) Color(com.badlogic.gdx.graphics.Color) com.badlogic.gdx.scenes.scene2d.utils(com.badlogic.gdx.scenes.scene2d.utils) Undoable(com.ray3k.skincomposer.Undoable) File(java.io.File) TextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas) List(java.util.List) Keys(com.badlogic.gdx.Input.Keys) Main(com.ray3k.skincomposer.Main) TenPatchData(com.ray3k.skincomposer.dialog.DialogTenPatch.TenPatchData) DrawableType(com.ray3k.skincomposer.data.DrawableData.DrawableType) Spinner(com.ray3k.stripe.Spinner)

Example 19 with Spinner

use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.

the class CellListeners method cellColSpanListener.

public static EventListener cellColSpanListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simCell = (DialogSceneComposerModel.SimCell) simActor;
    var popTableClickListener = new PopTableClickListener(skin) {

        {
            getPopTable().key(Keys.ENTER, popTable::hide);
            getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
            getPopTable().key(Keys.ESCAPE, popTable::hide);
        }

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            update();
        }

        public void update() {
            var popTable = getPopTable();
            popTable.clearChildren();
            var table = new Table();
            popTable.add(table);
            var label = new Label("Column Span:", skin, "scene-label-colored");
            table.add(label).colspan(2);
            table.row();
            var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.colSpan);
            spinner.setMinimum(1);
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The column span of the cell.", tooltipManager, skin, "scene"));
            spinner.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    events.cellColSpan(spinner.getValueAsInt());
                }
            });
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : SimTable(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimTable) Spinner(com.ray3k.stripe.Spinner) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Actor(com.badlogic.gdx.scenes.scene2d.Actor) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Example 20 with Spinner

use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.

the class CellListeners method cellPaddingSpacingListener.

public static EventListener cellPaddingSpacingListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simCell = (DialogSceneComposerModel.SimCell) simActor;
    var popTableClickListener = new PopTableClickListener(skin) {

        {
            getPopTable().key(Keys.ENTER, popTable::hide);
            getPopTable().key(Keys.NUMPAD_ENTER, popTable::hide);
            getPopTable().key(Keys.ESCAPE, popTable::hide);
        }

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            update();
        }

        public void update() {
            var popTable = getPopTable();
            popTable.clearChildren();
            var changeListener = new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    Spinner paddingLeftSpinner = popTable.findActor("padding-left");
                    Spinner paddingRightSpinner = popTable.findActor("padding-right");
                    Spinner paddingTopSpinner = popTable.findActor("padding-top");
                    Spinner paddingBottomSpinner = popTable.findActor("padding-bottom");
                    Spinner spacingLeftSpinner = popTable.findActor("spacing-left");
                    Spinner spacingRightSpinner = popTable.findActor("spacing-right");
                    Spinner spacingTopSpinner = popTable.findActor("spacing-top");
                    Spinner spacingBottomSpinner = popTable.findActor("spacing-bottom");
                    Button paddingLinkButton = popTable.findActor("padding-link");
                    Button spacingLinkButton = popTable.findActor("spacing-link");
                    if (paddingLinkButton.isChecked() && actor instanceof Spinner) {
                        var val = (float) ((Spinner) actor).getValue();
                        paddingLeftSpinner.setValue(val);
                        paddingRightSpinner.setValue(val);
                        paddingTopSpinner.setValue(val);
                        paddingBottomSpinner.setValue(val);
                    }
                    if (spacingLinkButton.isChecked() && actor instanceof Spinner) {
                        var val = (float) ((Spinner) actor).getValue();
                        spacingLeftSpinner.setValue(val);
                        spacingRightSpinner.setValue(val);
                        spacingTopSpinner.setValue(val);
                        spacingBottomSpinner.setValue(val);
                    }
                    var paddingLeft = (float) paddingLeftSpinner.getValue();
                    var paddingRight = (float) paddingRightSpinner.getValue();
                    var paddingTop = (float) paddingTopSpinner.getValue();
                    var paddingBottom = (float) paddingBottomSpinner.getValue();
                    var spacingLeft = (float) spacingLeftSpinner.getValue();
                    var spacingRight = (float) spacingRightSpinner.getValue();
                    var spacingTop = (float) spacingTopSpinner.getValue();
                    var spacingBottom = (float) spacingBottomSpinner.getValue();
                    events.cellPaddingSpacing(paddingLeft, paddingRight, paddingTop, paddingBottom, spacingLeft, spacingRight, spacingTop, spacingBottom);
                }
            };
            var table = new Table();
            popTable.add(table);
            var label = new Label("Padding:", skin, "scene-label-colored");
            table.add(label).colspan(2);
            table.row();
            table.defaults().right().spaceRight(5);
            label = new Label("Left:", skin, "scene-label-colored");
            table.add(label);
            var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.padLeft);
            spinner.setName("padding-left");
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding to the left of the cell. Stacks with other cell padding.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            label = new Label("Right:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.padRight);
            spinner.setName("padding-right");
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding to the right of the cell. Stacks with other cell padding.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            label = new Label("Top:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.padTop);
            spinner.setName("padding-top");
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding to the top of the cell. Stacks with other cell padding.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            label = new Label("Bottom:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.padBottom);
            spinner.setName("padding-bottom");
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The padding to the bottom of the cell. Stacks with other cell padding.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            var button = new Button(skin, "scene-link");
            button.setName("padding-link");
            table.add(button).right().colspan(2);
            button.addListener(Main.handListener);
            button.addListener(changeListener);
            button.addListener(new TextTooltip("Click to modify all padding values at once.", tooltipManager, skin, "scene"));
            var image = new Image(skin, "scene-menu-divider");
            popTable.add(image).space(10).growY();
            table = new Table();
            popTable.add(table);
            label = new Label("Spacing:", skin, "scene-label-colored");
            table.add(label).colspan(2);
            table.row();
            table.defaults().right().spaceRight(5);
            label = new Label("Left:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.spaceLeft);
            spinner.setName("spacing-left");
            spinner.setMinimum(0);
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The spacing to the left of the cell. Does not stack with other cell spacing.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            label = new Label("Right:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.spaceRight);
            spinner.setName("spacing-right");
            spinner.setMinimum(0);
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The spacing to the right of the cell. Does not stack with other cell spacing.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            label = new Label("Top:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.spaceTop);
            spinner.setName("spacing-top");
            spinner.setMinimum(0);
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The spacing to the top of the cell. Does not stack with other cell spacing.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            label = new Label("Bottom:", skin, "scene-label-colored");
            table.add(label);
            spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
            spinner.setValue(simCell.spaceBottom);
            spinner.setName("spacing-bottom");
            spinner.setMinimum(0);
            table.add(spinner);
            spinner.getTextField().addListener(ibeamListener);
            spinner.getButtonMinus().addListener(handListener);
            spinner.getButtonPlus().addListener(handListener);
            spinner.addListener(new TextTooltip("The spacing to the bottom of the cell. Does not stack with other cell spacing.", tooltipManager, skin, "scene"));
            spinner.addListener(changeListener);
            table.row();
            button = new Button(skin, "scene-link");
            button.setName("spacing-link");
            table.add(button).right().colspan(2);
            button.addListener(Main.handListener);
            button.addListener(changeListener);
            button.addListener(new TextTooltip("Click to modify all spacing values at once.", tooltipManager, skin, "scene"));
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : SimTable(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimTable) Spinner(com.ray3k.stripe.Spinner) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) Actor(com.badlogic.gdx.scenes.scene2d.Actor) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Aggregations

Spinner (com.ray3k.stripe.Spinner)43 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)34 Actor (com.badlogic.gdx.scenes.scene2d.Actor)29 PopTableClickListener (com.ray3k.stripe.PopTableClickListener)29 SimActor (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor)28 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)27 StyleSelectorPopTable (com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable)12 Color (com.badlogic.gdx.graphics.Color)11 PopTable (com.ray3k.stripe.PopTable)11 Keys (com.badlogic.gdx.Input.Keys)8 com.badlogic.gdx.scenes.scene2d.ui (com.badlogic.gdx.scenes.scene2d.ui)8 Main (com.ray3k.skincomposer.Main)8 Gdx (com.badlogic.gdx.Gdx)6 File (java.io.File)6 FileHandle (com.badlogic.gdx.files.FileHandle)5 MathUtils (com.badlogic.gdx.math.MathUtils)5 FilesDroppedListener (com.ray3k.skincomposer.FilesDroppedListener)5 Utils (com.ray3k.skincomposer.utils.Utils)5 Input (com.badlogic.gdx.Input)4 Pixmap (com.badlogic.gdx.graphics.Pixmap)4