use of mcjty.lib.gui.widgets.ChoiceLabel in project RFTools by McJty.
the class GuiEnderMonitor method initGuiMode.
private void initGuiMode() {
mode = new ChoiceLabel(mc, this).setDesiredHeight(13).setDesiredWidth(80);
for (EnderMonitorMode m : EnderMonitorMode.values()) {
mode.addChoices(m.getDescription());
}
mode.setChoiceTooltip(EnderMonitorMode.MODE_LOSTPEARL.getDescription(), "Send a redstone pulse when a", "pearl is lost");
mode.setChoiceTooltip(EnderMonitorMode.MODE_PEARLFIRED.getDescription(), "Send a redstone pulse when a", "pearl is fired");
mode.setChoiceTooltip(EnderMonitorMode.MODE_PEARLARRIVED.getDescription(), "Send a redstone pulse when a", "pearl arrives");
mode.setChoice(tileEntity.getMode().getDescription());
mode.addChoiceEvent((parent, newChoice) -> changeMode());
}
use of mcjty.lib.gui.widgets.ChoiceLabel in project RFTools by McJty.
the class GuiLevelEmitter method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
amountField = new mcjty.lib.gui.widgets.TextField(mc, this).setTooltips("Set the amount of items in slot").setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14)).addTextEvent((parent, newText) -> setAmount());
int amount = tileEntity.getAmount();
amountField.setText(String.valueOf(amount));
starredLabel = new ChoiceLabel(mc, this).addChoices(NOTSTARRED, STARRED).addChoiceEvent((parent, newChoice) -> setMetaUsage()).setChoiceTooltip(NOTSTARRED, "All inventories are considered").setChoiceTooltip(STARRED, "Only routable inventories are considered");
starredLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14));
starredLabel.setChoice(tileEntity.isStarred() ? STARRED : NOTSTARRED);
oreDictLabel = new ChoiceLabel(mc, this).addChoices(OREDICT_IGNORE, OREDICT_USE).addChoiceEvent((parent, newChoice) -> setOredictUsage()).setChoiceTooltip(OREDICT_IGNORE, "Ingore ore dictionary").setChoiceTooltip(OREDICT_USE, "Use ore dictionary matching");
oreDictLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
oreDictLabel.setChoice(tileEntity.isOreDict() ? OREDICT_USE : OREDICT_IGNORE);
toplevel.addChild(new Label(mc, this).setText("Amount:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(amountField).addChild(new Label(mc, this).setText("Routable:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(starredLabel).addChild(new Label(mc, this).setText("Oredict:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(oreDictLabel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.widgets.ChoiceLabel in project RFTools by McJty.
the class GuiSensor method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
numberField = new TextField(mc, this).setTooltips("Set a number specific to the type of sensor").setLayoutHint(new PositionalLayout.PositionalHint(60, 51, 80, 14)).addTextEvent((parent, newText) -> setNumber());
int number = tileEntity.getNumber();
numberField.setText(String.valueOf(number));
typeLabel = new ChoiceLabel(mc, this);
for (SensorType sensorType : SensorType.values()) {
typeLabel.addChoices(sensorType.getName());
typeLabel.setChoiceTooltip(sensorType.getName(), sensorType.getDescription());
}
typeLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14));
typeLabel.setChoice(tileEntity.getSensorType().getName());
typeLabel.addChoiceEvent((parent, newChoice) -> setType());
areaLabel = new ChoiceLabel(mc, this);
for (AreaType areaType : AreaType.values()) {
areaLabel.addChoices(areaType.getName());
areaLabel.setChoiceTooltip(areaType.getName(), areaType.getDescription());
}
areaLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14));
areaLabel.setChoice(tileEntity.getAreaType().getName());
areaLabel.addChoiceEvent((parent, newChoice) -> setArea());
groupLabel = new ChoiceLabel(mc, this);
for (GroupType groupType : GroupType.values()) {
groupLabel.addChoices(groupType.getName());
groupLabel.setChoiceTooltip(groupType.getName(), groupType.getDescription());
}
groupLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
groupLabel.setChoice(tileEntity.getGroupType().getName());
groupLabel.addChoiceEvent((parent, newChoice) -> setGroup());
toplevel.addChild(new Label(mc, this).setText("Type:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(areaLabel).addChild(new Label(mc, this).setText("Area:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(typeLabel).addChild(new Label(mc, this).setText("Group:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(groupLabel).addChild(new Label(mc, this).setText("Number:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 51, 50, 14))).addChild(numberField);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.widgets.ChoiceLabel in project RFTools by McJty.
the class GuiScreen method initGui.
@Override
public void initGui() {
super.initGui();
toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
for (int i = 0; i < ScreenContainer.SCREEN_MODULES; i++) {
buttons[i] = new ToggleButton(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(30, 7 + i * 18 + 1, 40, 16)).setEnabled(false).setTooltips("Open the gui for this", "module");
final int finalI = i;
buttons[i].addButtonEvent(parent -> selectPanel(finalI));
toplevel.addChild(buttons[i]);
modulePanels[i] = null;
clientScreenModules[i] = null;
}
bright = new ToggleButton(mc, this).setText("Bright").setCheckMarker(true).setTooltips("Toggle full brightness").setLayoutHint(new PositionalLayout.PositionalHint(85, 123, 55, 14));
// .setLayoutHint(new PositionalLayout.PositionalHint(7, 208, 63, 14));
bright.setPressed(tileEntity.isBright());
bright.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETBRIGHT, new Argument("b", bright.isPressed())));
toplevel.addChild(bright);
toplevel.addChild(new Label(mc, this).setText("Font:").setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 9, 123, 30, 14)));
trueType = new ChoiceLabel(mc, this).addChoices("Default", "Truetype", "Vanilla").setTooltips("Set truetype font mode", "for the screen").setLayoutHint(new PositionalLayout.PositionalHint(85 + 50 + 14 + 30, 123, 68, 14));
int trueTypeMode = tileEntity.getTrueTypeMode();
trueType.setChoice(trueTypeMode == 0 ? "Default" : (trueTypeMode == -1 ? "Vanilla" : "Truetype"));
trueType.addChoiceEvent((a, b) -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenTileEntity.CMD_SETTRUETYPE, new Argument("b", getCurrentTruetypeChoice())));
toplevel.addChild(trueType);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
selected = -1;
}
use of mcjty.lib.gui.widgets.ChoiceLabel in project RFTools by McJty.
the class GuiThreeLogic method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
for (int i = 0; i < 8; i++) {
final int finalI = i;
ChoiceLabel tl = new ChoiceLabel(mc, this).addChoices("On", "Off", "Keep").setDesiredWidth(38).setDesiredHeight(14).setLayoutHint(new PositionalLayout.PositionalHint(146, 25 + i * 15));
tl.setChoiceTooltip("On", "Emit redstone signal");
tl.setChoiceTooltip("Off", "Don't emit redstone signal");
tl.setChoiceTooltip("Keep", "Keep previous redstone signal");
int state = tileEntity.getState(i);
switch(state) {
case 0:
tl.setChoice("Off");
break;
case 1:
tl.setChoice("On");
break;
default:
tl.setChoice("Keep");
break;
}
tl.addChoiceEvent((widget, s) -> {
String current = tl.getCurrentChoice();
int st = "On".equals(current) ? 1 : "Off".equals(current) ? 0 : -1;
sendServerCommand(RFToolsMessages.INSTANCE, ThreeLogicTileEntity.CMD_SETSTATE, new Argument("index", finalI), new Argument("state", st));
});
outputs.add(tl);
toplevel.addChild(tl);
}
toplevel.setBounds(new Rectangle(guiLeft, guiTop, LOGIC3_WIDTH, LOGIC3_HEIGHT));
window = new Window(this, toplevel);
}
Aggregations