Search in sources :

Example 6 with ToggleButton

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;
}
Also used : ToggleButton(mcjty.lib.gui.widgets.ToggleButton) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 7 with ToggleButton

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;
}
Also used : ToggleButton(mcjty.lib.gui.widgets.ToggleButton) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 8 with ToggleButton

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);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) TextField(mcjty.lib.gui.widgets.TextField) EnumFacing(net.minecraft.util.EnumFacing) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) XNet(mcjty.xnet.XNet) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) GuiProxy(mcjty.xnet.gui.GuiProxy) Panel(mcjty.lib.gui.widgets.Panel) XNetMessages(mcjty.xnet.network.XNetMessages) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Argument(mcjty.lib.network.Argument) EnumFacing(net.minecraft.util.EnumFacing) Label(mcjty.lib.gui.widgets.Label) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 9 with ToggleButton

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);
}
Also used : Window(mcjty.lib.gui.Window) ParameterType(mcjty.rftoolscontrol.api.parameters.ParameterType) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) TextField(mcjty.lib.gui.widgets.TextField) Gui(net.minecraft.client.gui.Gui) Panel(mcjty.lib.gui.widgets.Panel) ParameterValue(mcjty.rftoolscontrol.api.parameters.ParameterValue) Minecraft(net.minecraft.client.Minecraft) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) TextField(mcjty.lib.gui.widgets.TextField) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Aggregations

ToggleButton (mcjty.lib.gui.widgets.ToggleButton)9 Window (mcjty.lib.gui.Window)6 Panel (mcjty.lib.gui.widgets.Panel)6 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)4 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)4 TextField (mcjty.lib.gui.widgets.TextField)4 Argument (mcjty.lib.network.Argument)4 java.awt (java.awt)3 EmptyContainer (mcjty.lib.container.EmptyContainer)3 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)3 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)3 Label (mcjty.lib.gui.widgets.Label)3 RFTools (mcjty.rftools.RFTools)2 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)2 ParameterType (mcjty.rftoolscontrol.api.parameters.ParameterType)2 ParameterValue (mcjty.rftoolscontrol.api.parameters.ParameterValue)2 Minecraft (net.minecraft.client.Minecraft)2 Gui (net.minecraft.client.gui.Gui)2 ChoiceLabel (mcjty.lib.gui.widgets.ChoiceLabel)1 XNet (mcjty.xnet.XNet)1