use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ScrollPaneListeners method scrollPaneKnobsListener.
public static EventListener scrollPaneKnobsListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simScrollPane = (DialogSceneComposerModel.SimScrollPane) 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();
popTable.pad(10);
var table = new Table();
popTable.add(table).space(5).left();
table.defaults().left().expandX();
var imageTextButton = new ImageTextButton("Variable Size Knobs", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.variableSizeKnobs);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Scroll knobs are sized based on getMaxX() or getMaxY()", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneVariableSizeKnobs(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Fade Scroll Bars", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.fadeScrollBars);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Scrollbars don't reduce the scrollable size and fade out if not used.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneFadeScrollBars(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("ScrollBarsVisible", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.scrollBarsVisible);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Shows or hides the scrollbars when Fade Scroll Bars is activated.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollBarsVisible(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Scroll Bar Touch", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.scrollBarsOnTop);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Set whether scrollbars respond to mouse clicks.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollBarTouch(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Scroll Bars On Top", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.scrollBarsOnTop);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Scrollbars don't reduce the scrollable size and fade out if not used.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollBarsOnTop(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Force Horizontal Scroll", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.forceScrollX);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Forces the horizontal scroll bar to be enabled.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneForceScrollX(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Force Vertical Scroll", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.forceScrollY);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Forces the vertical scroll bar to be enabled.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneForceScrollY(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Horizontal Scrolling Disabled", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.scrollingDisabledX);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Horizontal Scrolling is disabled.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollingDisabledX(((ImageTextButton) actor).isChecked());
}
});
table.row();
imageTextButton = new ImageTextButton("Vertical Scrolling Disabled", skin, "scene-checkbox-colored");
imageTextButton.setChecked(simScrollPane.scrollingDisabledY);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Vertical scrolling is disabled.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollingDisabledY(((ImageTextButton) actor).isChecked());
}
});
popTable.row();
table = new Table();
popTable.add(table);
table.defaults().space(5).fillX();
var label = new Label("Horizontal Scroll Position: ", skin, "scene-label-colored");
table.add(label);
var selectBox = new SelectBox<String>(skin, "scene");
selectBox.setItems("Top", "Bottom");
selectBox.setSelectedIndex(simScrollPane.scrollBarBottom ? 1 : 0);
table.add(selectBox);
selectBox.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollBarBottom(((SelectBox) actor).getSelectedIndex() == 1);
}
});
table.row();
label = new Label("Vertical Scroll Position: ", skin, "scene-label-colored");
table.add(label);
selectBox = new SelectBox<>(skin, "scene");
selectBox.setItems("Left", "Right");
selectBox.setSelectedIndex(simScrollPane.scrollBarRight ? 1 : 0);
table.add(selectBox);
selectBox.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.scrollPaneScrollBarRight(((SelectBox) actor).getSelectedIndex() == 1);
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.PopTableClickListener 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.PopTableClickListener 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.PopTableClickListener 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;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class SliderListeners method sliderRoundListener.
public static EventListener sliderRoundListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSlider = (DialogSceneComposerModel.SimSlider) 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("Round:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var textButton = new TextButton(simSlider.round ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simSlider.round);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the Slider inner positions are rounded to integer.", tooltipManager, skin, "scene"));
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
events.sliderRound(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations