Search in sources :

Example 1 with DefaultSelectionEvent

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

the class GuiStorageScanner method makeStoragePanel.

private Panel makeStoragePanel(Panel energyPanel) {
    storageList = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            getInventoryOnServer();
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            hilightSelectedContainer(index);
        }
    }).setPropagateEventsToChildren(true);
    Slider storageListSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(storageList);
    return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(1)).setLayoutHint(new PositionalLayout.PositionalHint(3, 4, getStoragePanelWidth(), 86 + 54)).setDesiredHeight(86 + 54).addChild(energyPanel).addChild(storageList).addChild(storageListSlider);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 2 with DefaultSelectionEvent

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

the class GuiCrafter method initRecipeList.

private Slider initRecipeList() {
    recipeList = new WidgetList(mc, this).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            lastSelected = recipeList.getSelected();
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            selectRecipe();
        }
    }).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 126, 84));
    populateList();
    return new Slider(mc, this).setVertical().setScrollable(recipeList).setLayoutHint(new PositionalLayout.PositionalHint(137, 7, 10, 84));
}
Also used : PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 3 with DefaultSelectionEvent

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

the class GuiDialingDevice method setupTransmitterPanel.

private Panel setupTransmitterPanel() {
    transmitterList = new WidgetList(mc, this).setRowheight(18).setDesiredHeight(58).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            clearSelectedStatus();
            selectReceiverFromTransmitter();
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            hilightSelectedTransmitter(index);
        }
    });
    Slider transmitterSlider = new Slider(mc, this).setDesiredWidth(11).setDesiredHeight(58).setVertical().setScrollable(transmitterList);
    return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(transmitterList).addChild(transmitterSlider).setDesiredHeight(64).setFilledBackground(0xff9e9e9e);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 4 with DefaultSelectionEvent

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

the class GuiCraftingGrid method initGui.

public void initGui(final ModBase modBase, final SimpleNetworkWrapper network, final Minecraft mc, GenericGuiContainer<?> gui, BlockPos pos, CraftingGridProvider provider, int guiLeft, int guiTop, int xSize, int ySize) {
    this.mc = mc;
    this.gui = gui;
    SimpleNetworkWrapper network1 = network;
    this.provider = provider;
    this.pos = pos;
    recipeList = new WidgetList(mc, gui).setLayoutHint(new PositionalLayout.PositionalHint(5, 5, 56, 102));
    recipeList.addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            selectRecipe();
        }
    });
    craft1Button = new Button(mc, gui).setText("1").setLayoutHint(new PositionalLayout.PositionalHint(29, 183, 14, 10)).setTooltips("Craft one").addButtonEvent(parent -> craft(1));
    craft4Button = new Button(mc, gui).setText("4").setLayoutHint(new PositionalLayout.PositionalHint(45, 183, 14, 10)).setTooltips("Craft four").addButtonEvent(parent -> craft(4));
    craft8Button = new Button(mc, gui).setText("8").setLayoutHint(new PositionalLayout.PositionalHint(29, 195, 14, 10)).setTooltips("Craft eight").addButtonEvent(parent -> craft(8));
    craftSButton = new Button(mc, gui).setText("*").setLayoutHint(new PositionalLayout.PositionalHint(45, 195, 14, 10)).setTooltips("Craft a stack").addButtonEvent(parent -> craft(-1));
    storeButton = new Button(mc, gui).setText("Store").setLayoutHint(new PositionalLayout.PositionalHint(5, 109, 56, 14)).setTooltips("Store the current recipe").addButtonEvent(parent -> store());
    Panel sidePanel = new Panel(mc, gui).setLayout(new PositionalLayout()).addChild(craft1Button).addChild(craft4Button).addChild(craft8Button).addChild(craftSButton).addChild(storeButton).addChild(recipeList);
    int sideLeft = guiLeft - CraftingGridInventory.GRID_WIDTH - 2;
    int sideTop = guiTop;
    sidePanel.setBounds(new Rectangle(sideLeft, sideTop, CraftingGridInventory.GRID_WIDTH, CraftingGridInventory.GRID_HEIGHT));
    sidePanel.setBackground(iconLocation);
    craftWindow = new Window(gui, sidePanel);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Arguments(mcjty.lib.network.Arguments) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) Gui(net.minecraft.client.gui.Gui) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModBase(mcjty.lib.base.ModBase) RFTools(mcjty.rftools.RFTools) IRecipe(net.minecraft.item.crafting.IRecipe) GlStateManager(net.minecraft.client.renderer.GlStateManager) BlockPos(net.minecraft.util.math.BlockPos) Mouse(org.lwjgl.input.Mouse) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) CommandHandler(mcjty.rftools.CommandHandler) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 5 with DefaultSelectionEvent

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

the class GuiDialingDevice method setupReceiverPanel.

private Panel setupReceiverPanel() {
    receiverList = new WidgetList(mc, this).setRowheight(14).setDesiredHeight(100).setPropagateEventsToChildren(true).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            clearSelectedStatus();
        }

        @Override
        public void doubleClick(Widget parent, int index) {
            hilightSelectedReceiver(index);
        }
    });
    Slider receiverSlider = new Slider(mc, this).setDesiredWidth(11).setDesiredHeight(100).setVertical().setScrollable(receiverList);
    return new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).addChild(receiverList).addChild(receiverSlider).setDesiredHeight(106).setFilledBackground(0xff9e9e9e);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Aggregations

DefaultSelectionEvent (mcjty.lib.gui.events.DefaultSelectionEvent)10 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)8 Window (mcjty.lib.gui.Window)6 Rectangle (java.awt.Rectangle)5 StyleConfig (mcjty.lib.base.StyleConfig)5 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)5 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)5 RFTools (mcjty.rftools.RFTools)5 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)5 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)4 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)4 Panel (mcjty.lib.gui.widgets.Panel)4 BlockTools (mcjty.lib.varia.BlockTools)4 BlockPos (net.minecraft.util.math.BlockPos)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)3 BlockPosTools (mcjty.lib.varia.BlockPosTools)3 Block (net.minecraft.block.Block)3 IBlockState (net.minecraft.block.state.IBlockState)3