use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class GuiTools method showMessage.
public static void showMessage(Minecraft mc, Gui gui, WindowManager windowManager, int x, int y, String title) {
Panel ask = new Panel(mc, gui).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
ask.setBounds(new Rectangle(x, y, 200, 40));
Window askWindow = windowManager.createModalWindow(ask);
ask.addChild(new Label(mc, gui).setText(title));
Panel buttons = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredWidth(100).setDesiredHeight(18);
buttons.addChild(new Button(mc, gui).setText("Cancel").addButtonEvent((parent -> {
windowManager.closeWindow(askWindow);
})));
ask.addChild(buttons);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiSequencer method initGuiGrid.
private void initGuiGrid(Panel toplevel) {
for (int row = 0; row < 8; row++) {
Panel rowPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(13);
toplevel.addChild(rowPanel);
for (int col = 0; col < 8; col++) {
final int bit = row * 8 + col;
ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).addChoiceEvent((parent, newChoice) -> changeBit(bit, newChoice)).setDesiredHeight(12).addChoice("0", "Disabled", iconGuiElements, 160, 0).addChoice("1", "Enabled", iconGuiElements, 176, 0);
choiceLabel.setCurrentChoice(tileEntity.getCycleBit(bit) ? 1 : 0);
bits.add(choiceLabel);
rowPanel.addChild(choiceLabel);
}
}
}
use of mcjty.lib.gui.layout.HorizontalLayout 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);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiLiquidMonitor method populateList.
private void populateList() {
List<BlockPos> newAdjacentBlocks = fromServer_clientAdjacentBlocks;
if (newAdjacentBlocks == null) {
return;
}
if (newAdjacentBlocks.equals(adjacentBlocks)) {
refreshList();
return;
}
adjacentBlocks = new ArrayList<>(newAdjacentBlocks);
list.removeChildren();
int index = 0;
int sel = -1;
for (BlockPos coordinate : adjacentBlocks) {
IBlockState state = mc.world.getBlockState(coordinate);
Block block = state.getBlock();
int color = StyleConfig.colorTextInListNormal;
String displayName = BlockTools.getReadableName(mc.world, coordinate);
if (coordinate.equals(tileEntity.getMonitor())) {
sel = index;
color = TEXT_COLOR_SELECTED;
}
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
panel.addChild(new BlockRender(mc, this).setRenderItem(block));
panel.addChild(new Label(mc, this).setText(displayName).setColor(color).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(90));
panel.addChild(new Label(mc, this).setDynamic(true).setText(BlockPosTools.toString(coordinate)).setColor(color));
list.addChild(panel);
index++;
}
list.setSelected(sel);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFTools by McJty.
the class GuiRFMonitor method populateList.
private void populateList() {
List<BlockPos> newAdjacentBlocks = fromServer_clientAdjacentBlocks;
if (newAdjacentBlocks == null) {
return;
}
if (newAdjacentBlocks.equals(adjacentBlocks)) {
refreshList();
return;
}
adjacentBlocks = new ArrayList<>(newAdjacentBlocks);
list.removeChildren();
int index = 0;
int sel = -1;
for (BlockPos coordinate : adjacentBlocks) {
IBlockState state = mc.world.getBlockState(coordinate);
Block block = state.getBlock();
int color = StyleConfig.colorTextInListNormal;
String displayName = BlockTools.getReadableName(mc.world, coordinate);
if (coordinate.equals(tileEntity.getMonitor())) {
sel = index;
color = TEXT_COLOR_SELECTED;
}
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout());
panel.addChild(new BlockRender(mc, this).setRenderItem(block));
panel.addChild(new Label(mc, this).setText(displayName).setColor(color).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setDesiredWidth(90));
panel.addChild(new Label(mc, this).setDynamic(true).setText(BlockPosTools.toString(coordinate)).setColor(color));
list.addChild(panel);
index++;
}
list.setSelected(sel);
}
Aggregations