use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageListeners method imageScalingListener.
public static EventListener imageScalingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var scalingNames = new Array<>(new String[] { "none", "fill", "fillX", "fillY", "fit", "stretch", "stretchX", "stretchY" });
var simImage = (DialogSceneComposerModel.SimImage) simActor;
var selectBox = new SelectBox<String>(skin, "scene");
selectBox.setItems(scalingNames);
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("Scaling:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
selectBox.setSelected(simImage.scaling);
popTable.add(selectBox);
selectBox.addListener(handListener);
selectBox.addListener(new TextTooltip("The scaling strategy applied to the image.", tooltipManager, skin, "scene"));
selectBox.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.imageScaling(selectBox.getSelected());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageListeners method imageNameListener.
public static EventListener imageNameListener(final DialogSceneComposer dialogSceneComposer) {
var simImage = (DialogSceneComposerModel.SimImage) 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(simImage.name);
popTable.add(textField).minWidth(TEXT_FIELD_WIDTH);
textField.addListener(ibeamListener);
textField.addListener(new TextTooltip("The name of the Image 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.imageName(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;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageTextButtonListeners method imageTextButtonCheckedListener.
public static EventListener imageTextButtonCheckedListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simImageTextButton = (DialogSceneComposerModel.SimImageTextButton) 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(simImageTextButton.checked ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simImageTextButton.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.imageTextButtonChecked(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageTextButtonListeners method imageTextButtonNameListener.
public static EventListener imageTextButtonNameListener(final DialogSceneComposer dialogSceneComposer) {
var simImageTextButton = (DialogSceneComposerModel.SimImageTextButton) 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(simImageTextButton.name);
popTable.add(textField).minWidth(TEXT_FIELD_WIDTH);
textField.addListener(ibeamListener);
textField.addListener(new TextTooltip("The name of the button 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.imageTextButtonName(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;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ListListeners method listNameListener.
public static EventListener listNameListener(final DialogSceneComposer dialogSceneComposer) {
var simList = (DialogSceneComposerModel.SimList) 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(simList.name);
popTable.add(textField).minWidth(TEXT_FIELD_WIDTH);
textField.addListener(ibeamListener);
textField.addListener(new TextTooltip("The name of the List 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.listName(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