use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextField in project pnc-repressurized by TeamPneumatic.
the class GuiProgWidgetCondition method initGui.
@Override
public void initGui() {
super.initGui();
if (isSidedWidget()) {
for (int i = 0; i < 6; i++) {
String sideName = PneumaticCraftUtils.getOrientationName(EnumFacing.getFront(i));
GuiCheckBox checkBox = new GuiCheckBox(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF404040, sideName);
checkBox.checked = ((ISidedWidget) widget).getSides()[i];
addWidget(checkBox);
}
}
int baseX = isSidedWidget() ? 90 : 4;
int baseY = isUsingAndOr() ? 60 : 30;
List<GuiRadioButton> radioButtons;
GuiRadioButton radioButton;
if (isUsingAndOr()) {
radioButtons = new ArrayList<>();
radioButton = new GuiRadioButton(6, guiLeft + baseX, guiTop + 30, 0xFF404040, "Any block");
radioButton.checked = !((ICondition) widget).isAndFunction();
addWidget(radioButton);
radioButtons.add(radioButton);
radioButton.otherChoices = radioButtons;
radioButton = new GuiRadioButton(7, guiLeft + baseX, guiTop + 42, 0xFF404040, "All blocks");
radioButton.checked = ((ICondition) widget).isAndFunction();
addWidget(radioButton);
radioButtons.add(radioButton);
radioButton.otherChoices = radioButtons;
}
if (requiresNumber()) {
radioButtons = new ArrayList<>();
for (int i = 0; i < ICondition.Operator.values().length; i++) {
radioButton = new GuiRadioButton(8 + i, guiLeft + baseX, guiTop + baseY + i * 12, 0xFF404040, ICondition.Operator.values()[i].toString());
radioButton.checked = ((ICondition) widget).getOperator().ordinal() == i;
addWidget(radioButton);
radioButtons.add(radioButton);
radioButton.otherChoices = radioButtons;
}
textField = new WidgetTextField(Minecraft.getMinecraft().fontRenderer, guiLeft + baseX, guiTop + baseY + 30, 50, 11);
textField.setText(((ICondition) widget).getRequiredCount() + "");
addWidget(textField);
}
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextField in project pnc-repressurized by TeamPneumatic.
the class GuiProgWidgetLiquidFilter method initGui.
@Override
public void initGui() {
super.initGui();
mainFilter = new WidgetFluidFilter(-1, guiLeft + 124, guiTop + 25).setFluid(widget.getFluid());
addWidget(mainFilter);
for (int x = 0; x < GRID_WIDTH; x++) {
for (int y = 0; y < GRID_HEIGHT; y++) {
addWidget(new WidgetFluidFilter(x + y * GRID_WIDTH, guiLeft + 8 + x * 18, guiTop + 52 + y * 18));
}
}
searchField = new WidgetTextField(Minecraft.getMinecraft().fontRenderer, guiLeft + 10, guiTop + 30, 90, 10);
addWidget(searchField);
searchField.setFocused(true);
scrollbar = new WidgetVerticalScrollbar(guiLeft + 155, guiTop + 47, 112);
scrollbar.setListening(true);
addWidget(scrollbar);
addValidFluids();
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextField in project pnc-repressurized by TeamPneumatic.
the class GuiGPSTool method initGui.
@Override
public void initGui() {
super.initGui();
int[] oldText = new int[3];
if (textFields[0] == null) {
oldText[0] = oldGPSLoc.getX();
oldText[1] = oldGPSLoc.getY();
oldText[2] = oldGPSLoc.getZ();
} else {
for (int i = 0; i < 3; i++) oldText[i] = textFields[i].getValue();
}
int xMiddle = width / 2;
int yMiddle = height / 2;
for (int i = 0; i < 3; i++) {
textFields[i] = new WidgetTextFieldNumber(fontRenderer, xMiddle - TEXTFIELD_WIDTH / 2, yMiddle - 27 + i * 22, TEXTFIELD_WIDTH, fontRenderer.FONT_HEIGHT);
textFields[i].setValue(oldText[i]);
if (i == 1) {
textFields[i].minValue = 0;
textFields[i].maxValue = 255;
}
addWidget(textFields[i]);
}
for (int i = 0; i < 3; i++) {
buttonList.add(new GuiButton(0 + i * 4, xMiddle - 49 - TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "-10"));
buttonList.add(new GuiButton(1 + i * 4, xMiddle - 25 - TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "-1"));
buttonList.add(new GuiButton(2 + i * 4, xMiddle + 3 + TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "+1"));
buttonList.add(new GuiButton(3 + i * 4, xMiddle + 27 + TEXTFIELD_WIDTH / 2, yMiddle - 32 + i * 22, 22, 20, "+10"));
}
if (variableField != null)
oldVarName = variableField.getText();
variableField = new WidgetTextField(fontRenderer, xMiddle - 50, yMiddle + 60, 100, fontRenderer.FONT_HEIGHT);
variableField.setText(oldVarName);
addWidget(variableField);
String var = I18n.format("gui.progWidget.coordinate.variable");
addLabel(var, xMiddle - 62 - fontRenderer.getStringWidth(var), yMiddle + 61);
addLabel("#", xMiddle - 60, yMiddle + 61);
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextField in project pnc-repressurized by TeamPneumatic.
the class GuiPastebin method initGui.
@Override
public void initGui() {
super.initGui();
if (!PastebinHandler.isLoggedIn()) {
usernameBox = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 30, 80, 10);
addWidget(usernameBox);
passwordBox = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 56, 80, 10).setAsPasswordBox();
addWidget(passwordBox);
GuiButtonSpecial loginButton = new GuiButtonSpecial(0, guiLeft + 100, guiTop + 30, 60, 20, I18n.format("gui.pastebin.button.login"));
loginButton.setTooltipText("Pastebin login is optional");
addWidget(loginButton);
addLabel(I18n.format("gui.pastebin.username"), guiLeft + 10, guiTop + 20);
addLabel(I18n.format("gui.pastebin.password"), guiLeft + 10, guiTop + 46);
} else {
GuiButtonSpecial logoutButton = new GuiButtonSpecial(3, guiLeft + 60, guiTop + 30, 60, 20, I18n.format("gui.pastebin.button.logout"));
addWidget(logoutButton);
}
pastebinBox = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 130, 160, 10) {
@Override
public void onMouseClicked(int mouseX, int mouseY, int button) {
boolean wasFocused = isFocused();
super.onMouseClicked(mouseX, mouseY, button);
if (isFocused()) {
if (!wasFocused) {
// setText("");
setCursorPositionEnd();
setSelectionPos(0);
}
}
}
};
addWidget(pastebinBox);
GuiButtonSpecial pasteButton = new GuiButtonSpecial(1, guiLeft + 31, guiTop + 78, 120, 20, I18n.format("gui.pastebin.button.upload"));
addWidget(pasteButton);
GuiButtonSpecial getButton = new GuiButtonSpecial(2, guiLeft + 31, guiTop + 167, 120, 20, I18n.format("gui.pastebin.button.get"));
addWidget(getButton);
GuiButtonSpecial putInClipBoard = new GuiButtonSpecial(4, guiLeft + 8, guiTop + 78, 20, 20, "");
putInClipBoard.setRenderedIcon(Textures.GUI_COPY_ICON_LOCATION);
putInClipBoard.setTooltipText(I18n.format("gui.pastebin.button.copyToClipboard"));
addWidget(putInClipBoard);
GuiButtonSpecial retrieveFromClipboard = new GuiButtonSpecial(5, guiLeft + 8, guiTop + 167, 20, 20, "");
retrieveFromClipboard.setRenderedIcon(Textures.GUI_PASTE_ICON_LOCATION);
retrieveFromClipboard.setTooltipText(I18n.format("gui.pastebin.button.loadFromClipboard"));
addWidget(retrieveFromClipboard);
addLabel(I18n.format("gui.pastebin.pastebinLink"), guiLeft + 10, guiTop + 120);
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextField in project pnc-repressurized by TeamPneumatic.
the class GuiProgrammer method initGui.
@Override
public void initGui() {
if (pastebinGui != null && pastebinGui.outputTag != null) {
te.readProgWidgetsFromNBT(pastebinGui.outputTag);
pastebinGui = null;
NetworkHandler.sendToServer(new PacketProgrammerUpdate(te));
}
super.initGui();
if (programmerUnit != null) {
te.translatedX = programmerUnit.getTranslatedX();
te.translatedY = programmerUnit.getTranslatedY();
te.zoomState = programmerUnit.getLastZoom();
}
programmerUnit = new GuiUnitProgrammer(te.progWidgets, fontRenderer, guiLeft, guiTop, xSize, width, height, PROGRAMMING_START_X, PROGRAMMING_START_Y, PROGRAMMING_WIDTH, PROGRAMMING_HEIGHT, te.translatedX, te.translatedY, te.zoomState);
addWidget(programmerUnit.getScrollBar());
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
// addProgWidgetTabs(xStart, yStart);
importButton = new GuiButtonSpecial(1, xStart + 301, yStart + 3, 20, 15, "<--");
importButton.setTooltipText("Import program");
buttonList.add(importButton);
exportButton = new GuiButtonSpecial(2, xStart + 301, yStart + 20, 20, 15, "-->");
buttonList.add(exportButton);
buttonList.add(new GuiButton(3, xStart + 294, yStart + 174, 10, 10, "-"));
buttonList.add(new GuiButton(4, xStart + 335, yStart + 174, 10, 10, "+"));
allWidgetsButton = new GuiButtonSpecial(8, xStart + 321, yStart + 159, 10, 10, "<");
allWidgetsButton.setTooltipText(I18n.format("gui.programmer.button.openPanel.tooltip"));
addWidget(allWidgetsButton);
difficultyButtons = new ArrayList<>();
for (int i = 0; i < IProgWidget.WidgetDifficulty.values().length; i++) {
GuiRadioButton radioButton = new GuiRadioButton(i, xStart + 263, yStart + 200 + i * 12, 0xFF000000, IProgWidget.WidgetDifficulty.values()[i].getLocalizedName());
radioButton.checked = ConfigHandler.getProgrammerDifficulty() == i;
addWidget(radioButton);
difficultyButtons.add(radioButton);
radioButton.otherChoices = difficultyButtons;
if (i == 1)
radioButton.setTooltip(I18n.format("gui.programmer.difficulty.medium.tooltip"));
if (i == 2)
radioButton.setTooltip(I18n.format("gui.programmer.difficulty.advanced.tooltip"));
}
buttonList.add(new GuiButton(5, xStart + 5, yStart + 175, 87, 20, I18n.format("gui.programmer.button.showStart")));
buttonList.add(new GuiButton(6, xStart + 5, yStart + 197, 87, 20, I18n.format("gui.programmer.button.showLatest")));
addWidget(showInfo = new GuiCheckBox(-1, xStart + 5, yStart + 220, 0xFF000000, "gui.programmer.checkbox.showInfo").setChecked(te.showInfo));
addWidget(showFlow = new GuiCheckBox(-1, xStart + 5, yStart + 232, 0xFF000000, "gui.programmer.checkbox.showFlow").setChecked(te.showFlow));
GuiButtonSpecial pastebinButton = new GuiButtonSpecial(7, guiLeft - 24, guiTop + 44, 20, 20, "");
pastebinButton.setTooltipText(I18n.format("gui.remote.button.pastebinButton"));
pastebinButton.setRenderedIcon(Textures.GUI_PASTEBIN_ICON_LOCATION);
buttonList.add(pastebinButton);
undoButton = new GuiButtonSpecial(9, guiLeft - 24, guiTop + 2, 20, 20, "");
redoButton = new GuiButtonSpecial(10, guiLeft - 24, guiTop + 23, 20, 20, "");
GuiButtonSpecial clearAllButton = new GuiButtonSpecial(11, guiLeft - 24, guiTop + 65, 20, 20, "");
convertToRelativeButton = new GuiButtonSpecial(12, guiLeft - 24, guiTop + 86, 20, 20, "Rel");
undoButton.setRenderedIcon(Textures.GUI_UNDO_ICON_LOCATION);
redoButton.setRenderedIcon(Textures.GUI_REDO_ICON_LOCATION);
clearAllButton.setRenderedIcon(Textures.GUI_DELETE_ICON_LOCATION);
undoButton.setTooltipText(I18n.format("gui.programmer.button.undoButton.tooltip"));
redoButton.setTooltipText(I18n.format("gui.programmer.button.redoButton.tooltip"));
clearAllButton.setTooltipText(I18n.format("gui.programmer.button.clearAllButton.tooltip"));
buttonList.add(undoButton);
buttonList.add(redoButton);
buttonList.add(clearAllButton);
buttonList.add(convertToRelativeButton);
String containerName = I18n.format(te.getName() + ".name");
addLabel(containerName, guiLeft + 7, guiTop + 5, 0xFF404040);
nameField = new WidgetTextField(fontRenderer, guiLeft + 200, guiTop + 5, 98, fontRenderer.FONT_HEIGHT);
addWidget(nameField);
filterField = new FilterTextField(fontRenderer, guiLeft + 78, guiTop + 26, 100, fontRenderer.FONT_HEIGHT);
filterField.setListener(this);
addWidget(filterField);
String name = I18n.format("gui.programmer.name");
addLabel(name, guiLeft + 197 - fontRenderer.getStringWidth(name), guiTop + 5, 0xFF404040);
updateVisibleProgWidgets();
}
Aggregations