use of mcjty.lib.gui.Window in project RFToolsControl by McJty.
the class GuiRFToolsManual method initGui.
@Override
public void initGui() {
super.initGui();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
textPage = new TextPage(RFToolsControl.instance, mc, this).setText(manualText).setArrowImage(iconGuiElements, 144, 0).setCraftingGridImage(iconGuiElements, 0, 192);
prevButton = new Button(mc, this).setText("<").addButtonEvent(parent -> {
textPage.prevPage();
window.setTextFocus(textPage);
});
pageLabel = new Label(mc, this).setText("0 / 0");
nextButton = new Button(mc, this).setText(">").addButtonEvent(parent -> {
textPage.nextPage();
window.setTextFocus(textPage);
});
Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout()).setDesiredHeight(16).addChild(prevButton).addChild(pageLabel).addChild(nextButton);
Widget<?> toplevel = new Panel(mc, this).setFilledRectThickness(2).setLayout(new VerticalLayout()).addChild(textPage).addChild(buttonPanel);
toplevel.setBounds(new Rectangle(k, l, xSize, ySize));
window = new Window(this, toplevel);
window.setTextFocus(textPage);
if (locatePage != null) {
textPage.gotoNode(locatePage);
locatePage = null;
}
}
use of mcjty.lib.gui.Window 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.Window 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);
}
use of mcjty.lib.gui.Window 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;
}
use of mcjty.lib.gui.Window 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);
}
Aggregations