use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class HorizontalGroupListeners method horizontalGroupWrapListener.
public static EventListener horizontalGroupWrapListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simHorizontalGroup = (DialogSceneComposerModel.SimHorizontalGroup) 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(simHorizontalGroup.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.horizontalGroupWrap(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(simHorizontalGroup.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.horizontalGroupWrapSpace(((Spinner) actor).getValueAsInt());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class SelectBoxListeners method selectBoxMaxListCountListener.
public static EventListener selectBoxMaxListCountListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSelectBox = (DialogSceneComposerModel.SimSelectBox) 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("Max List Count:", skin, "scene-label-colored");
table.add(label).right();
var valueSpinner = new Spinner(simSelectBox.maxListCount, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
valueSpinner.setMinimum(0);
table.add(valueSpinner).width(100).left();
valueSpinner.getTextField().addListener(ibeamListener);
valueSpinner.getButtonMinus().addListener(handListener);
valueSpinner.getButtonPlus().addListener(handListener);
valueSpinner.addListener(new TextTooltip("The maximum visible entries in the list.", tooltipManager, skin, "scene"));
valueSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxMaxListCount(valueSpinner.getValueAsInt());
}
});
table.row();
label = new Label("(Set to 0 to show as many as possible)", skin, "scene-label-colored");
table.add(label).colspan(2);
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class ScrollPaneListeners method scrollPaneScrollListener.
public static EventListener scrollPaneScrollListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simScrollPane = (DialogSceneComposerModel.SimScrollPane) 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("Clamp", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.clamp);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Prevents scrolling out of the widget's bounds when using flick Scroll.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneClamp(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Flick Scroll", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.flickScroll);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Allow users to scroll by flicking the contents of the ScrollPanel", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneFlickScroll(((ImageTextButton) actor).isChecked());
}
});
table.row();
var subTable = new Table();
table.add(subTable);
var label = new Label("Fling Time:", skin, "scene-label-colored");
subTable.add(label).space(5);
var spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-left");
spinner.setValue(simScrollPane.flingTime);
subTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The amount of time in seconds that a fling will continue to scroll.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneFlingTime((float) ((Spinner) actor).getValue());
}
});
table.row();
imageTextButton = new ImageTextButton("Overscroll X", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.overScrollX);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("The widget can be scrolled passed the bounds horizontally and will snap back into place if flick scroll is enabled.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneOverScrollX(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Overscroll Y", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.overScrollY);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("The widget can be scrolled passed the bounds vertically and will snap back into place if flick scroll is enabled.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneOverScrollY(((ImageTextButton) actor).isChecked());
}
});
table.row();
subTable = new Table();
table.add(subTable);
label = new Label("Overscroll Distance:", skin, "scene-label-colored");
subTable.add(label).spaceRight(5);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-left");
spinner.setValue(simScrollPane.overScrollDistance);
subTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The distance in pixels that the user is allowed to scroll beyond the bounds if overscroll is enabled.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneOverScrollDistance((float) ((Spinner) actor).getValue());
}
});
subTable.row();
label = new Label("Overscroll Speed Min:", skin, "scene-label-colored");
subTable.add(label).spaceRight(5);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-left");
spinner.setValue(simScrollPane.overScrollSpeedMin);
subTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The minimum speed that scroll returns to the widget bounds when overscroll is enabled.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneOverScrollSpeedMin((float) ((Spinner) actor).getValue());
}
});
subTable.row();
label = new Label("Overscroll Speed Max:", skin, "scene-label-colored");
subTable.add(label).spaceRight(5);
spinner = new Spinner(0, 1, true, Spinner.Orientation.RIGHT_STACK, skin, "scene");
spinner.setName("pad-left");
spinner.setValue(simScrollPane.overScrollSpeedMax);
subTable.add(spinner);
spinner.getTextField().addListener(ibeamListener);
spinner.getButtonMinus().addListener(handListener);
spinner.getButtonPlus().addListener(handListener);
spinner.addListener(new TextTooltip("The maximum speed that scroll returns to the widget bounds when overscroll is enabled.", tooltipManager, skin, "scene"));
spinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneOverScrollSpeedMax((float) ((Spinner) actor).getValue());
}
});
table.row();
imageTextButton = new ImageTextButton("Smooth Scrolling", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.smoothScrolling);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Scrolling is interpolated instead of jumping to position immediately.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneSmoothScrolling(((ImageTextButton) actor).isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class SliderListeners method sliderAnimationListener.
public static EventListener sliderAnimationListener(final DialogSceneComposer dialogSceneComposer) {
var simSlider = (DialogSceneComposerModel.SimSlider) dialogSceneComposer.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().spaceRight(5);
var textButton = new TextButton("Animate Interpolation", skin, "scene-med");
table.add(textButton).uniformX().fillX().colspan(2);
textButton.addListener(handListener);
textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.sliderAnimateInterpolation(selection)));
table.row();
textButton = new TextButton("Visual Interpolation", skin, "scene-med");
table.add(textButton).uniformX().fillX().colspan(2);
textButton.addListener(handListener);
textButton.addListener(GeneralListeners.interpolationListener(dialogSceneComposer, selection -> dialogSceneComposer.events.sliderVisualInterpolation(selection)));
table.row();
var label = new Label("Animation Duration:", skin, "scene-label-colored");
table.add(label).right();
var durationSpinner = new Spinner(simSlider.animationDuration, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
durationSpinner.setMinimum(0);
table.add(durationSpinner).left();
durationSpinner.getTextField().addListener(ibeamListener);
durationSpinner.getButtonMinus().addListener(handListener);
durationSpinner.getButtonPlus().addListener(handListener);
durationSpinner.addListener(new TextTooltip("The animation duration of the Slider as the value changes.", tooltipManager, skin, "scene"));
durationSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
dialogSceneComposer.events.sliderAnimationDuration((float) durationSpinner.getValue());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.Spinner in project skin-composer by raeleus.
the class SliderListeners method sliderValueSettingsListener.
public static EventListener sliderValueSettingsListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSlider = (DialogSceneComposerModel.SimSlider) 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("Value:", skin, "scene-label-colored");
table.add(label);
var valueSpinner = new Spinner(simSlider.value, simSlider.increment, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
valueSpinner.setMinimum(simSlider.minimum);
valueSpinner.setMaximum(simSlider.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 Slider.", tooltipManager, skin, "scene"));
valueSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.sliderValue((float) valueSpinner.getValue());
}
});
table.row();
label = new Label("Minimum:", skin, "scene-label-colored");
table.add(label);
var minimumSpinner = new Spinner(simSlider.minimum, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
minimumSpinner.setMaximum(simSlider.maximum);
var maximumSpinner = new Spinner(simSlider.maximum, 1, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
maximumSpinner.setMinimum(simSlider.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 Slider.", tooltipManager, skin, "scene"));
minimumSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.sliderMinimum((float) minimumSpinner.getValue());
if (valueSpinner.getValue() < minimumSpinner.getValue()) {
valueSpinner.setValue(simSlider.minimum);
}
maximumSpinner.setMinimum(simSlider.minimum);
}
});
table.row();
label = new Label("Maximum:", skin, "scene-label-colored");
table.add(label);
maximumSpinner.setValue(simSlider.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 Slider.", tooltipManager, skin, "scene"));
maximumSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.sliderMaximum((float) maximumSpinner.getValue());
if (valueSpinner.getValue() > maximumSpinner.getValue()) {
valueSpinner.setValue(simSlider.maximum);
}
minimumSpinner.setMaximum(simSlider.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(simSlider.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 Slider.", tooltipManager, skin, "scene"));
incrementSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.sliderIncrement((float) incrementSpinner.getValue());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations