Search in sources :

Example 31 with ChoiceEvent

use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.

the class GuiEnvironmentalController method initRedstoneMode.

private void initRedstoneMode() {
    redstoneMode = new ImageChoiceLabel(mc, this).setDesiredHeight(16).setDesiredWidth(16).addChoiceEvent(new ChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, String newChoice) {
            changeRedstoneMode();
        }
    }).addChoice(RedstoneMode.REDSTONE_IGNORED.getDescription(), "Redstone mode:\nIgnored", iconGuiElements, 0, 0).addChoice(RedstoneMode.REDSTONE_OFFREQUIRED.getDescription(), "Redstone mode:\nOff to activate", iconGuiElements, 16, 0).addChoice(RedstoneMode.REDSTONE_ONREQUIRED.getDescription(), "Redstone mode:\nOn to activate", iconGuiElements, 32, 0);
    redstoneMode.setCurrentChoice(tileEntity.getRedstoneMode().ordinal());
}
Also used : ChoiceEvent(mcjty.lib.gui.events.ChoiceEvent)

Example 32 with ChoiceEvent

use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.

the class GuiDevelopersDelight method initGui.

@Override
public void initGui() {
    super.initGui();
    int k = (this.width - this.xSize) / 2;
    int l = (this.height - this.ySize) / 2;
    tabbedPanel = new TabbedPanel(mc, this);
    Panel tab1 = createBlockClassesPage();
    Panel tab2 = createTeClassesPage();
    Panel tab3 = createNbtDataPage();
    tabbedPanel.addPage("Block", tab1).addPage("TE", tab2).addPage("NBT", tab3);
    ToggleButton tab1Button = createToggleButton("Block");
    ToggleButton tab2Button = createToggleButton("TE");
    ToggleButton tab3Button = createToggleButton("NBT");
    clientServerMode = new ChoiceLabel(mc, this).setDesiredWidth(60).addChoices("Server", "Client").setChoice("Server").addChoiceEvent(new ChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, String newChoice) {
            requestNewLists();
        }
    }).setDesiredHeight(16).setTooltips("Switch between client", "and server information");
    metaData = new TextField(mc, this).setDesiredHeight(14).setTooltips("Metadata for this block");
    Panel buttonPanel = new Panel(mc, this).setLayout(new VerticalLayout()).setDesiredWidth(62).addChild(tab1Button).addChild(tab2Button).addChild(tab3Button).addChild(new Label(mc, this).setDynamic(true)).addChild(clientServerMode).addChild(metaData).addChild(new Label(mc, this).setDynamic(true));
    Widget toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new HorizontalLayout()).addChild(buttonPanel).addChild(tabbedPanel);
    toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
    window = new Window(this, toplevel);
    requestNewLists();
}
Also used : Window(mcjty.lib.gui.Window) ChoiceEvent(mcjty.lib.gui.events.ChoiceEvent) Label(mcjty.lib.gui.widgets.Label) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) TextField(mcjty.lib.gui.widgets.TextField) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout)

Example 33 with ChoiceEvent

use of mcjty.lib.gui.events.ChoiceEvent in project RFTools by McJty.

the class GuiBlockProtector method initRedstoneMode.

private void initRedstoneMode() {
    redstoneMode = new ImageChoiceLabel(mc, this).addChoiceEvent(new ChoiceEvent() {

        @Override
        public void choiceChanged(Widget parent, String newChoice) {
            changeRedstoneMode();
        }
    }).addChoice(RedstoneMode.REDSTONE_IGNORED.getDescription(), "Redstone mode:\nIgnored", iconGuiElements, 0, 0).addChoice(RedstoneMode.REDSTONE_OFFREQUIRED.getDescription(), "Redstone mode:\nOff to activate", iconGuiElements, 16, 0).addChoice(RedstoneMode.REDSTONE_ONREQUIRED.getDescription(), "Redstone mode:\nOn to activate", iconGuiElements, 32, 0);
    redstoneMode.setLayoutHint(new PositionalLayout.PositionalHint(150, 46, 16, 16));
    redstoneMode.setCurrentChoice(tileEntity.getRedstoneMode().ordinal());
}
Also used : ChoiceEvent(mcjty.lib.gui.events.ChoiceEvent) Widget(mcjty.lib.gui.widgets.Widget) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel)

Aggregations

ChoiceEvent (mcjty.lib.gui.events.ChoiceEvent)33 Panel (mcjty.lib.gui.widgets.Panel)19 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)15 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)14 Window (mcjty.lib.gui.Window)12 Label (mcjty.lib.gui.widgets.Label)9 TextField (mcjty.lib.gui.widgets.TextField)9 TextEvent (mcjty.lib.gui.events.TextEvent)8 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)7 Button (mcjty.lib.gui.widgets.Button)7 ButtonEvent (mcjty.lib.gui.events.ButtonEvent)6 ColorChoiceEvent (mcjty.lib.gui.events.ColorChoiceEvent)6 Widget (mcjty.lib.gui.widgets.Widget)5 ImageChoiceLabel (mcjty.lib.gui.widgets.ImageChoiceLabel)4 Coordinate (mcjty.lib.varia.Coordinate)4 ValueEvent (mcjty.lib.gui.events.ValueEvent)3 DefaultSelectionEvent (mcjty.lib.gui.events.DefaultSelectionEvent)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 HashMap (java.util.HashMap)1