use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimSplitPane in project skin-composer by raeleus.
the class SplitPaneListeners method splitPaneSplitListener.
public static EventListener splitPaneSplitListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSplitPane = (DialogSceneComposerModel.SimSplitPane) 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 label = new Label("Split:", skin, "scene-label-colored");
popTable.add(label).spaceRight(5);
var splitSpinner = new Spinner(0, .1f, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
var splitMinSpinner = new Spinner(0, .1f, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
var splitMaxSpinner = new Spinner(0, .1f, false, Spinner.Orientation.RIGHT_STACK, skin, "scene");
splitSpinner.setName("pad-left");
splitSpinner.setValue(simSplitPane.split);
splitSpinner.setMinimum((double) simSplitPane.splitMin);
splitSpinner.setMaximum((double) simSplitPane.splitMax);
popTable.add(splitSpinner);
splitSpinner.getTextField().addListener(ibeamListener);
splitSpinner.getButtonMinus().addListener(handListener);
splitSpinner.getButtonPlus().addListener(handListener);
splitSpinner.addListener(new TextTooltip("The distance in pixels that the user is allowed to scroll beyond the bounds if overscroll is enabled.", tooltipManager, skin, "scene"));
splitSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.splitPaneSplit((float) ((Spinner) actor).getValue());
}
});
popTable.row();
label = new Label("Split Min:", skin, "scene-label-colored");
popTable.add(label).spaceRight(5);
splitMinSpinner.setName("pad-left");
splitMinSpinner.setValue(simSplitPane.splitMin);
splitMinSpinner.setMinimum(0);
splitMinSpinner.setMaximum(simSplitPane.splitMax);
popTable.add(splitMinSpinner);
splitMinSpinner.getTextField().addListener(ibeamListener);
splitMinSpinner.getButtonMinus().addListener(handListener);
splitMinSpinner.getButtonPlus().addListener(handListener);
splitMinSpinner.addListener(new TextTooltip("The minimum speed that scroll returns to the widget bounds when overscroll is enabled.", tooltipManager, skin, "scene"));
splitMinSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.splitPaneSplitMin((float) ((Spinner) actor).getValue());
splitSpinner.setMinimum(splitMinSpinner.getValue());
splitMaxSpinner.setMinimum(splitMinSpinner.getValue());
}
});
popTable.row();
label = new Label("Split Max:", skin, "scene-label-colored");
popTable.add(label).spaceRight(5);
splitMaxSpinner.setName("pad-left");
splitMaxSpinner.setValue(simSplitPane.splitMax);
splitMaxSpinner.setMinimum(simSplitPane.splitMin);
splitMaxSpinner.setMaximum(1);
popTable.add(splitMaxSpinner);
splitMaxSpinner.getTextField().addListener(ibeamListener);
splitMaxSpinner.getButtonMinus().addListener(handListener);
splitMaxSpinner.getButtonPlus().addListener(handListener);
splitMaxSpinner.addListener(new TextTooltip("The maximum speed that scroll returns to the widget bounds when overscroll is enabled.", tooltipManager, skin, "scene"));
splitMaxSpinner.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.splitPaneSplitMax((float) ((Spinner) actor).getValue());
splitSpinner.setMaximum(splitMaxSpinner.getValue());
splitMinSpinner.setMaximum(splitMaxSpinner.getValue());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimSplitPane in project skin-composer by raeleus.
the class SplitPaneListeners method splitPaneOrientationListener.
public static EventListener splitPaneOrientationListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSplitPane = (DialogSceneComposerModel.SimSplitPane) 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);
table.defaults().left().expandX();
ButtonGroup buttonGroup = new ButtonGroup();
var imageTextButton = new ImageTextButton("Horizontal", skin, "scene-checkbox-colored");
imageTextButton.setProgrammaticChangeEvents(false);
imageTextButton.setChecked(!simSplitPane.vertical);
table.add(imageTextButton);
buttonGroup.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Horizontal orientation of the widgets.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (true)
events.splitPaneVertical(false);
}
});
table.row();
imageTextButton = new ImageTextButton("Vertical", skin, "scene-checkbox-colored");
imageTextButton.setProgrammaticChangeEvents(false);
imageTextButton.setChecked(simSplitPane.vertical);
table.add(imageTextButton);
buttonGroup.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Vertical orientation of the widgets.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if (true)
events.splitPaneVertical(true);
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimSplitPane in project skin-composer by raeleus.
the class SplitPaneListeners method splitPaneNameListener.
public static EventListener splitPaneNameListener(final DialogSceneComposer dialogSceneComposer) {
var simSplitPane = (DialogSceneComposerModel.SimSplitPane) dialogSceneComposer.simActor;
var textField = new TextField("", skin, "scene");
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);
dialogSceneComposer.getStage().setKeyboardFocus(textField);
textField.setSelection(0, textField.getText().length());
update();
}
public void update() {
var popTable = getPopTable();
popTable.clearChildren();
var label = new Label("Name:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
textField.setText(simSplitPane.name);
popTable.add(textField).minWidth(TEXT_FIELD_WIDTH);
textField.addListener(ibeamListener);
textField.addListener(new TextTooltip("The name of the SplitPane to allow for convenient searching via Group#findActor().", tooltipManager, skin, "scene"));
textField.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
dialogSceneComposer.events.splitPaneName(textField.getText());
}
});
textField.addListener(new InputListener() {
@Override
public boolean keyDown(InputEvent event, int keycode) {
if (keycode == Input.Keys.ENTER || keycode == Keys.NUMPAD_ENTER) {
popTable.hide();
return true;
} else {
return false;
}
}
});
dialogSceneComposer.getStage().setKeyboardFocus(textField);
textField.setSelection(0, textField.getText().length());
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations