Search in sources :

Example 1 with ChoiceLabel

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

Example 2 with ChoiceLabel

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);
}
Also used : 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) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) Label(mcjty.lib.gui.widgets.Label) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) Label(mcjty.lib.gui.widgets.Label)

Example 3 with ChoiceLabel

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);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) Window(mcjty.lib.gui.Window) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) NamedEnum(mcjty.rftools.varia.NamedEnum) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) Panel(mcjty.lib.gui.widgets.Panel) TextField(mcjty.lib.gui.widgets.TextField)

Example 4 with ChoiceLabel

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;
}
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 5 with ChoiceLabel

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

Aggregations

ChoiceLabel (mcjty.lib.gui.widgets.ChoiceLabel)11 Panel (mcjty.lib.gui.widgets.Panel)10 Window (mcjty.lib.gui.Window)8 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)5 TextField (mcjty.lib.gui.widgets.TextField)5 Argument (mcjty.lib.network.Argument)5 Label (mcjty.lib.gui.widgets.Label)4 java.awt (java.awt)3 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)3 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)3 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)3 RFTools (mcjty.rftools.RFTools)3 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)3 ParameterType (mcjty.rftoolscontrol.api.parameters.ParameterType)3 ParameterValue (mcjty.rftoolscontrol.api.parameters.ParameterValue)3 Minecraft (net.minecraft.client.Minecraft)3 Gui (net.minecraft.client.gui.Gui)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)2 EnumFacing (net.minecraft.util.EnumFacing)2