Search in sources :

Example 1 with ToggleButton

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);
}
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)

Example 2 with ToggleButton

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;
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) Argument(mcjty.lib.network.Argument) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel)

Example 3 with ToggleButton

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);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Label(mcjty.lib.gui.widgets.Label) EmptyContainer(mcjty.lib.container.EmptyContainer) Window(mcjty.lib.gui.Window) java.awt(java.awt) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) 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 4 with ToggleButton

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);
}
Also used : EmptyContainer(mcjty.lib.container.EmptyContainer) GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) Window(mcjty.lib.gui.Window) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ToggleButton(mcjty.lib.gui.widgets.ToggleButton) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout)

Example 5 with ToggleButton

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

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