use of mcjty.lib.gui.widgets.ToggleButton in project RFTools by McJty.
the class ShapeGuiTools method createAxisButton.
public static ToggleButton createAxisButton(Gui gui, Panel toplevel, int x, int y) {
ToggleButton showAxis = new ToggleButton(Minecraft.getMinecraft(), gui).setCheckMarker(true).setTooltips("Enable axis rendering", "in the preview").setText("A").setLayoutHint(new PositionalLayout.PositionalHint(x, y, 24, 16));
showAxis.setPressed(true);
toplevel.addChild(showAxis);
return showAxis;
}
use of mcjty.lib.gui.widgets.ToggleButton in project RFTools by McJty.
the class ShapeGuiTools method createBoxButton.
public static ToggleButton createBoxButton(Gui gui, Panel toplevel, int x, int y) {
ToggleButton showAxis = new ToggleButton(Minecraft.getMinecraft(), gui).setCheckMarker(true).setTooltips("Enable preview of the", "outer bounds").setText("B").setLayoutHint(new PositionalLayout.PositionalHint(x, y, 24, 16));
showAxis.setPressed(true);
toplevel.addChild(showAxis);
return showAxis;
}
use of mcjty.lib.gui.widgets.ToggleButton in project XNet by McJty.
the class GuiConnector method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
nameField = new TextField(mc, this).setTooltips("Set the name of this connector").addTextEvent((parent, newText) -> updateName());
nameField.setText(tileEntity.getConnectorName());
Panel namePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Name:")).addChild(nameField);
toplevel.addChild(namePanel);
Panel togglePanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Directions:"));
for (EnumFacing facing : EnumFacing.VALUES) {
toggleButtons[facing.ordinal()] = new ToggleButton(mc, this).setText(facing.getName().substring(0, 1).toUpperCase()).addButtonEvent(parent -> {
sendServerCommand(XNetMessages.INSTANCE, ConnectorTileEntity.CMD_ENABLE, new Argument("facing", facing.ordinal()), new Argument("enabled", toggleButtons[facing.ordinal()].isPressed()));
});
toggleButtons[facing.ordinal()].setPressed(tileEntity.isEnabled(facing));
togglePanel.addChild(toggleButtons[facing.ordinal()]);
}
toplevel.addChild(togglePanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.widgets.ToggleButton in project RFToolsControl by McJty.
the class LongEditor 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_LONG);
}
Aggregations