use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class GuiProgrammer method fillOpcodes.
private void fillOpcodes() {
opcodeList.removeChildren();
int x = 0;
int y = 0;
Panel childPanel = null;
for (Opcode opcode : Opcodes.SORTED_OPCODES) {
if (currentCategory != null) {
if (!opcode.getCategories().contains(currentCategory)) {
continue;
}
}
String key = opcode.getId();
if (childPanel == null) {
childPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setVerticalMargin(1).setSpacing(1).setHorizontalMargin(0)).setDesiredHeight(ICONSIZE + 1);
opcodeList.addChild(childPanel);
}
IconHolder holder = new IconHolder(mc, this) {
@Override
public List<String> getTooltips() {
return getIconTooltip(getIcon());
}
}.setDesiredWidth(ICONSIZE).setDesiredHeight(ICONSIZE).setMakeCopy(true);
holder.setIcon(ICONS.get(key).clone());
childPanel.addChild(holder);
x++;
if (x >= 3) {
y++;
x = 0;
childPanel = null;
}
}
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class GuiCraftingStation method updateRequestList.
private void updateRequestList() {
requestList.removeChildren();
for (CraftingRequest request : fromServer_requests) {
final ItemStack stack = request.getStack();
Panel panel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredWidth(16);
requestList.addChild(panel);
BlockRender blockRender = new BlockRender(mc, this) {
@Override
public List<String> getTooltips() {
ITooltipFlag flag = this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
List<String> list = stack.getTooltip(this.mc.player, flag);
for (int i = 0; i < list.size(); ++i) {
if (i == 0) {
list.set(i, stack.getRarity().rarityColor + list.get(i));
} else {
list.set(i, TextFormatting.GRAY + list.get(i));
}
}
return list;
}
}.setRenderItem(stack).setOffsetX(-1).setOffsetY(-1);
panel.addChild(blockRender);
boolean failed = request.getFailed() != -1;
boolean ok = request.getOk() != -1;
panel.addChild(new Label(mc, this).setColor(failed ? 0xffff3030 : (ok ? 0xff30ff30 : StyleConfig.colorTextNormal)).setText(failed ? "Failed!" : (ok ? "Ok" : "Wait (" + request.getTodo() + ")")));
}
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class GuiNode method initGui.
@Override
public void initGui() {
super.initGui();
Panel toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout());
channelField = new TextField(mc, this).setTooltips("Set the name of the network", "channel to connect too").addTextEvent((parent, newText) -> updateNode());
channelField.setText(tileEntity.getChannelName());
nodeNameField = new TextField(mc, this).setTooltips("Set the name of this node").addTextEvent((parent, newText) -> updateNode());
nodeNameField.setText(tileEntity.getNodeName());
Panel bottomPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).addChild(new Label(mc, this).setText("Channel:")).addChild(channelField).addChild(new Label(mc, this).setText("Node:")).addChild(nodeNameField);
toplevel.addChild(bottomPanel);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, WIDTH, HEIGHT));
window = new Window(this, toplevel);
}
use of mcjty.lib.gui.layout.HorizontalLayout in project RFToolsControl by McJty.
the class GuiTools method askSomething.
public static void askSomething(Minecraft mc, Gui gui, WindowManager windowManager, int x, int y, String title, String initialValue, Consumer<String> callback) {
Panel ask = new Panel(mc, gui).setLayout(new VerticalLayout()).setFilledBackground(0xff666666, 0xffaaaaaa).setFilledRectThickness(1);
ask.setBounds(new Rectangle(x, y, 100, 60));
Window askWindow = windowManager.createModalWindow(ask);
ask.addChild(new Label(mc, gui).setText(title));
TextField input = new mcjty.lib.gui.widgets.TextField(mc, gui).addTextEnterEvent(((parent, newText) -> {
windowManager.closeWindow(askWindow);
callback.accept(newText);
}));
input.setText(initialValue);
ask.addChild(input);
Panel buttons = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredWidth(100).setDesiredHeight(18);
buttons.addChild(new Button(mc, gui).setText("Ok").addButtonEvent((parent -> {
windowManager.closeWindow(askWindow);
callback.accept(input.getText());
})));
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 RFToolsControl by McJty.
the class LongEditor 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_LONG);
}
Aggregations