use of mcjty.lib.gui.widgets.ToggleButton in project RFToolsControl by McJty.
the class IntegerEditor method build.
@Override
public void build(Minecraft mc, Gui gui, Panel panel, ParameterEditorCallback callback) {
Panel constantPanel = new Panel(mc, gui).setLayout(new HorizontalLayout());
field = new TextField(mc, gui).addTextEvent((parent, newText) -> callback.valueChanged(readValue())).addTextEnterEvent((parent, newText) -> closeWindow());
constantPanel.addChild(field);
hexMode = new ToggleButton(mc, gui).addButtonEvent(widget -> updateHex()).setCheckMarker(true).setText("Hex");
constantPanel.addChild(hexMode);
createEditorPanel(mc, gui, panel, callback, constantPanel, ParameterType.PAR_INTEGER);
}
use of mcjty.lib.gui.widgets.ToggleButton 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.ToggleButton in project RFTools by McJty.
the class GuiTimer method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
Label label = new Label(mc, this).setText("Delay:");
speedField = new TextField(mc, this).setTooltips("Set the delay in ticks", "(20 ticks is one second)").addTextEvent((parent, newText) -> setDelay());
int delay = tileEntity.getDelay();
if (delay <= 0) {
delay = 1;
}
speedField.setText(String.valueOf(delay));
Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(label).addChild(speedField);
toplevel.addChild(bottomPanel);
redstonePauses = new ToggleButton(mc, this).setText("Pause while redstone active").setDesiredHeight(16).setCheckMarker(true).setPressed(tileEntity.getRedstonePauses()).addButtonEvent(parent -> setRedstonePauses());
toplevel.addChild(redstonePauses);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, TIMER_WIDTH, TIMER_HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.widgets.ToggleButton in project RFTools by McJty.
the class GuiRedstoneReceiver method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
analog = new ToggleButton(mc, this).setText("Analog mode").setTooltips("Output the same power", "level as the input, instead", "of always 15 or 0").setCheckMarker(true).setDesiredWidth(160).setDesiredHeight(16).setPressed(tileEntity.getAnalog()).addButtonEvent(parent -> setAnalog());
toplevel.addChild(analog);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, REDSTONE_RECEIVER_WIDTH, REDSTONE_RECEIVER_HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.widgets.ToggleButton in project RFTools by McJty.
the class ShapeGuiTools method createScanButton.
public static ToggleButton createScanButton(Gui gui, Panel toplevel, int x, int y) {
ToggleButton showAxis = new ToggleButton(Minecraft.getMinecraft(), gui).setCheckMarker(true).setTooltips("Show a visual scanline", "wherever the preview", "is updated").setText("S").setLayoutHint(new PositionalLayout.PositionalHint(x, y, 24, 16));
showAxis.setPressed(true);
toplevel.addChild(showAxis);
return showAxis;
}
Aggregations