use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class TextButtonListeners method textButtonPaddingListener.
public static EventListener textButtonPaddingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simTextButton = (DialogSceneComposerModel.SimTextButton) 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.textButtonPadding((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(simTextButton.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(simTextButton.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(simTextButton.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(simTextButton.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;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class VerticalGroupListeners method verticalGroupWrapListener.
public static EventListener verticalGroupWrapListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simVerticalGroup = (DialogSceneComposerModel.SimVerticalGroup) 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);
table.defaults().left().spaceRight(5);
var imageTextButton = new ImageTextButton("Wrap", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simVerticalGroup.wrap);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Whether the widgets will wrap to the next line.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupWrap(imageTextButton.isChecked());
}
});
table.row();
var label = new Label("Wrap Space:", skin, "scene-label-colored");
table.add(label);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simVerticalGroup.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 vertical space between rows when wrap is enabled.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupWrapSpace(((Spinner) actor).getValueAsInt());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class VerticalGroupListeners method verticalGroupPaddingSpacingListener.
public static EventListener verticalGroupPaddingSpacingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simVerticalGroup = (DialogSceneComposerModel.SimVerticalGroup) 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("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(simVerticalGroup.padLeft);
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 widgets.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupPadLeft(((Spinner) actor).getValueAsInt());
}
});
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(simVerticalGroup.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 widgets.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupPadRight(((Spinner) actor).getValueAsInt());
}
});
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(simVerticalGroup.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 widgets.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupPadTop(((Spinner) actor).getValueAsInt());
}
});
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(simVerticalGroup.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 widgets.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupPadBottom(((Spinner) actor).getValueAsInt());
}
});
var image = new Image(skin, "scene-menu-divider");
popTable.add(image).space(10).growY();
table = new Table();
popTable.add(table);
table.defaults().right().spaceRight(5);
label = new Label("Spacing:", skin, "scene-label-colored");
table.add(label);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setValue(simVerticalGroup.space);
spinner.setName("spacing-left");
table.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The spacing between the widgets.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.verticalGroupSpace(((Spinner) actor).getValueAsInt());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations