use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageButtonListeners method imageButtonCheckedListener.
public static EventListener imageButtonCheckedListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simImageButton = (DialogSceneComposerModel.SimImageButton) 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(simImageButton.checked ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simImageButton.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.imageButtonChecked(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageButtonListeners method imageButtonDisabledListener.
public static EventListener imageButtonDisabledListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simImageButton = (DialogSceneComposerModel.SimImageButton) 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("Disabled:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var textButton = new TextButton(simImageButton.disabled ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simImageButton.disabled);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the button is disabled initially.", tooltipManager, skin, "scene"));
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
events.imageButtonDisabled(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageTextButtonListeners method imageTextButtonDisabledListener.
public static EventListener imageTextButtonDisabledListener(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("Disabled:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var textButton = new TextButton(simImageTextButton.disabled ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simImageTextButton.disabled);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the button is disabled initially.", tooltipManager, skin, "scene"));
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
events.imageTextButtonDisabled(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.stripe.PopTableClickListener in project skin-composer by raeleus.
the class ImageTextButtonListeners method imageTextButtonTextListener.
public static EventListener imageTextButtonTextListener(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("Text:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
textField.setText(simImageTextButton.text);
popTable.add(textField).minWidth(TEXT_FIELD_WIDTH);
textField.addListener(ibeamListener);
textField.addListener(new TextTooltip("The text inside of the button.", tooltipManager, skin, "scene"));
textField.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
dialogSceneComposer.events.imageTextButtonText(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 imageTextButtonColorListener.
public static EventListener imageTextButtonColorListener(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("Color:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var imageButton = new ImageButton(skin, "scene-color");
imageButton.getImage().setColor(simImageTextButton.color == null ? Color.WHITE : simImageTextButton.color.color);
popTable.add(imageButton).minWidth(100);
imageButton.addListener(handListener);
imageButton.addListener(new TextTooltip("Select the color of the button.", tooltipManager, skin, "scene"));
imageButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
popTable.hide();
dialogFactory.showDialogColors(new StyleProperty(), (colorData, pressedCancel) -> {
if (!pressedCancel) {
events.imageTextButtonColor(colorData);
}
}, new DialogListener() {
@Override
public void opened() {
}
@Override
public void closed() {
}
});
}
});
popTable.row();
label = new Label(simImageTextButton.color == null ? "white" : simImageTextButton.color.getName(), skin, "scene-label-colored");
popTable.add(label);
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations