Search in sources :

Example 41 with SimActor

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.

the class CheckBoxListeners method checkBoxPaddingListener.

public static EventListener checkBoxPaddingListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simCheckBox = (DialogSceneComposerModel.SimCheckBox) 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 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.checkBoxPadding((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(simCheckBox.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(simCheckBox.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(simCheckBox.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(simCheckBox.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 42 with SimActor

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.

the class ButtonListeners method buttonCheckedListener.

public static EventListener buttonCheckedListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simButton = (DialogSceneComposerModel.SimButton) 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 label = new Label("Checked:", skin, "scene-label-colored");
            popTable.add(label);
            popTable.row();
            var textButton = new TextButton(simButton.checked ? "TRUE" : "FALSE", skin, "scene-small");
            textButton.setChecked(simButton.checked);
            popTable.add(textButton).minWidth(100);
            textButton.addListener(handListener);
            textButton.addListener(new TextTooltip("Whether the button is checked initially.", tooltipManager, skin, "scene"));
            textButton.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
                    events.buttonChecked(textButton.isChecked());
                }
            });
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : 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 43 with SimActor

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.

the class ButtonListeners method buttonColorListener.

public static EventListener buttonColorListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simButton = (DialogSceneComposerModel.SimButton) 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 label = new Label("Color:", skin, "scene-label-colored");
            popTable.add(label);
            popTable.row();
            var imageButton = new ImageButton(skin, "scene-color");
            imageButton.getImage().setColor(simButton.color == null ? Color.WHITE : simButton.color.color);
            popTable.add(imageButton).minWidth(100);
            imageButton.addListener(handListener);
            imageButton.addListener(new TextTooltip("Select the color of the button.", tooltipManager, skin, "scene"));
            imageButton.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    popTable.hide();
                    dialogFactory.showDialogColors(new StyleProperty(), (colorData, pressedCancel) -> {
                        if (!pressedCancel) {
                            events.buttonColor(colorData);
                        }
                    }, new DialogListener() {

                        @Override
                        public void opened() {
                        }

                        @Override
                        public void closed() {
                        }
                    });
                }
            });
            popTable.row();
            label = new Label(simButton.color == null ? "white" : simButton.color.getName(), skin, "scene-label-colored");
            popTable.add(label);
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) com.badlogic.gdx.scenes.scene2d.ui(com.badlogic.gdx.scenes.scene2d.ui) DialogSceneComposer(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) DialogListener(com.ray3k.skincomposer.dialog.DialogListener) TEXT_FIELD_WIDTH(com.ray3k.skincomposer.dialog.scenecomposer.menulisteners.ListenersUtils.TEXT_FIELD_WIDTH) Spinner(com.ray3k.stripe.Spinner) Color(com.badlogic.gdx.graphics.Color) Actor(com.badlogic.gdx.scenes.scene2d.Actor) DialogSceneComposerEvents(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerEvents) DialogSceneComposerModel(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) Keys(com.badlogic.gdx.Input.Keys) Main(com.ray3k.skincomposer.Main) Input(com.badlogic.gdx.Input) StyleData(com.ray3k.skincomposer.data.StyleData) StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) EventListener(com.badlogic.gdx.scenes.scene2d.EventListener) StyleProperty(com.ray3k.skincomposer.data.StyleProperty) StyleProperty(com.ray3k.skincomposer.data.StyleProperty) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) DialogListener(com.ray3k.skincomposer.dialog.DialogListener) 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 44 with SimActor

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.

the class CheckBoxListeners method checkBoxCheckedListener.

public static EventListener checkBoxCheckedListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simCheckBox = (DialogSceneComposerModel.SimCheckBox) 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 label = new Label("Checked:", skin, "scene-label-colored");
            popTable.add(label);
            popTable.row();
            var textButton = new TextButton(simCheckBox.checked ? "TRUE" : "FALSE", skin, "scene-small");
            textButton.setChecked(simCheckBox.checked);
            popTable.add(textButton).minWidth(100);
            textButton.addListener(handListener);
            textButton.addListener(new TextTooltip("Whether the CheckBox is checked initially.", tooltipManager, skin, "scene"));
            textButton.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
                    events.checkBoxChecked(textButton.isChecked());
                }
            });
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : 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 45 with SimActor

use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.

the class CheckBoxListeners method checkBoxColorListener.

public static EventListener checkBoxColorListener(final DialogSceneComposerEvents events, SimActor simActor) {
    var simCheckBox = (DialogSceneComposerModel.SimCheckBox) 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 label = new Label("Color:", skin, "scene-label-colored");
            popTable.add(label);
            popTable.row();
            var imageButton = new ImageButton(skin, "scene-color");
            imageButton.getImage().setColor(simCheckBox.color == null ? Color.WHITE : simCheckBox.color.color);
            popTable.add(imageButton).minWidth(100);
            imageButton.addListener(handListener);
            imageButton.addListener(new TextTooltip("Select the color of the CheckBox.", tooltipManager, skin, "scene"));
            imageButton.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeEvent event, Actor actor) {
                    popTable.hide();
                    dialogFactory.showDialogColors(new StyleProperty(), (colorData, pressedCancel) -> {
                        if (!pressedCancel) {
                            events.checkBoxColor(colorData);
                        }
                    }, new DialogListener() {

                        @Override
                        public void opened() {
                        }

                        @Override
                        public void closed() {
                        }
                    });
                }
            });
            popTable.row();
            label = new Label(simCheckBox.color == null ? "white" : simCheckBox.color.getName(), skin, "scene-label-colored");
            popTable.add(label);
        }
    };
    popTableClickListener.update();
    return popTableClickListener;
}
Also used : InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) com.badlogic.gdx.scenes.scene2d.ui(com.badlogic.gdx.scenes.scene2d.ui) DialogSceneComposer(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) DialogListener(com.ray3k.skincomposer.dialog.DialogListener) TEXT_FIELD_WIDTH(com.ray3k.skincomposer.dialog.scenecomposer.menulisteners.ListenersUtils.TEXT_FIELD_WIDTH) Spinner(com.ray3k.stripe.Spinner) Color(com.badlogic.gdx.graphics.Color) Actor(com.badlogic.gdx.scenes.scene2d.Actor) DialogSceneComposerEvents(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerEvents) DialogSceneComposerModel(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel) SimActor(com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) Keys(com.badlogic.gdx.Input.Keys) Main(com.ray3k.skincomposer.Main) Input(com.badlogic.gdx.Input) StyleData(com.ray3k.skincomposer.data.StyleData) StyleSelectorPopTable(com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable) EventListener(com.badlogic.gdx.scenes.scene2d.EventListener) StyleProperty(com.ray3k.skincomposer.data.StyleProperty) StyleProperty(com.ray3k.skincomposer.data.StyleProperty) PopTableClickListener(com.ray3k.stripe.PopTableClickListener) DialogListener(com.ray3k.skincomposer.dialog.DialogListener) 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

ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)81 SimActor (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor)81 PopTableClickListener (com.ray3k.stripe.PopTableClickListener)81 Actor (com.badlogic.gdx.scenes.scene2d.Actor)75 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)75 Spinner (com.ray3k.stripe.Spinner)32 StyleSelectorPopTable (com.ray3k.skincomposer.dialog.scenecomposer.StyleSelectorPopTable)26 PopTable (com.ray3k.stripe.PopTable)23 ValueBeginChangeEvent (com.ray3k.stripe.RangeSlider.ValueBeginChangeEvent)11 ValueBeginChangeListener (com.ray3k.stripe.RangeSlider.ValueBeginChangeListener)11 ValueEndChangeEvent (com.ray3k.stripe.RangeSlider.ValueEndChangeEvent)11 ValueEndChangeListener (com.ray3k.stripe.RangeSlider.ValueEndChangeListener)11 Input (com.badlogic.gdx.Input)7 Keys (com.badlogic.gdx.Input.Keys)7 Color (com.badlogic.gdx.graphics.Color)7 com.badlogic.gdx.scenes.scene2d.ui (com.badlogic.gdx.scenes.scene2d.ui)7 Main (com.ray3k.skincomposer.Main)7 StyleProperty (com.ray3k.skincomposer.data.StyleProperty)7 DialogListener (com.ray3k.skincomposer.dialog.DialogListener)7 DialogSceneComposer (com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposer)7