use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class SelectBoxListeners method selectBoxScrollingListener.
public static EventListener selectBoxScrollingListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simSelectBox = (DialogSceneComposerModel.SimSelectBox) 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("Scrolling Disabled:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var textButton = new TextButton(simSelectBox.scrollingDisabled ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simSelectBox.scrollingDisabled);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the SelectBox scrolling is diabled", tooltipManager, skin, "scene"));
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
events.selectBoxScrollingDisabled(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor 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.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class SelectBoxListeners method selectBoxAlignmentListener.
public static EventListener selectBoxAlignmentListener(final DialogSceneComposerEvents events, final SimActor 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 simSelectBox = (DialogSceneComposerModel.SimSelectBox) simActor;
var popTable = getPopTable();
popTable.clearChildren();
var table = new Table();
popTable.add(table);
var label = new Label("Alignment:", skin, "scene-label-colored");
table.add(label).colspan(3);
table.row();
table.defaults().space(10).left().uniformX();
var buttonGroup = new ButtonGroup<ImageTextButton>();
var imageTextButton = new ImageTextButton("Top-Left", skin, "scene-checkbox-colored");
var topLeft = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the top left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.topLeft);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Top", skin, "scene-checkbox-colored");
var top = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the top center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.top);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Top-Right", skin, "scene-checkbox-colored");
var topRight = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the top right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.topRight);
}
});
buttonGroup.add(imageTextButton);
table.row();
imageTextButton = new ImageTextButton("Left", skin, "scene-checkbox-colored");
var left = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the middle left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.left);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Center", skin, "scene-checkbox-colored");
var center = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.center);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Right", skin, "scene-checkbox-colored");
var right = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the middle right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.right);
}
});
buttonGroup.add(imageTextButton);
table.row();
imageTextButton = new ImageTextButton("Bottom-Left", skin, "scene-checkbox-colored");
var bottomLeft = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the bottom left.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.bottomLeft);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Bottom", skin, "scene-checkbox-colored");
var bottom = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the bottom center.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.bottom);
}
});
buttonGroup.add(imageTextButton);
imageTextButton = new ImageTextButton("Bottom-Right", skin, "scene-checkbox-colored");
var bottomRight = imageTextButton;
imageTextButton.setProgrammaticChangeEvents(false);
table.add(imageTextButton);
imageTextButton.addListener(handListener);
imageTextButton.addListener(new TextTooltip("Align the contents of the SelectBox to the bottom right.", tooltipManager, skin, "scene"));
imageTextButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
events.selectBoxAlignment(Align.bottomRight);
}
});
buttonGroup.add(imageTextButton);
switch(simSelectBox.alignment) {
case Align.topLeft:
topLeft.setChecked(true);
break;
case Align.top:
top.setChecked(true);
break;
case Align.topRight:
topRight.setChecked(true);
break;
case Align.right:
right.setChecked(true);
break;
case Align.bottomRight:
bottomRight.setChecked(true);
break;
case Align.bottom:
bottom.setChecked(true);
break;
case Align.bottomLeft:
bottomLeft.setChecked(true);
break;
case Align.left:
left.setChecked(true);
break;
case Align.center:
center.setChecked(true);
break;
}
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class LabelListeners method labelWrapListener.
public static EventListener labelWrapListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simLabel = (DialogSceneComposerModel.SimLabel) 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("Wrap:", skin, "scene-label-colored");
popTable.add(label);
popTable.row();
var textButton = new TextButton(simLabel.wrap ? "TRUE" : "FALSE", skin, "scene-small");
textButton.setChecked(simLabel.wrap);
popTable.add(textButton).minWidth(100);
textButton.addListener(handListener);
textButton.addListener(new TextTooltip("Whether the Label wraps when the the text exceeds the width of the label.", tooltipManager, skin, "scene"));
textButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
textButton.setText(textButton.isChecked() ? "TRUE" : "FALSE");
events.labelWrap(textButton.isChecked());
}
});
}
};
popTableClickListener.update();
return popTableClickListener;
}
use of com.ray3k.skincomposer.dialog.scenecomposer.DialogSceneComposerModel.SimActor in project skin-composer by raeleus.
the class LabelListeners method labelColorListener.
public static EventListener labelColorListener(final DialogSceneComposerEvents events, SimActor simActor) {
var simLabel = (DialogSceneComposerModel.SimLabel) 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(simLabel.color == null ? Color.WHITE : simLabel.color.color);
popTable.add(imageButton).minWidth(100);
imageButton.addListener(handListener);
imageButton.addListener(new TextTooltip("Select the color of the Label.", 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.labelColor(colorData);
}
}, new DialogListener() {
@Override
public void opened() {
}
@Override
public void closed() {
}
});
}
});
popTable.row();
label = new Label(simLabel.color == null ? "white" : simLabel.color.getName(), skin, "scene-label-colored");
popTable.add(label);
}
};
popTableClickListener.update();
return popTableClickListener;
}
Aggregations